(function(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_checkPrivateMethod
,Clazz_cloneFinals
){
var $t$;
//var c$;
Jmol.___JmolDate="$Date: 2026-08-24 10:15:48 -0500 (Mon, 24 Aug 2026) $"
Jmol.___fullJmolProperties="src/org/jmol/viewer/Jmol.properties"
Jmol.___JmolVersion="16.4.23" // (legacy) also 16.4.24 (swingJS)
// JSmolJavaExt.js
 
// contains class declarations for 
// Integer, Byte, Short, Float, Double, Character
// EventObject, EventListenerProxy
// Throwable, Error
// and many others. If these classes have js files in java/, those files are unused


// This library will be wrapped by an additional anonymous function using ANT in 
// build_03_tojs.xml. This task will also modify variable names. References 
// to Clazz._ will not be changed, but other Clazz_xxx will be changed to 
// (local scope) Clazz_xxx, allowing them to be further compressed using
// Google Closure Compiler in that same ANT task.

// BH 2026.06.16 fixing sp.$replace; x.replace(y,"...$$...") use of $$ needs escaping
// BH 2025.11.10 removing override of String.prototype.concat
// BH 2023.07.08 NaN.0 fix
// BH 10/16/2017 6:51:20 AM fixing range error for MSIE in prepareCallback setting arguments.length < 0
// BH 10/13/2017 7:03:28 AM fix for String.initialize(bytes) applying bytes as arguments
// BH 9/18/2017 10:15:18 PM adding Integer.compare()
// BH 4/7/2017 10:48:50 AM adds Math.signum(f)
// BH 10/15/2016 9:28:13 AM adds Float.floatToIntBits(f)
// BH 3/9/2016 6:25:08 PM at least allow Error() by itself to work as before (inchi.js uses this)
// BH 12/21/2015 1:31:41 PM fixing String.instantialize for generic typed array
// BH 9/19/2015 11:05:45 PM Float.isInfinite(), Float.isNaN(), Double.isInfinite(), Double.isNaN() all not implemented
// BH 5/31/2015 5:53:04 PM Number.compareTo added
// BH 5/21/2015 5:46:30 PM Number("0xFFFFFFFF") is not -1
// BH 4/23/2015 9:08:59 AM xx.getComponentType() is nonfunctional. Array.newInstance now defines a wrapper for .getClass().getComponentType() that works  
// BH 4/12/2015 1:37:44 PM adding Math.rint = Math.round
// BH 1/16/2015 10:09:38 AM Chrome failure jqGrig due to new String("x").toString() not being a simple string
// BH 8/14/2014 6:49:22 PM Character class efficiencies
// BH 7/24/2014 9:02:18 AM most browsers do not support String.codePointAt()
// BH 7/11/2014 4:17:22 PM fix for Boolean.valueOf("false") not being false 
// BH 5/27/2014 6:29:59 AM ensure floats and doubles have decimal point in toString
// BH 4/1/2014 12:23:41 PM Encoding moved to Clazz._Encoding; 
// BH 4/1/2014 7:51:46 AM removing java.lang.B00lean
// BH 3/7/2014 9:17:10 AM removing Array.toString; moving that code here from j2sJmol.js
// BH 1/30/2014 9:04:25 AM adding Throwable.getStackTrace() as a STRING
// BH 12/4/2013 9:20:44 PM fix for reassigning Date.prototype.toString()
// BH 12/3/2013 11:43:10 AM bizarre Safari bug in reassigning Boolean (OK, I admit, we shouldn't have done that...) 
// BH 12/1/2013 6:50:16 AM evit Number.prototype.toString assignment removed!
// BH 11/30/2013 1:46:31 PM fixing Byte, Short, Long, Integer, Float, Double to reflect proper bounds and error conditions
// BH 11/29/2013 8:58:49 PM removing Boolean.toString(boolean)
// BH 11/4/2013 7:34:26 AM changing "var nativeClazz" to "var nativeClass" to avoid ANT replacement of "nativeClazz_" to "nativeClazz_"
// BH 10/19/2013 1:29:27 PM fixed String.$replace()
// BH 10/18/2013 6:09:23 PM fixed (Double|Float).valueOf(NaN).valueOf(), which should return NaN, not throw an error
// BH 10/12/2013 11:18:44 AM fixed bug in Double(String) and Float(String) that was returning typeof "string"
// BH 10/10/2013 2:40:20 PM  added Math.log10   
// BH 7/23/2013 7:24:01 AM fixing Number.shortValue() and Number.byteValue() for negative values
// BH 6/16/2013 1:31:30 PM adding /| in String.replace -- thank you David Koes
// BH 3/13/2013 12:49:23 PM setting Boolean.valueOf() "@" 
// BH 3/2/2013 10:46:45 PM removed Double.valueOf(String)
// BH 11/6/2012 8:26:33 PM added instanceof Int32Array in String.instantialize
// BH 10/13/2012 11:38:07 PM corrected Integer.parseInt to allow only +-0123456789; created Integer.parseIntRadix
// BH 11/1/2012 added Short
// BH 9/10/2012 6:27:21 AM added java.net.URL... classes
// BH 1/7/2013 7:40:06 AM added Clazz_dateToString

;(function(Clazz) {

// moved here from package.js
// these classes will be created as objects prior to any others
// and are then available immediately

	Clazz._Loader.registerPackages("java", [ "io", "lang", "lang.reflect", "util" ]);

  var sJU = "java.util";

  //var sJU = "JU";  
	//Clazz._Loader.registerPackages (sJU, ["regex", "zip"]);
	//var javautil = JU;

  var javautil = java.util;

	Clazz._Loader.ignore([
		"net.sf.j2s.ajax.HttpRequest",
		sJU + ".MapEntry.Type",
		"java.net.UnknownServiceException", // unnecessary for Jmol
		"java.lang.Runtime",
		"java.security.AccessController",
		"java.security.PrivilegedExceptionAction",
		"java.io.File",
		"java.io.FileInputStream",
		"java.io.FileWriter",
		"java.io.OutputStreamWriter",
//		sJU + ".Calendar", // bypassed in ModelCollection
//		"java.text.SimpleDateFormat", // not used
//		"java.text.DateFormat", // not used
		sJU + ".concurrent.Executors"
	])

Math.rint = Math.round;

Math.log10||(Math.log10=function(a){return Math.log(a)/2.302585092994046});

Math.signum||(Math.signum=function(d){return(d==0.0||isNaN(d))?d:d < 0 ? -1 : 1});

if(Clazz._supportsNativeObject){
	// Number and Array are special -- do not override prototype.toString -- "length - 2" here
	for(var i=0;i<Clazz._extendedObjectMethods.length - 2;i++){
		var p=Clazz._extendedObjectMethods[i];
		Array.prototype[p] = Clazz._O.prototype[p];
		Number.prototype[p] = Clazz._O.prototype[p];
	}
}

java.lang.Number=Number;
Number.__CLASS_NAME__="Number";
Clazz_implementOf(Number,java.io.Serializable);
Number.equals=Clazz._innerFunctions.equals;
Number.getName=Clazz._innerFunctions.getName;
Number.prototype.compareTo = function(x) { var a = this.value, b = x.value; return (a < b ? -1 : a == b ? 0 : 1) };

Clazz_defineMethod(Number,"shortValue",
function(){
var x = Math.round(this)&0xffff;
return (this < 0 && x > 0 ? x - 0x10000 : x);
});

Clazz_defineMethod(Number,"byteValue",
function(){
var x = Math.round(this)&0xff;
return (this < 0 && x > 0 ? x - 0x100 : x);
});

Clazz_defineMethod(Number,"intValue",
function(){
return Math.round(this)&0xffffffff;
});

Clazz_defineMethod(Number,"longValue",
function(){
return Math.round(this);
});

Clazz_defineMethod(Number,"floatValue",
function(){
return this.valueOf();
});
Clazz_defineMethod(Number,"doubleValue",
function(){
return parseFloat(this.valueOf());
});

Clazz_overrideMethod(Number,"hashCode",
function(){
return this.valueOf();
});

java.lang.Integer=Integer=function(){
Clazz_instantialize(this,arguments);
};
Clazz_decorateAsType(Integer,"Integer",Number,Comparable,null,true);
Integer.prototype.valueOf=function(){return 0;};
Integer.toString=Integer.prototype.toString=function(){
if(arguments.length!=0){
return""+arguments[0];
} else if(this===Integer){
return"class java.lang.Integer";
}
return""+this.valueOf();
};

/*

Clazz_makeConstructor(Integer,
function(){
this.valueOf=function(){
return 0;
};
});
*/


Clazz_overrideConstructor(Integer, function(v){
 v == null && (v = 0);
 if (typeof v != "number")
	v = Integer.parseIntRadix(v, 10);
 this.valueOf=function(){return v;};
}); //BH
/*
Clazz_makeConstructor(Integer,
function(s){
var value=Integer.parseInt(s,10);
this.valueOf=function(){
return value;
};
},"String");
*/
Integer.MIN_VALUE=Integer.prototype.MIN_VALUE=-0x80000000;
Integer.MAX_VALUE=Integer.prototype.MAX_VALUE=0x7fffffff;
Integer.TYPE=Integer.prototype.TYPE=Integer;


Integer.compare = Clazz_defineMethod(Integer,"compare",
function(i,j) {
  return (i < j ? -1 : i > j ? 1 : 0);
},"Number,Number");

Clazz_defineMethod(Integer,"bitCount",
function(i) {
	i = i - ((i >>> 1) & 0x55555555);
	i = (i & 0x33333333) + ((i >>> 2) & 0x33333333);
	i = (i + (i >>> 4)) & 0x0f0f0f0f;
	i = i + (i >>> 8);
	i = i + (i >>> 16);
	return i & 0x3f;
},"Number");
Integer.bitCount=Integer.prototype.bitCount;

Clazz_defineMethod(Integer,"numberOfLeadingZeros",
function(i) {
 if (i == 0) return 32;
 var n = 1;
 if (i >>> 16 == 0) { n += 16; i <<= 16; }
 if (i >>> 24 == 0) { n +=  8; i <<=  8; }
 if (i >>> 28 == 0) { n +=  4; i <<=  4; }
 if (i >>> 30 == 0) { n +=  2; i <<=  2; }
 n -= i >>> 31;
 return n;
},"Number");
Integer.numberOfLeadingZeros=Integer.prototype.numberOfLeadingZeros;

Clazz_defineMethod(Integer,"numberOfTrailingZeros",
function(i) {
	if (i == 0) return 32;
	var n = 31;
	var y = i <<16; if (y != 0) { n = n -16; i = y; }
	y = i << 8; if (y != 0) { n = n - 8; i = y; }
	y = i << 4; if (y != 0) { n = n - 4; i = y; }
	y = i << 2; if (y != 0) { n = n - 2; i = y; }
	return n - ((i << 1) >>> 31);
},"Number");
Integer.numberOfTrailingZeros=Integer.prototype.numberOfTrailingZeros;

Clazz_defineMethod(Integer,"parseIntRadix",
function(s,radix){
if(s==null){
throw new NumberFormatException("null");
}if(radix<2){
throw new NumberFormatException("radix "+radix+" less than Character.MIN_RADIX");
}if(radix>36){
throw new NumberFormatException("radix "+radix+" greater than Character.MAX_RADIX");
}
if (radix == 10) {
	for (var i = s.length; --i >= 0;) {
		var c = s.charCodeAt(i);
		if (c >= 48 && c <= 57) continue;
		if (i > 0 || c != 43 && c != 45)
			throw new NumberFormatException("Not a Number : "+s);

	}
}
var i=parseInt(s,radix);
if(isNaN(i)){
throw new NumberFormatException("Not a Number : "+s);
}
return i;
},"String, Number");
Integer.parseIntRadix=Integer.prototype.parseIntRadix;

Clazz_defineMethod(Integer,"parseInt",
function(s){
return Integer.parseIntRadix(s,10);
},"String");
Integer.parseInt=Integer.prototype.parseInt;

/*
Clazz_defineMethod(Integer,"$valueOf",
function(s){
return new Integer(Integer.parseIntRadix(s,10));
},"String");
*/

Clazz_overrideMethod(Integer,"$valueOf",
function(s){
return new Integer(s);
});

/*
Clazz_defineMethod(Integer,"$valueOf",
function(s,r){
return new Integer(Integer.parseIntRadix(s,r));
},"String, Number");
*/

Integer.$valueOf=Integer.prototype.$valueOf;


Clazz_overrideMethod(Integer,"equals",
function(s){
if(s==null||!Clazz_instanceOf(s,Integer)){
return false;
}
return s.valueOf()==this.valueOf();
},"Object");
Integer.toHexString=Integer.prototype.toHexString=function(d){
if(d.valueOf)d=d.valueOf();
if (d < 0) {
var b = d & 0xFFFFFF;
var c = ((d>>24)&0xFF);
return c._numberToString(16) + (b = "000000" + b._numberToString(16)).substring(b.length - 6);
}
return d._numberToString(16);};
Integer.toOctalString=Integer.prototype.toOctalString=function(d){if(d.valueOf)d=d.valueOf();return d._numberToString(8);};
Integer.toBinaryString=Integer.prototype.toBinaryString=function(d){if(d.valueOf)d=d.valueOf();return d._numberToString(2);};

Integer.decodeRaw=Clazz_defineMethod(Integer,"decodeRaw", function(n){
if (n.indexOf(".") >= 0)n = "";
var i = (n.startsWith("-") ? 1 : 0);
n = n.replace(/\#/, "0x").toLowerCase();
var radix=(n.startsWith("0x", i) ? 16 : n.startsWith("0", i) ? 8 : 10);
// The general problem with parseInt is that is not strict -- ParseInt("10whatever") == 10.
// Number is strict, but Number("055") does not work, though ParseInt("055", 8) does.
// need to make sure negative numbers are negative
n = Number(n) & 0xFFFFFFFF;
return (radix == 8 ? parseInt(n, 8) : n);
},"~S");

Integer.decode=Clazz_defineMethod(Integer,"decode", function(n){
	n = Integer.decodeRaw(n);
	if (isNaN(n) || n < Integer.MIN_VALUE|| n > Integer.MAX_VALUE)
	throw new NumberFormatException("Invalid Integer");
	return new Integer(n);
},"~S");

Clazz_overrideMethod(Integer,"hashCode",
function(){
return this.valueOf();
});

// Note that Long is problematic in JavaScript 

java.lang.Long=Long=function(){
Clazz_instantialize(this,arguments);
};
Clazz_decorateAsType(Long,"Long",Number,Comparable,null,true);
Long.prototype.valueOf=function(){return 0;};
Long.toString=Long.prototype.toString=function(){
if(arguments.length!=0){
return""+arguments[0];
}else if(this===Long){
return"class java.lang.Long";
}
return""+this.valueOf();
};

Clazz_overrideConstructor(Long, function(v){
 v == null && (v = 0);
 v = (typeof v == "number" ? Math.round(v) : Integer.parseIntRadix(v, 10));
this.valueOf=function(){return v;};
});

//Long.MIN_VALUE=Long.prototype.MIN_VALUE=-0x8000000000000000;
//Long.MAX_VALUE=Long.prototype.MAX_VALUE=0x7fffffffffffffff;
Long.TYPE=Long.prototype.TYPE=Long;

Clazz_defineMethod(Long,"parseLong",
function(s,radix){
 return Integer.parseInt(s, radix || 10);
});

Long.parseLong=Long.prototype.parseLong;

Clazz_overrideMethod(Long,"$valueOf",
function(s){
return new Long(s);
});
/*
Clazz_defineMethod(Long,"$valueOf",
function(s){
return new Long(s);
},"Number");

Clazz_defineMethod(Long,"$valueOf",
function(s,r){
return new Long(Long.parseLong(s,r));
},"String, Number");
*/
Long.$valueOf=Long.prototype.$valueOf;
Clazz_overrideMethod(Long,"equals",
function(s){
if(s==null||!Clazz_instanceOf(s,Long)){
return false;
}
return s.valueOf()==this.valueOf();
},"Object");
Long.toHexString=Long.prototype.toHexString=function(i){
return i.toString(16);
};
Long.toOctalString=Long.prototype.toOctalString=function(i){
return i.toString(8);
};
Long.toBinaryString=Long.prototype.toBinaryString=function(i){
return i.toString(2);
};


Long.decode=Clazz_defineMethod(Long,"decode",
function(n){
	n = Integer.decodeRaw(n);
	if (isNaN(n))
		throw new NumberFormatException("Invalid Long");
	return new Long(n);
},"~S");

java.lang.Short = Short = function () {
Clazz_instantialize (this, arguments);
};
Clazz_decorateAsType (Short, "Short", Number, Comparable, null, true);
Short.prototype.valueOf = function () { return 0; };
Short.toString = Short.prototype.toString = function () {
	if (arguments.length != 0) {
		return "" + arguments[0];
	} else if (this === Short) {
		return "class java.lang.Short"; // Short.class.toString
	}
	return "" + this.valueOf ();
};

Clazz_overrideConstructor(Short,
function (v) {
 v == null && (v = 0);
 if (typeof v != "number")
	v = Integer.parseIntRadix(v, 10);
 v = v.shortValue();
 this.valueOf = function () {return v;};
});


Short.MIN_VALUE = Short.prototype.MIN_VALUE = -32768;
Short.MAX_VALUE = Short.prototype.MAX_VALUE = 32767;
Short.TYPE = Short.prototype.TYPE = Short;

Clazz_defineMethod(Short, "parseShortRadix",
function (s, radix) {
return Integer.parseIntRadix(s, radix).shortValue();
}, "String, Number");
Short.parseShortRadix = Short.prototype.parseShortRadix;

Clazz_defineMethod(Short, "parseShort",
function (s) {
return Short.parseShortRadix (s, 10);
}, "String");

Short.parseShort = Short.prototype.parseShort;

/*
Clazz_defineMethod(Short, "$valueOf",
function (s) {
return new Short(Short.parseShort (s, 10));
}, "String");
	*/

Clazz_overrideMethod(Short, "$valueOf",
function (s) {
return new Short(s);
});

/*
Clazz_defineMethod(Short, "$valueOf",
function (s, r) {
return new Short(Short.parseShort (s, r));
}, "String, Number");
	*/

Short.$valueOf = Short.prototype.$valueOf;
Clazz_overrideMethod(Short, "equals",
function (s) {
if(s == null || !Clazz_instanceOf(s, Short) ){
	return false;
}
return s.valueOf()  == this.valueOf();
}, "Object");
Short.toHexString = Short.prototype.toHexString = function (i) {
	return i.toString (16);
};
Short.toOctalString = Short.prototype.toOctalString = function (i) {
	return i.toString (8);
};
Short.toBinaryString = Short.prototype.toBinaryString = function (i) {
	return i.toString (2);
};
Short.decode = Clazz_defineMethod(Short, "decode",
function(n){
	n = Integer.decodeRaw(n);
	if (isNaN(n) || n < -32768|| n > 32767)
		throw new NumberFormatException("Invalid Short");
	return new Short(n);
}, "~S");

java.lang.Byte=Byte=function(){
Clazz_instantialize(this,arguments);
};
Clazz_decorateAsType(Byte,"Byte",Number,Comparable,null,true);
Byte.prototype.valueOf=function(){return 0;};
Byte.toString=Byte.prototype.toString=function(){
if(arguments.length!=0){
return""+arguments[0];
}else if(this===Byte){
return"class java.lang.Byte";
}
return""+this.valueOf();
};
Clazz_makeConstructor(Byte,
function(v){
 if (typeof v != "number")
	 v = Integer.parseIntRadix(v, 10);
 v = v.byteValue();
this.valueOf=function(){
return v;
};
});

Byte.serialVersionUID=Byte.prototype.serialVersionUID=-7183698231559129828;
Byte.MIN_VALUE=Byte.prototype.MIN_VALUE=-128;
Byte.MAX_VALUE=Byte.prototype.MAX_VALUE=127;
Byte.SIZE=Byte.prototype.SIZE=8;
Byte.TYPE=Byte.prototype.TYPE=Byte;

Clazz_defineMethod(Byte,"parseByteRadix",
function(s,radix){
 return Integer.parseIntRadix(s, radix).byteValue();
},"String, Number");
Byte.parseByteRadix=Byte.prototype.parseByteRadix;

Clazz_defineMethod(Byte,"parseByte",
function(s){
return Byte.parseByte(s,10);
},"String");

Byte.parseByte=Byte.prototype.parseByte;

Clazz_overrideMethod(Byte, "$valueOf",
function (s) {
return new Byte(s);
});

Byte.$valueOf=Byte.prototype.$valueOf;
Clazz_overrideMethod(Byte,"equals",
function(s){
if(s==null||!Clazz_instanceOf(s,Byte)){
return false;
}
return s.valueOf()==this.valueOf();
},"Object");
Byte.toHexString=Byte.prototype.toHexString=function(i){
return i.toString(16);
};
Byte.toOctalString=Byte.prototype.toOctalString=function(i){
return i.toString(8);
};
Byte.toBinaryString=Byte.prototype.toBinaryString=function(i){
return i.toString(2);
};
Byte.decode=Clazz_defineMethod(Byte,"decode",
function(n){
	n = Integer.decodeRaw(n);
	if (isNaN(n) || n < -128|| n > 127)
		throw new NumberFormatException("Invalid Byte");
return new Byte(n);
},"~S");

Clazz._floatToString = function(f) {
 var s = ""+f
 if (s.indexOf(".") < 0 && s.indexOf("e") < 0 && s != "NaN")
 	 s += ".0";
 return s;
}

java.lang.Float=Float=function(){
Clazz_instantialize(this,arguments);
};
Clazz_decorateAsType(Float,"Float",Number,Comparable,null,true);
Float.prototype.valueOf=function(){return 0;};
Float.toString=Float.prototype.toString=function(){
if(arguments.length!=0){
return Clazz._floatToString(arguments[0]);
}else if(this===Float){
return"class java.lang.Float";
}
return Clazz._floatToString(this.valueOf());
};

Clazz._a32 = null;

Float.floatToIntBits = function(f) {
var a = Clazz._a32 || (Clazz._a32 = new Float32Array(1));
a[0] = f;
return new Int32Array(a.buffer)[0]; 
}

Clazz_overrideConstructor(Float, function(v){
 v == null && (v = 0);
 if (typeof v != "number") 
	v = Number(v);
 this.valueOf=function(){return v;}
});

Float.serialVersionUID=Float.prototype.serialVersionUID=-2671257302660747028;
Float.MIN_VALUE=Float.prototype.MIN_VALUE=1.4e-45;
Float.MAX_VALUE=Float.prototype.MAX_VALUE=3.4028235e+38;
Float.NEGATIVE_INFINITY=Number.NEGATIVE_INFINITY;
Float.POSITIVE_INFINITY=Number.POSITIVE_INFINITY;
Float.NaN=Number.NaN;
Float.TYPE=Float.prototype.TYPE=Float;

Clazz_defineMethod(Float,"parseFloat",
function(s){
if(s==null){
throw new NumberFormatException("null");
}
if (typeof s == "number")return s;  // important -- typeof NaN is "number" and is OK here
var floatVal=Number(s);
if(isNaN(floatVal)){
throw new NumberFormatException("Not a Number : "+s);
}
return floatVal;
},"String");
Float.parseFloat=Float.prototype.parseFloat;

Clazz_overrideMethod(Float,"$valueOf",
function(s){
return new Float(s);
});

Float.$valueOf=Float.prototype.$valueOf;

Clazz_defineMethod(Float,"isNaN",
function(num){
return isNaN(arguments.length == 1 ? num : this.valueOf());
},"Number");
Float.isNaN=Float.prototype.isNaN;
Clazz_defineMethod(Float,"isInfinite",
function(num){
return!isFinite(arguments.length == 1 ? num : this.valueOf());
},"Number");
Float.isInfinite=Float.prototype.isInfinite;

Clazz_overrideMethod(Float,"equals",
function(s){
if(s==null||!Clazz_instanceOf(s,Float)){
return false;
}
return s.valueOf()==this.valueOf();
},"Object");

java.lang.Double=Double=function(){
Clazz_instantialize(this,arguments);
};
Clazz_decorateAsType(Double,"Double",Number,Comparable,null,true);
Double.prototype.valueOf=function(){return 0;};
Double.toString=Double.prototype.toString=function(){
if(arguments.length!=0){
return Clazz._floatToString(arguments[0]);
}else if(this===Double){
return"class java.lang.Double";
}
return Clazz._floatToString(this.valueOf());
};

Clazz_overrideConstructor(Double, function(v){
 v == null && (v = 0);
 if (typeof v != "number") 
	v = Double.parseDouble(v);
 this.valueOf=function(){return v;};
}); // BH

Double.serialVersionUID=Double.prototype.serialVersionUID=-9172774392245257468;
Double.MIN_VALUE=Double.prototype.MIN_VALUE=4.9e-324;
Double.MAX_VALUE=Double.prototype.MAX_VALUE=1.7976931348623157e+308;
Double.NEGATIVE_INFINITY=Number.NEGATIVE_INFINITY;
Double.POSITIVE_INFINITY=Number.POSITIVE_INFINITY;
Double.NaN=Number.NaN;
Double.TYPE=Double.prototype.TYPE=Double;

Clazz_defineMethod(Double,"isNaN",
function(num){
return isNaN(arguments.length == 1 ? num : this.valueOf());
},"Number");
Double.isNaN=Double.prototype.isNaN;
Clazz_defineMethod(Double,"isInfinite",
function(num){
return!isFinite(arguments.length == 1 ? num : this.valueOf());
},"Number");
Double.isInfinite=Double.prototype.isInfinite;

Clazz_defineMethod(Double,"parseDouble",
function(s){
if(s==null){
throw new NumberFormatException("null");
}
if (typeof s == "number")return s;  // important -- typeof NaN is "number" and is OK here
var doubleVal=Number(s);
if(isNaN(doubleVal)){
throw new NumberFormatException("Not a Number : "+s);
}
return doubleVal;
},"String");
Double.parseDouble=Double.prototype.parseDouble;

/*
Clazz_defineMethod(Double,"$valueOf",
function(s){
return new Double(this.parseDouble(s));
},"String");
*/

Clazz_defineMethod(Double,"$valueOf",
function(v){
return new Double(v);
},"Number");

Double.$valueOf=Double.prototype.$valueOf;

Clazz_overrideMethod(Double,"equals",
function(s){
if(s==null||!Clazz_instanceOf(s,Double)){
return false;
}
return s.valueOf()==this.valueOf();
},"Object");


//java.lang.B00lean = Boolean; ?? BH why this?
Boolean = java.lang.Boolean = Boolean || function () {Clazz_instantialize (this, arguments);};
if (Clazz._supportsNativeObject) {
	for (var i = 0; i < Clazz._extendedObjectMethods.length; i++) {
		var p = Clazz._extendedObjectMethods[i];
		Boolean.prototype[p] = Clazz._O.prototype[p];
	}
}
Boolean.__CLASS_NAME__="Boolean";
Clazz_implementOf(Boolean,[java.io.Serializable,java.lang.Comparable]);
Boolean.equals=Clazz._innerFunctions.equals;
Boolean.getName=Clazz._innerFunctions.getName;
Boolean.serialVersionUID=Boolean.prototype.serialVersionUID=-3665804199014368530;

//Clazz_makeConstructor(Boolean,
//function(value){
//this.valueOf=function(){
//return value;
//};
//},"~B");

Clazz_overrideConstructor(Boolean,
function(s){
	var b = ((typeof s == "string" ? Boolean.toBoolean(s) : s) ? true : false);
	this.valueOf=function(){return b;};
},"~O");

Boolean.parseBoolean=Clazz_defineMethod(Boolean,"parseBoolean",
function(s){
return Boolean.toBoolean(s);
},"~S");
Clazz_defineMethod(Boolean,"booleanValue",
function(){
return this.valueOf();
});
Boolean.$valueOf=Clazz_overrideMethod(Boolean,"$valueOf",
function(b){
return((typeof b == "string"? "true".equalsIgnoreCase(b) : b)?Boolean.TRUE:Boolean.FALSE);
});

/*
Boolean.toString=Clazz_defineMethod(Boolean,"toString",
function(b){
return b?"true":"false";
},"~B");
*/

Clazz_overrideMethod(Boolean,"toString",
function(){
return this.valueOf()?"true":"false";
});
Clazz_overrideMethod(Boolean,"hashCode",
function(){
return this.valueOf()?1231:1237;
});
Clazz_overrideMethod(Boolean,"equals",
function(obj){
if(Clazz_instanceOf(obj,Boolean)){
return this.booleanValue()==obj.booleanValue();
}return false;
},"~O");
Boolean.getBoolean=Clazz_defineMethod(Boolean,"getBoolean",
function(name){
var result=false;
try{
result=Boolean.toBoolean(System.getProperty(name));
}catch(e){
if(Clazz_instanceOf(e,IllegalArgumentException)){
}else if(Clazz_instanceOf(e,NullPointerException)){
}else{
throw e;
}
}
return result;
},"~S");
Clazz_overrideMethod(Boolean,"compareTo",
function(b){
return(b.value==this.value?0:(this.value?1:-1));
},"Boolean");
Boolean.toBoolean=Clazz_defineMethod(Boolean,"toBoolean",
($fz=function(name){
return((name!=null)&&name.equalsIgnoreCase("true"));
},$fz.isPrivate=true,$fz),"~S");
Boolean.TRUE=Boolean.prototype.TRUE=new Boolean(true);
Boolean.FALSE=Boolean.prototype.FALSE=new Boolean(false);
Boolean.TYPE=Boolean.prototype.TYPE=Boolean;


Clazz._Encoding=new Object();

(function(Encoding) {

Encoding.UTF8="utf-8";
Encoding.UTF16="utf-16";
Encoding.ASCII="ascii";


Encoding.guessEncoding=function(str){
if(str.charCodeAt(0)==0xEF&&str.charCodeAt(1)==0xBB&&str.charCodeAt(2)==0xBF){
return Encoding.UTF8;
}else if(str.charCodeAt(0)==0xFF&&str.charCodeAt(1)==0xFE){
return Encoding.UTF16;
}else{
return Encoding.ASCII;
}
};

Encoding.guessEncodingArray=function(a){
if(a[0]==0xEF&&a[1]==0xBB&&a[2]==0xBF){
return Encoding.UTF8;
}else if(a[0]==0xFF&&a[1]==0xFE){
return Encoding.UTF16;
}else{
return Encoding.ASCII;
}
};

Encoding.readUTF8=function(str){
if (typeof str != "string") return Encoding.readUTF8Array(str);
var encoding=Encoding.guessEncoding(str);
var startIdx=0;
if(encoding==Encoding.UTF8){
startIdx=3;
}else if(encoding==Encoding.UTF16){
startIdx=2;
}
var arrs=new Array();
for(var i=startIdx;i<str.length;i++){
var charCode=str.charCodeAt(i);
if(charCode<0x80){
arrs[arrs.length]=str.charAt(i);
}else if(charCode>0xc0&&charCode<0xe0){
var c1=charCode&0x1f;
i++;
var c2=str.charCodeAt(i)&0x3f;
var c=(c1<<6)+c2;
arrs[arrs.length]=String.fromCharCode(c);
}else if(charCode>=0xe0){
var c1=charCode&0x0f;
i++;
var c2=str.charCodeAt(i)&0x3f;
i++;
var c3=str.charCodeAt(i)&0x3f;
var c=(c1<<12)+(c2<<6)+c3;
arrs[arrs.length]=String.fromCharCode(c);
}
}
return arrs.join('');
};

Encoding.readUTF8Array=function(a){
var encoding=Encoding.guessEncodingArray(a);
var startIdx=0;
if(encoding==Encoding.UTF8){
startIdx=3;
}else if(encoding==Encoding.UTF16){
startIdx=2;
}
var arrs=new Array();
for(var i=startIdx;i<a.length;i++){
var charCode=a[i];
if(charCode<0x80){
arrs[arrs.length]=String.fromCharCode(charCode);
}else if(charCode>0xc0&&charCode<0xe0){
var c1=charCode&0x1f;
var c2=a[++i]&0x3f;
var c=(c1<<6)+c2;
arrs[arrs.length]=String.fromCharCode(c);
}else if(charCode>=0xe0){
var c1=charCode&0x0f;
var c2=a[++i]&0x3f;
var c3=a[++i]&0x3f;
var c=(c1<<12)+(c2<<6)+c3;
arrs[arrs.length]=String.fromCharCode(c);
}
}
return arrs.join('');
};

Encoding.convert2UTF8=function(str){
var encoding=this.guessEncoding(str);
var startIdx=0;
if(encoding==Encoding.UTF8){
return str;
}else if(encoding==Encoding.UTF16){
startIdx=2;
}

var offset=0;
var arrs=new Array(offset+str.length-startIdx);

for(var i=startIdx;i<str.length;i++){
var charCode=str.charCodeAt(i);
if(charCode<0x80){
arrs[offset+i-startIdx]=str.charAt(i);
}else if(charCode<=0x07ff){
var c1=0xc0+((charCode&0x07c0)>>6);
var c2=0x80+(charCode&0x003f);
arrs[offset+i-startIdx]=String.fromCharCode(c1)+String.fromCharCode(c2);
}else{
var c1=0xe0+((charCode&0xf000)>>12);
var c2=0x80+((charCode&0x0fc0)>>6);
var c3=0x80+(charCode&0x003f);
arrs[offset+i-startIdx]=String.fromCharCode(c1)+String.fromCharCode(c2)+String.fromCharCode(c3);
}
}
return arrs.join('');
};
Encoding.base64Chars=new Array(
'A','B','C','D','E','F','G','H',
'I','J','K','L','M','N','O','P',
'Q','R','S','T','U','V','W','X',
'Y','Z','a','b','c','d','e','f',
'g','h','i','j','k','l','m','n',
'o','p','q','r','s','t','u','v',
'w','x','y','z','0','1','2','3',
'4','5','6','7','8','9','+','/'
);
Encoding.encodeBase64=function(str){
if(str==null||str.length==0)return str;
var b64=Encoding.base64Chars;
var length=str.length;
var index=0;
var buf=[];
var c0,c1,c2;
while(index<length){
c0=str.charCodeAt(index++);
buf[buf.length]=b64[c0>>2];
if(index<length){
c1=str.charCodeAt(index++);
buf[buf.length]=b64[((c0<<4)&0x30)|(c1>>4)];
if(index<length){
c2=str.charCodeAt(index++);
buf[buf.length]=b64[((c1<<2)&0x3c)|(c2>>6)];
buf[buf.length]=b64[c2&0x3F];
}else{
buf[buf.length]=b64[((c1<<2)&0x3c)];
buf[buf.length]='=';
}
}else{
buf[buf.length]=b64[(c0<<4)&0x30];
buf[buf.length]='=';
buf[buf.length]='=';
}
}
return buf.join('');
};
Encoding.decodeBase64=function(str){
if(str==null||str.length==0)return str;
var b64=Encoding.base64Chars;
var xb64=Encoding.xBase64Chars;
if(Encoding.xBase64Chars==null){
xb64=new Object();
for(var i=0;i<b64.length;i++){
xb64[b64[i]]=i;
}
Encoding.xBase64Chars=xb64;
}
var length=str.length;
var index=0;
var buf=[];
var c0,c1,c2,c3;
var c=0;
while(index<length&&c++<60000){
c0=xb64[str.charAt(index++)];
c1=xb64[str.charAt(index++)];
c2=xb64[str.charAt(index++)];
c3=xb64[str.charAt(index++)];
buf[buf.length]=String.fromCharCode(((c0<<2)&0xff)|c1>>4);
if(c2!=null){
buf[buf.length]=String.fromCharCode(((c1<<4)&0xff)|c2>>2);
if(c3!=null){
buf[buf.length]=String.fromCharCode(((c2<<6)&0xff)|c3);
}
}
}
return buf.join('');
};

if(String.prototype.$replace==null){
java.lang.String=String;
Clazz._setDeclared("String", String);

if(Clazz._supportsNativeObject){
for(var i=0;i<Clazz._extendedObjectMethods.length;i++){
var p=Clazz._extendedObjectMethods[i];
if("to$tring"==p||"toString"==p||"equals"==p||"hashCode"==p){
continue;
}
String.prototype[p]=Clazz._O.prototype[p];
}
}

Clazz_implementOf(String,[java.io.Serializable,CharSequence,Comparable]);

String.getName=Clazz._innerFunctions.getName;

String.serialVersionUID=String.prototype.serialVersionUID=-6849794470754667710;


;(function(sp) {

sp.$replace=function(c1,c2){
	if (c1 == c2 || this.indexOf (c1) < 0) return "" + this;
	if (c1.length == 1) {
		if ("\\$.*+|?^{}()[]".indexOf(c1) >= 0) 	c1 = "\\" + c1;
	} else {    
		c1=c1.replace(/([\\\$\.\*\+\|\?\^\{\}\(\)\[\]])/g,function($0,$1){return"\\"+$1;});
	}
	var pt = c2.indexOf("$");
	var is$ = (pt >= 0 && pt < c2.length - 1);
	if (is$)
		c2 = c2.split("$").join("\uFFFD");
	var ret = this.replace(new RegExp(c1,"gm"),c2);
	if (is$)
		ret = ret.split("\uFFFD").join("$");
	return ret;	
};
sp.$generateExpFunction=function(str){
var arr=[];
var orders=[];
var idx=0;
arr[0]="";
var i=0;
for(;i<str.length;i++){
var ch=str.charAt(i);
if(i!=str.length-1&&ch=='\\'){
i++;
var c=str.charAt(i);
if(c=='\\'){
arr[idx]+='\\';
}
arr[idx]+=c;
}else if(i!=str.length-1&&ch=='$'){
i++;
orders[idx]=parseInt(str.charAt(i));
idx++;
arr[idx]="";
}else if(ch=='\r'){
arr[idx]+="\\r";
}else if(ch=='\n'){
arr[idx]+="\\n";
}else if(ch=='\t'){
arr[idx]+="\\t";
}else if(ch=='\"'){
arr[idx]+="\\\"";
}else{
arr[idx]+=ch;
}
}
var funStr="f = function (";
var max=Math.max.apply({},orders);
for(i=0;i<=max;i++){
funStr+="$"+i;
if(i!=max){
funStr+=", ";
}
}
funStr+=") { return ";
for(i=0;i<arr.length-1;i++){
funStr+="\""+arr[i]+"\" + $"+orders[i]+" + ";
}
funStr+="\""+arr[i]+"\"; }";
return eval(funStr);
};

sp.replaceAll=function(exp,str){
var regExp=new RegExp(exp,"gm");
return this.replace(regExp,this.$generateExpFunction(str));
};
sp.replaceFirst=function(exp,str){
var regExp=new RegExp(exp,"m");
return this.replace(regExp,this.$generateExpFunction(str));
};
sp.matches=function(exp){
if(exp!=null){
exp="^("+exp+")$";
}
var regExp=new RegExp(exp,"gm");
var m=this.match(regExp);
return m!=null&&m.length!=0;
};
sp.regionMatches=function(ignoreCase,toffset,
other,ooffset,len){

if(typeof ignoreCase=="number"
||(ignoreCase!=true&&ignoreCase!=false)){
len=ooffset;
ooffset=other;
other=toffset;
toffset=ignoreCase;
ignoreCase=false;
}
var to=toffset;
var po=ooffset;

if((ooffset<0)||(toffset<0)||(toffset>this.length-len)||
(ooffset>other.length-len)){
return false;
}
var s1=this.substring(toffset,toffset+len);
var s2=other.substring(ooffset,ooffset+len);
if(ignoreCase){
s1=s1.toLowerCase();
s2=s2.toLowerCase();
}
return s1==s2;
};



sp.$plit=function(regex,limit){
if (!limit && regex == " ")
	return this.split(regex);

if(limit!=null&&limit>0){
if(limit==1){
return this;
}
var regExp=new RegExp("("+regex+")","gm");
var count=1;
var s=this.replace(regExp,function($0,$1){
count++;
if(count==limit){
return"@@_@@";
}else if(count>limit){
return $0;
}else{
return $0;
}
});
regExp=new RegExp(regex,"gm");
var arr=this.split(regExp);
if(arr.length>limit){
arr[limit-1]=s.substring(s.indexOf("@@_@@")+5);
arr.length=limit;
}
return arr;
}else{
var regExp=new RegExp(regex,"gm");
return this.split(regExp);
}
};
/*
sp.trim=function(){
var len=this.length;
var st=0;

while((st<len)&&(this.charAt(st)<=' ')){
st++;
}
while((st<len)&&(this.charAt(len-1)<=' ')){
len--;
}
return((st>0)||(len<len))?this.substring(st,len):this;
};


*/

if (!sp.trim)
sp.trim=function(){
return this.replace(/^\s+/g,'').replace(/\s+$/g,'');
};

if (!sp.startsWith || !sp.endsWith) {
var sn=function(s, prefix,toffset){
var to=toffset;
var po=0;
var pc=prefix.length;

if((toffset<0)||(toffset>s.length-pc)){
return false;
}
while(--pc>=0){
if(s.charAt(to++)!=prefix.charAt(po++)){
return false;
}
}
return true;
};

sp.startsWith=function(prefix){
if(arguments.length==1){
return sn(this,arguments[0],0);
}else if(arguments.length==2){
return sn(this,arguments[0],arguments[1]);
}else{
return false;
}
};

sp.endsWith=function(suffix){
return sn(this, suffix,this.length-suffix.length);
};

}

sp.equals=function(anObject){
return this.valueOf()==anObject;
};

sp.equalsIgnoreCase=function(anotherString){
return(anotherString==null)?false:(this==anotherString
||this.toLowerCase()==anotherString.toLowerCase());
};


sp.hash=0;

sp.hashCode=function(){
var h=this.hash;
if(h==0){
var off=0;
var len=this.length;
for(var i=0;i<len;i++){
h=31*h+this.charCodeAt(off++);
h&=0xffffffff;
}
this.hash=h;
}
return h;
};

sp.getBytes=function(){
if(arguments.length==4){
return this.getChars(arguments[0],arguments[1],arguments[2],arguments[3]);
}
var s=this;
if(arguments.length==1){
var cs=arguments[0].toString().toLowerCase();
var charset=[
"utf-8","UTF8","us-ascii","iso-8859-1","8859_1","gb2312","gb18030","gbk"
];
var existed=false;
for(var i=0;i<charset.length;i++){
if(charset[i]==cs){
existed=true;
break;
}
}
if(!existed){
throw new java.io.UnsupportedEncodingException();
}
if(cs=="utf-8"||cs=="utf8"){
s=Encoding.convert2UTF8(this);
}
}
var arrs=new Array(s.length);
var c=0,ii=0;
for(var i=0;i<s.length;i++){
c=s.charCodeAt(i);
if(c>255){
arrs[ii]=0x1a;
arrs[ii+1]=c&0xff;
arrs[ii+2]=(c&0xff00)>>8;
ii+=2;
}else{
arrs[ii]=c;
}
ii++;
}
return Clazz_newByteArray(arrs);
};

/*
sp.compareTo=function(anotherString){
if(anotherString==null){
throw new java.lang.NullPointerException();
}
var len1=this.length;
var len2=anotherString.length;
var n=Math.min(len1,len2);
var k=0;
while(k<n){
var c1=this.charCodeAt(k);
var c2=anotherString.charCodeAt(k);
if(c1!=c2){
return c1-c2;
}
k++;
}
return len1-len2;
};

*/

sp.contains = function(a) {return this.indexOf(a) >= 0}  // bh added
sp.compareTo = function(a){return this > a ? 1 : this < a ? -1 : 0} // bh added



sp.toCharArray=function(){
var result=new Array(this.length);
for(var i=0;i<this.length;i++){
result[i]=this.charAt(i);
}
return result;
};
String.value0f=String.valueOf;
String.valueOf=function(o){
if(o=="undefined"){
return String.value0f();
}
if(o instanceof Array){
if(arguments.length==1){
return o.join('');
}else{
var off=arguments[1];
var len=arguments[2];
var oo=new Array(len);
for(var i=0;i<len;i++){
oo[i]=o[off+i];
}
return oo.join('');
}
}
return""+o;
};

sp.subSequence=function(beginIndex,endIndex){
return this.substring(beginIndex,endIndex);
};

sp.compareToIgnoreCase=function(str){
if(str==null){
throw new NullPointerException();
}
var s1=this.toUpperCase();
var s2=str.toUpperCase();
if(s1==s2){
return 0;
}else{
var s1=this.toLowerCase();
var s2=str.toLowerCase();
if(s1==s2){
return 0;
}else if(s1>s2){
return 1;
}else{
return-1;
}
}
};

sp.contentEquals=function(sb){
if(this.length!=sb.length()){
return false;
}
var v=sb.getValue();
var i=0;
var j=0;
var n=this.length;
while(n--!=0){
if(this.charCodeAt(i++)!=v[j++]){
return false;
}
}
return true;
};

sp.getChars=function(srcBegin,srcEnd,dst,dstBegin){
if(srcBegin<0){
throw new StringIndexOutOfBoundsException(srcBegin);
}
if(srcEnd>this.length){
throw new StringIndexOutOfBoundsException(srcEnd);
}
if(srcBegin>srcEnd){
throw new StringIndexOutOfBoundsException(srcEnd-srcBegin);
}
if(dst==null){
throw new NullPointerException();
}
for(var i=0;i<srcEnd-srcBegin;i++){
dst[dstBegin+i]=this.charAt(srcBegin+i);
}
};
//sp.$concat=sp.concat;
//sp.concat=function(s){
//if(s==null){
//throw new NullPointerException();
//}
//return this.$concat(s);
//};

sp.$lastIndexOf=sp.lastIndexOf;
sp.lastIndexOf=function(s,last){
if(last!=null&&last+this.length<=0){
return-1;
}
if(last!=null){
return this.$lastIndexOf(s,last);
}else{
return this.$lastIndexOf(s);
}
};

sp.intern=function(){
return this.valueOf();
};
String.copyValueOf=sp.copyValueOf=function(){
if(arguments.length==1){
return String.instantialize(arguments[0]);
}else{
return String.instantialize(arguments[0],arguments[1],arguments[2]);
}
};

sp.codePointAt || (sp.codePointAt = sp.charCodeAt); // Firefox only


})(String.prototype);

var textDecoder = new TextDecoder();

String.instantialize=function(){
switch (arguments.length) {
case 0:
	return new String();
case 1:
	var x=arguments[0];
  if (x.BYTES_PER_ELEMENT) {
		return (x.length == 0 ? "" : typeof x[0]=="number" ? textDecoder.decode(x) : x.join(''));
  }
  if (x instanceof Array){
		return (x.length == 0 ? "" : typeof x[0]=="number" ? textDecoder.decode(new Uint8Array(x)) : x.join(''));
  }
	if(typeof x=="string"||x instanceof String){
		return new String(x);
	}
//	if(x.__CLASS_NAME__=="StringBuffer"||x.__CLASS_NAME__=="java.lang.StringBuffer"){
//		var value=x.shareValue();
//		var length=x.length();
//		var valueCopy=new Array(length);
//		for(var i=0;i<length;i++){
//			valueCopy[i]=value[i];
//		}
//		return valueCopy.join('')
//	}
	return""+x;
case 2:	
	var x=arguments[0];
	var hibyte=arguments[1];
	if(typeof hibyte=="string"){
		return String.instantialize(x,0,x.length,hibyte);
	}
	return String.instantialize(x,hibyte,0,x.length);
case 3:
	var bytes=arguments[0];
	var offset=arguments[1];
	var length=arguments[2];
	if(arguments[2]instanceof Array){
		bytes=arguments[2];
		offset=arguments[0];
		length=arguments[1];
	}
	var arr=new Array(length);
	if(offset<0||length+offset>bytes.length){
		throw new IndexOutOfBoundsException();
	}
	if(length>0){
		var isChar=(bytes[offset].length!=null);
		if(isChar){
			for(var i=0;i<length;i++){
				arr[i]=bytes[offset+i];
			}
		}else{
			for(var i=0;i<length;i++){
				arr[i]=String.fromCharCode(bytes[offset+i]);
			}
		}
	}
	return arr.join('');
case 4:
	var bytes=arguments[0];
	var y=arguments[3];
	if(typeof y=="string"||y instanceof String){
		var offset=arguments[1];
		var length=arguments[2];
		var arr=new Uint8Array(length);
		for(var i=0;i<length;i++){
			arr[i]=bytes[offset+i];
		}
		return textDecoder.decode(arr);
		//return Encoding.readUTF8Array(arr);
	}
	var count=arguments[3];
	var offset=arguments[2];
	var hibyte=arguments[1];
	var value=new Array(count);
	if(hibyte==0){
		for(var i=count;i-->0;){
			value[i]=String.fromCharCode(bytes[i+offset]&0xff);
		}
	}else{
		hibyte<<=8;
		for(var i=count;i-->0;){
			value[i]=String.fromCharCode(hibyte|(bytes[i+offset]&0xff));
		}
	}
	return value.join('');
default:
	var s="";
	for(var i=0;i<arguments.length;i++){
		s+=arguments[i];
	}
	return s;
}
};

if(navigator.userAgent.toLowerCase().indexOf("chrome")!=-1){
	String.prototype.toString=function(){return this.valueOf();};
}

}

})(Clazz._Encoding);

var c$;

c$=Clazz_decorateAsClass(function(){
this.value=0;
Clazz_instantialize(this,arguments);
},java.lang,"Character",null,[java.io.Serializable,Comparable]);
Clazz_makeConstructor(c$,
function(value){
this.value=value;
},"~N");
Clazz_defineMethod(c$,"charValue",
function(){
return this.value;
});
Clazz_overrideMethod(c$,"hashCode",
function(){
return(this.value).charCodeAt(0);
});
Clazz_overrideMethod(c$,"equals",
function(obj){
if(Clazz_instanceOf(obj,Character)){
return(this.value).charCodeAt(0)==((obj).charValue()).charCodeAt(0);
}return false;
},"~O");
Clazz_overrideMethod(c$,"compareTo",
function(c){
return(this.value).charCodeAt(0)-(c.value).charCodeAt(0);
},"Character");
c$.toLowerCase=Clazz_defineMethod(c$,"toLowerCase",
function(c){
return(""+c).toLowerCase().charAt(0);
},"~N");
c$.toUpperCase=Clazz_defineMethod(c$,"toUpperCase",
function(c){
return(""+c).toUpperCase().charAt(0);
},"~N");
c$.isDigit=Clazz_defineMethod(c$,"isDigit",
function(c){
c = c.charCodeAt(0);
return (48 <= c && c <= 57);
},"~N");
c$.isUpperCase=Clazz_defineMethod(c$,"isUpperCase",
function(c){
c = c.charCodeAt(0);
return (65 <= c && c <= 90);
},"~N");
c$.isLowerCase=Clazz_defineMethod(c$,"isLowerCase",
function(c){
c = c.charCodeAt(0);
return (97 <= c && c <= 122);
},"~N");
c$.isWhitespace=Clazz_defineMethod(c$,"isWhitespace",
function(c){
c = (c).charCodeAt(0);
return (c >= 0x1c && c <= 0x20 || c >= 0x9 && c <= 0xd || c == 0x1680
	|| c >= 0x2000 && c != 0x2007 && (c <= 0x200b || c == 0x2028 || c == 0x2029 || c == 0x3000));
},"~N");
c$.isLetter=Clazz_defineMethod(c$,"isLetter",
function(c){
c = c.charCodeAt(0);
return (65 <= c && c <= 90 || 97 <= c && c <= 122);
},"~N");
c$.isLetterOrDigit=Clazz_defineMethod(c$,"isLetterOrDigit",
function(c){
c = c.charCodeAt(0);
return (65 <= c && c <= 90 || 97 <= c && c <= 122 || 48 <= c && c <= 57);
},"~N");
c$.isSpaceChar=Clazz_defineMethod(c$,"isSpaceChar",
function(c){
 var i = c.charCodeAt(0);
if(i==0x20||i==0xa0||i==0x1680)return true;
if(i<0x2000)return false;
return i<=0x200b||i==0x2028||i==0x2029||i==0x202f||i==0x3000;
},"~N");
c$.digit=Clazz_defineMethod(c$,"digit",
function(c,radix){
var i = c.charCodeAt(0);
if(radix >= 2 && radix <= 36){
	if(i < 128){
		var result = -1;
		if(48 <= i && i <= 57){
		result = i - 48;
		}else if(97 <= i && i <= 122){
		result = i - 87;
		}else if(65 <= i && i <= 90){
		result=i-(55);
		}
		return (result < radix ? result : -1);
	}
}
return -1;
},"~N,~N");
Clazz_overrideMethod(c$,"toString",
function(){
var buf=[this.value];
return String.valueOf(buf);
});
c$.toString=Clazz_overrideMethod(c$,"toString",
function(c){
{
if(this===Character){
return"class java.lang.Character";
}
}return String.valueOf(c);
},"~N");
c$.TYPE=c$;



Clazz._ArrayWrapper = function(a, type) {
 return {
   a: a,
   __CLASS_NAME__:"Array",
   superClazz: Array,
   getComponentType: function() {return type},
   instanceOf: function(o) { return  Clazz_instanceOf(type, o) },
   getName: function() { return this.__CLASS_NAME__ }
 };
}
c$=Clazz_declareType(java.lang.reflect,"Array");
c$.newInstance=Clazz_defineMethod(c$,"newInstance",
function(componentType,size){
var a = Clazz_newArray(size);
 a.getClass = function() { return new Clazz._ArrayWrapper(this, componentType);};
return a;
},"Class,~N");

c$.getLength = function(o){return o.length};
c$.get = function(o, i){return o[i]};

javautil.Date=Date;
Date.TYPE="javautil.Date";
Date.__CLASS_NAME__="Date";
Clazz._setDeclared("java.util.Date", Date);
Clazz._setDeclared("Date", Date);
Clazz_implementOf(Date,[java.io.Serializable,java.lang.Comparable]);
Clazz_defineMethod(javautil.Date,"clone",
function(){
return new Date(this.getTime());
});

Clazz_defineMethod(javautil.Date,"before",
function(when){
return this.getTime()<when.getTime();
},"javautil.Date");
Clazz_defineMethod(javautil.Date,"after",
function(when){
return this.getTime()>when.getTime();
},"javautil.Date");
Clazz_defineMethod(javautil.Date,"equals",
function(obj){
return Clazz_instanceOf(obj,javautil.Date)&&this.getTime()==(obj).getTime();
},"Object");
Clazz_defineMethod(javautil.Date,"compareTo",
function(anotherDate){
if (anotherDate == null)return 1;
var thisTime=this.getTime();
var anotherTime=anotherDate.getTime();
return(thisTime<anotherTime?-1:(thisTime==anotherTime?0:1));
},"Object");
Clazz_overrideMethod(javautil.Date,"hashCode",
function(){
var ht=this.getTime();
return parseInt(ht)^parseInt((ht>>32));
});

c$=Clazz_decorateAsClass(function(){
this.source=null;
Clazz_instantialize(this,arguments);
},javautil,"EventObject",null,java.io.Serializable);
Clazz_makeConstructor(c$,
function(source){
if(source!=null)this.source=source;
else throw new IllegalArgumentException();
},"~O");
Clazz_defineMethod(c$,"getSource",
function(){
return this.source;
});
Clazz_overrideMethod(c$,"toString",
function(){
return this.getClass().getName()+"[source="+String.valueOf(this.source)+']';
});
Clazz_declareInterface(javautil,"EventListener");

c$=Clazz_decorateAsClass(function(){
this.listener=null;
Clazz_instantialize(this,arguments);
},javautil,"EventListenerProxy",null,javautil.EventListener);
Clazz_makeConstructor(c$,
function(listener){
this.listener=listener;
},"javautil.EventListener");
Clazz_defineMethod(c$,"getListener",
function(){
return this.listener;
});
Clazz_declareInterface(javautil,"Iterator");

Clazz_declareInterface(javautil,"ListIterator",javautil.Iterator);
Clazz_declareInterface(javautil,"Enumeration");
Clazz_declareInterface(javautil,"Collection",Iterable);

Clazz_declareInterface(javautil,"Set",javautil.Collection);
Clazz_declareInterface(javautil,"Map");
Clazz_declareInterface(javautil.Map,"Entry");

Clazz_declareInterface(javautil,"List",javautil.Collection);

Clazz_declareInterface(javautil,"Queue",javautil.Collection);
Clazz_declareInterface(javautil,"RandomAccess");
c$=Clazz_decorateAsClass(function(){
this.detailMessage=null;
this.cause=null;
this.stackTrace=null;
Clazz_instantialize(this,arguments);
},java.lang,"Throwable",null,java.io.Serializable);
Clazz_prepareFields(c$,function(){
this.cause=this;
//alert("e0 "+ arguments.callee.caller.caller.caller.caller.caller)
});
Clazz_makeConstructor(c$,
function(){
this.fillInStackTrace();
});
Clazz_makeConstructor(c$,
function(message,cause){
this.fillInStackTrace();
if (!cause && typeof message == "object") {
	cause = message;
	message = cause.toString();
}
cause && (this.cause=cause);
this.detailMessage=message;
},"~S,Throwable");




Clazz_defineMethod(c$,"getMessage",
function(){
return (this.message || this.detailMessage || this.toString());
});
Clazz_defineMethod(c$,"getLocalizedMessage",
function(){
return this.getMessage();
});
Clazz_defineMethod(c$,"getCause",
function(){
return(this.cause===this?null:this.cause);
});
Clazz_defineMethod(c$,"initCause",
function(cause){
if(this.cause!==this)throw new IllegalStateException("Can't overwrite cause");
if(cause===this)throw new IllegalArgumentException("Self-causation not permitted");
this.cause=cause;
return this;
},"Throwable");
Clazz_overrideMethod(c$,"toString",
function(){
var s=this.getClass().getName();
var message=this.message || this.detailMessage;
return(message ? s+": "+message : s);
});
Clazz_defineMethod(c$,"printStackTrace",
function(){
System.err.println(this.getStackTrace ? this.getStackTrace() : this.message + " " + Clazz_getStackTrace());
});

Clazz_defineMethod(c$,"getStackTrace",
function(){
var s = "" + this + "\n";
for(var i=0;i<this.stackTrace.length;i++){
 var t=this.stackTrace[i];
	var x=t.methodName.indexOf("(");
	var n=t.methodName.substring(0,x).replace(/\s+/g,"");
	if(n!="construct"||t.nativeClazz==null
		 ||Clazz_getInheritedLevel(t.nativeClazz,Throwable)<0){
				s += t + "\n";
	}
}
return s;
});


Clazz_defineMethod(c$,"printStackTrace",
function(s){
this.printStackTrace();
},"java.io.PrintStream");
Clazz_defineMethod(c$,"printStackTrace",
function(s){
this.printStackTrace();
},"java.io.PrintWriter");
Clazz_defineMethod(c$,"fillInStackTrace",
function(){
this.stackTrace=new Array();
var caller=arguments.callee.caller;
var superCaller=null;
var callerList=new Array();
var index=Clazz._callingStackTraces.length-1;
var noLooping=true;
while(index>-1||caller!=null){
var clazzName=null;
var nativeClass=null;
if(!noLooping||caller==Clazz_tryToSearchAndExecute||caller==Clazz_superCall||caller==null){
if(index<0){
break;
}
noLooping=true;
superCaller=Clazz._callingStackTraces[index].caller;
nativeClass=Clazz._callingStackTraces[index].owner;
index--;
}else{
superCaller=caller;
if(superCaller.claxxOwner!=null){
nativeClass=superCaller.claxxOwner;
}else if(superCaller.exClazz!=null){
nativeClass=superCaller.exClazz;
}
}
var st=new StackTraceElement(
((nativeClass!=null&&nativeClass.__CLASS_NAME__.length!=0)?
nativeClass.__CLASS_NAME__:"anonymous"),
((superCaller.exName==null)?"anonymous":superCaller.exName)
+" ("+Clazz_getParamsType(superCaller.arguments)+")",
null,-1);
st.nativeClazz=nativeClass;
this.stackTrace[this.stackTrace.length]=st;
for(var i=0;i<callerList.length;i++){
if(callerList[i]==superCaller){

var st=new StackTraceElement("lost","missing",null,-3);
st.nativeClazz=null;
this.stackTrace[this.stackTrace.length]=st;
noLooping=false;

}
}
if(superCaller!=null){
callerList[callerList.length]=superCaller;
}
caller=superCaller.arguments.callee.caller;
}
Clazz._initializingException=false;
return this;
});
Clazz_defineMethod(c$,"setStackTrace",
function(stackTrace){
var defensiveCopy=stackTrace.clone();
for(var i=0;i<defensiveCopy.length;i++)if(defensiveCopy[i]==null)throw new NullPointerException("stackTrace["+i+"]");

this.stackTrace=defensiveCopy;
},"~A");

c$=Clazz_decorateAsClass(function(){
this.declaringClass=null;
this.methodName=null;
this.fileName=null;
this.lineNumber=0;
Clazz_instantialize(this,arguments);
},java.lang,"StackTraceElement",null,java.io.Serializable);
Clazz_makeConstructor(c$,
function(cls,method,file,line){
if(cls==null||method==null){
throw new NullPointerException();
}this.declaringClass=cls;
this.methodName=method;
this.fileName=file;
this.lineNumber=line;
},"~S,~S,~S,~N");
Clazz_overrideMethod(c$,"equals",
function(obj){
if(!(Clazz_instanceOf(obj,StackTraceElement))){
return false;
}var castObj=obj;
if((this.methodName==null)||(castObj.methodName==null)){
return false;
}if(!this.getMethodName().equals(castObj.getMethodName())){
return false;
}if(!this.getClassName().equals(castObj.getClassName())){
return false;
}var localFileName=this.getFileName();
if(localFileName==null){
if(castObj.getFileName()!=null){
return false;
}}else{
if(!localFileName.equals(castObj.getFileName())){
return false;
}}if(this.getLineNumber()!=castObj.getLineNumber()){
return false;
}return true;
},"~O");
Clazz_defineMethod(c$,"getClassName",
function(){
return(this.declaringClass==null)?"<unknown class>":this.declaringClass;
});
Clazz_defineMethod(c$,"getFileName",
function(){
return this.fileName;
});
Clazz_defineMethod(c$,"getLineNumber",
function(){
return this.lineNumber;
});
Clazz_defineMethod(c$,"getMethodName",
function(){
return(this.methodName==null)?"<unknown method>":this.methodName;
});
Clazz_overrideMethod(c$,"hashCode",
function(){
if(this.methodName==null){
return 0;
}return this.methodName.hashCode()^this.declaringClass.hashCode();
});
Clazz_defineMethod(c$,"isNativeMethod",
function(){
return this.lineNumber==-2;
});
Clazz_overrideMethod(c$,"toString",
function(){
var buf = this.getClassName() + "." + this.getMethodName();
if(this.isNativeMethod()){
buf += ("(Native Method)");
}else{
var fName=this.getFileName();
if(fName==null){
buf += ("(Unknown Source)");
}else{
var lineNum=this.getLineNumber();
buf += ('(');
buf += (fName);
if(lineNum>=0){
buf += (':');
buf = buf + lineNum;
}buf += (')');
}}return buf;
});
TypeError.prototype.getMessage || (TypeError.prototype.getMessage = function(){ return (this.message || this.toString()) + (this.getStackTrace ? this.getStackTrace() : Clazz_getStackTrace())});


Clazz_Error = Error;

Clazz_declareTypeError = function (prefix, name, clazzParent, interfacez, 
		parentClazzInstance, _declareType) {
	var f = function () {
		Clazz_instantialize (this, arguments);
    return Clazz_Error();
	};
	return Clazz_decorateAsClass (f, prefix, name, clazzParent, interfacez, 
			parentClazzInstance);
};

// at least allow Error() by itself to work as before
Clazz._Error || (Clazz._Error = Error);
Clazz_decorateAsClass (function (){Clazz_instantialize(this, arguments);return Clazz._Error();}, java.lang, "Error", Throwable);

//c$=Clazz_declareTypeError(java.lang,"Error",Throwable);


c$=Clazz_declareType(java.lang,"LinkageError",Error);

c$=Clazz_declareType(java.lang,"IncompatibleClassChangeError",LinkageError);

c$=Clazz_declareType(java.lang,"AbstractMethodError",IncompatibleClassChangeError);

c$=Clazz_declareType(java.lang,"AssertionError",Error);
Clazz_makeConstructor(c$,
function(detailMessage){
Clazz_superConstructor(this,AssertionError,["" + detailMessage,(Clazz_instanceOf(detailMessage,Throwable)?detailMessage:null)]);
},"~O");

c$=Clazz_declareType(java.lang,"ClassCircularityError",LinkageError);

c$=Clazz_declareType(java.lang,"ClassFormatError",LinkageError);

c$=Clazz_decorateAsClass(function(){
this.exception=null;
Clazz_instantialize(this,arguments);
},java.lang,"ExceptionInInitializerError",LinkageError);
Clazz_makeConstructor(c$,
function(){
Clazz_superConstructor(this,ExceptionInInitializerError);
this.initCause(null);
});
Clazz_makeConstructor(c$,
function(detailMessage){
Clazz_superConstructor(this,ExceptionInInitializerError,[detailMessage]);
this.initCause(null);
},"~S");
Clazz_makeConstructor(c$,
function(exception){
Clazz_superConstructor(this,ExceptionInInitializerError);
this.exception=exception;
this.initCause(exception);
},"Throwable");
Clazz_defineMethod(c$,"getException",
function(){
return this.exception;
});
Clazz_overrideMethod(c$,"getCause",
function(){
return this.exception;
});

c$=Clazz_declareType(java.lang,"IllegalAccessError",IncompatibleClassChangeError);

c$=Clazz_declareType(java.lang,"InstantiationError",IncompatibleClassChangeError);

c$=Clazz_declareType(java.lang,"VirtualMachineError",Error);

c$=Clazz_declareType(java.lang,"InternalError",VirtualMachineError);

c$=Clazz_declareType(java.lang,"NoClassDefFoundError",LinkageError);

c$=Clazz_declareType(java.lang,"NoSuchFieldError",IncompatibleClassChangeError);

c$=Clazz_declareType(java.lang,"NoSuchMethodError",IncompatibleClassChangeError);

c$=Clazz_declareType(java.lang,"OutOfMemoryError",VirtualMachineError);

c$=Clazz_declareType(java.lang,"StackOverflowError",VirtualMachineError);

c$=Clazz_declareType(java.lang,"UnknownError",VirtualMachineError);

c$=Clazz_declareType(java.lang,"UnsatisfiedLinkError",LinkageError);

c$=Clazz_declareType(java.lang,"UnsupportedClassVersionError",ClassFormatError);

c$=Clazz_declareType(java.lang,"VerifyError",LinkageError);

c$=Clazz_declareType(java.lang,"ThreadDeath",Error);
Clazz_makeConstructor(c$,
function(){
Clazz_superConstructor(this,ThreadDeath,[]);
});

c$=Clazz_declareType(java.lang,"Exception",Throwable);

c$=Clazz_declareType(java.lang,"RuntimeException",Exception);

c$=Clazz_declareType(java.lang,"ArithmeticException",RuntimeException);

c$=Clazz_declareType(java.lang,"IndexOutOfBoundsException",RuntimeException);

c$=Clazz_declareType(java.lang,"ArrayIndexOutOfBoundsException",IndexOutOfBoundsException);
Clazz_makeConstructor(c$,
function(index){
Clazz_superConstructor(this,ArrayIndexOutOfBoundsException,["Array index out of range: "+index]);
},"~N");

c$=Clazz_declareType(java.lang,"ArrayStoreException",RuntimeException);

c$=Clazz_declareType(java.lang,"ClassCastException",RuntimeException);

c$=Clazz_decorateAsClass(function(){
this.ex=null;
Clazz_instantialize(this,arguments);
},java.lang,"ClassNotFoundException",Exception);
Clazz_makeConstructor(c$,
function(){
Clazz_superConstructor(this,ClassNotFoundException,[Clazz_castNullAs("Throwable")]);
});
Clazz_makeConstructor(c$,
function(detailMessage){
Clazz_superConstructor(this,ClassNotFoundException,[detailMessage,null]);
},"~S");
Clazz_makeConstructor(c$,
function(detailMessage,exception){
Clazz_superConstructor(this,ClassNotFoundException,[detailMessage]);
this.ex=exception;
},"~S,Throwable");
Clazz_defineMethod(c$,"getException",
function(){
return this.ex;
});
Clazz_overrideMethod(c$,"getCause",
function(){
return this.ex;
});

c$=Clazz_declareType(java.lang,"CloneNotSupportedException",Exception);

c$=Clazz_declareType(java.lang,"IllegalAccessException",Exception);

c$=Clazz_declareType(java.lang,"IllegalArgumentException",RuntimeException);
Clazz_makeConstructor(c$,
function(cause){
Clazz_superConstructor(this,IllegalArgumentException,[(cause==null?null:cause.toString()),cause]);
},"Throwable");

c$=Clazz_declareType(java.lang,"IllegalMonitorStateException",RuntimeException);

c$=Clazz_declareType(java.lang,"IllegalStateException",RuntimeException);
Clazz_makeConstructor(c$,
function(cause){
Clazz_superConstructor(this,IllegalStateException,[(cause==null?null:cause.toString()),cause]);
},"Throwable");

c$=Clazz_declareType(java.lang,"IllegalThreadStateException",IllegalArgumentException);

c$=Clazz_declareType(java.lang,"InstantiationException",Exception);

c$=Clazz_declareType(java.lang,"InterruptedException",Exception);

c$=Clazz_declareType(java.lang,"NegativeArraySizeException",RuntimeException);

c$=Clazz_declareType(java.lang,"NoSuchFieldException",Exception);

c$=Clazz_declareType(java.lang,"NoSuchMethodException",Exception);

c$=Clazz_declareType(java.lang,"NullPointerException",RuntimeException);

c$=Clazz_declareType(java.lang,"NumberFormatException",IllegalArgumentException);

c$=Clazz_declareType(java.lang,"SecurityException",RuntimeException);
Clazz_makeConstructor(c$,
function(cause){
Clazz_superConstructor(this,SecurityException,[(cause==null?null:cause.toString()),cause]);
},"Throwable");

c$=Clazz_declareType(java.lang,"StringIndexOutOfBoundsException",IndexOutOfBoundsException);
Clazz_makeConstructor(c$,
function(index){
Clazz_superConstructor(this,StringIndexOutOfBoundsException,["String index out of range: "+index]);
},"~N");

c$=Clazz_declareType(java.lang,"UnsupportedOperationException",RuntimeException);
Clazz_makeConstructor(c$,
function(){
Clazz_superConstructor(this,UnsupportedOperationException,[]);
});
Clazz_makeConstructor(c$,
function(cause){
Clazz_superConstructor(this,UnsupportedOperationException,[(cause==null?null:cause.toString()),cause]);
},"Throwable");

c$=Clazz_decorateAsClass(function(){
this.target=null;
Clazz_instantialize(this,arguments);
},java.lang.reflect,"InvocationTargetException",Exception);
Clazz_makeConstructor(c$,
function(){
Clazz_superConstructor(this,java.lang.reflect.InvocationTargetException,[Clazz_castNullAs("Throwable")]);
});
Clazz_makeConstructor(c$,
function(exception){
Clazz_superConstructor(this,java.lang.reflect.InvocationTargetException,[null,exception]);
this.target=exception;
},"Throwable");
Clazz_makeConstructor(c$,
function(exception,detailMessage){
Clazz_superConstructor(this,java.lang.reflect.InvocationTargetException,[detailMessage,exception]);
this.target=exception;
},"Throwable,~S");
Clazz_defineMethod(c$,"getTargetException",
function(){
return this.target;
});
Clazz_overrideMethod(c$,"getCause",
function(){
return this.target;
});

c$=Clazz_decorateAsClass(function(){
this.undeclaredThrowable=null;
Clazz_instantialize(this,arguments);
},java.lang.reflect,"UndeclaredThrowableException",RuntimeException);
Clazz_makeConstructor(c$,
function(exception){
Clazz_superConstructor(this,java.lang.reflect.UndeclaredThrowableException);
this.undeclaredThrowable=exception;
this.initCause(exception);
},"Throwable");
Clazz_makeConstructor(c$,
function(exception,detailMessage){
Clazz_superConstructor(this,java.lang.reflect.UndeclaredThrowableException,[detailMessage]);
this.undeclaredThrowable=exception;
this.initCause(exception);
},"Throwable,~S");
Clazz_defineMethod(c$,"getUndeclaredThrowable",
function(){
return this.undeclaredThrowable;
});
Clazz_overrideMethod(c$,"getCause",
function(){
return this.undeclaredThrowable;
});

c$=Clazz_declareType(java.io,"IOException",Exception);


c$=Clazz_declareType(java.io,"CharConversionException",java.io.IOException);

c$=Clazz_declareType(java.io,"EOFException",java.io.IOException);

c$=Clazz_declareType(java.io,"FileNotFoundException",java.io.IOException);

c$=Clazz_decorateAsClass(function(){
this.bytesTransferred=0;
Clazz_instantialize(this,arguments);
},java.io,"InterruptedIOException",java.io.IOException);

c$=Clazz_declareType(java.io,"SyncFailedException",java.io.IOException);

c$=Clazz_declareType(java.io,"UnsupportedEncodingException",java.io.IOException);

c$=Clazz_declareType(java.io,"UTFDataFormatException",java.io.IOException);

// ignore ObjectStream exceptions

Clazz_defineMethod(c$,"getMessage",
function(){
var msg=Clazz_superCall(this,java.io.WriteAbortedException,"getMessage",[]);
return (this.detail ? msg + "; "+this.detail.toString() : msg);
});
Clazz_overrideMethod(c$,"getCause",
function(){
return this.detail;
});

c$=Clazz_declareType(javautil,"ConcurrentModificationException",RuntimeException);
Clazz_makeConstructor(c$,
function(){
Clazz_superConstructor(this,javautil.ConcurrentModificationException,[]);
});

c$=Clazz_declareType(javautil,"EmptyStackException",RuntimeException);

c$=Clazz_decorateAsClass(function(){
this.className=null;
this.key=null;
Clazz_instantialize(this,arguments);
},javautil,"MissingResourceException",RuntimeException);
Clazz_makeConstructor(c$,
function(detailMessage,className,resourceName){
Clazz_superConstructor(this,javautil.MissingResourceException,[detailMessage]);
this.className=className;
this.key=resourceName;
},"~S,~S,~S");
Clazz_defineMethod(c$,"getClassName",
function(){
return this.className;
});
Clazz_defineMethod(c$,"getKey",
function(){
return this.key;
});

c$=Clazz_declareType(javautil,"NoSuchElementException",RuntimeException);

c$=Clazz_declareType(javautil,"TooManyListenersException",Exception);

c$=Clazz_declareType(java.lang,"Void");
c$.TYPE = c$;

Clazz_declareInterface(java.lang.reflect,"GenericDeclaration");
Clazz_declareInterface(java.lang.reflect,"AnnotatedElement");

c$=Clazz_declareType(java.lang.reflect,"AccessibleObject",null,java.lang.reflect.AnnotatedElement);
Clazz_makeConstructor(c$,
function(){
});
Clazz_defineMethod(c$,"isAccessible",
function(){
return false;
});
c$.setAccessible=Clazz_defineMethod(c$,"setAccessible",
function(objects,flag){
return;
},"~A,~B");
Clazz_defineMethod(c$,"setAccessible",
function(flag){
return;
},"~B");
Clazz_overrideMethod(c$,"isAnnotationPresent",
function(annotationType){
return false;
},"Class");
Clazz_overrideMethod(c$,"getDeclaredAnnotations",
function(){
return new Array(0);
});
Clazz_overrideMethod(c$,"getAnnotations",
function(){
return new Array(0);
});
Clazz_overrideMethod(c$,"getAnnotation",
function(annotationType){
return null;
},"Class");
c$.marshallArguments=Clazz_defineMethod(c$,"marshallArguments",
function(parameterTypes,args){
return null;
},"~A,~A");
Clazz_defineMethod(c$,"invokeV",
function(receiver,args){
return;
},"~O,~A");
Clazz_defineMethod(c$,"invokeL",
function(receiver,args){
return null;
},"~O,~A");
Clazz_defineMethod(c$,"invokeI",
function(receiver,args){
return 0;
},"~O,~A");
Clazz_defineMethod(c$,"invokeJ",
function(receiver,args){
return 0;
},"~O,~A");
Clazz_defineMethod(c$,"invokeF",
function(receiver,args){
return 0.0;
},"~O,~A");
Clazz_defineMethod(c$,"invokeD",
function(receiver,args){
return 0.0;
},"~O,~A");
c$.emptyArgs=c$.prototype.emptyArgs=new Array(0);
Clazz_declareInterface(java.lang.reflect,"InvocationHandler");
c$=Clazz_declareInterface(java.lang.reflect,"Member");
c$=Clazz_declareType(java.lang.reflect,"Modifier");

Clazz_makeConstructor(c$,
function(){
});
c$.isAbstract=Clazz_defineMethod(c$,"isAbstract",
function(modifiers){
return((modifiers&1024)!=0);
},"~N");
c$.isFinal=Clazz_defineMethod(c$,"isFinal",
function(modifiers){
return((modifiers&16)!=0);
},"~N");
c$.isInterface=Clazz_defineMethod(c$,"isInterface",
function(modifiers){
return((modifiers&512)!=0);
},"~N");
c$.isNative=Clazz_defineMethod(c$,"isNative",
function(modifiers){
return((modifiers&256)!=0);
},"~N");
c$.isPrivate=Clazz_defineMethod(c$,"isPrivate",
function(modifiers){
return((modifiers&2)!=0);
},"~N");
c$.isProtected=Clazz_defineMethod(c$,"isProtected",
function(modifiers){
return((modifiers&4)!=0);
},"~N");
c$.isPublic=Clazz_defineMethod(c$,"isPublic",
function(modifiers){
return((modifiers&1)!=0);
},"~N");
c$.isStatic=Clazz_defineMethod(c$,"isStatic",
function(modifiers){
return((modifiers&8)!=0);
},"~N");
c$.isStrict=Clazz_defineMethod(c$,"isStrict",
function(modifiers){
return((modifiers&2048)!=0);
},"~N");
c$.isSynchronized=Clazz_defineMethod(c$,"isSynchronized",
function(modifiers){
return((modifiers&32)!=0);
},"~N");
c$.isTransient=Clazz_defineMethod(c$,"isTransient",
function(modifiers){
return((modifiers&128)!=0);
},"~N");
c$.isVolatile=Clazz_defineMethod(c$,"isVolatile",
function(modifiers){
return((modifiers&64)!=0);
},"~N");
c$.toString=Clazz_defineMethod(c$,"toString",
function(modifiers){
var sb=new Array(0);
if(java.lang.reflect.Modifier.isPublic(modifiers))sb[sb.length]="public";
if(java.lang.reflect.Modifier.isProtected(modifiers))sb[sb.length]="protected";
if(java.lang.reflect.Modifier.isPrivate(modifiers))sb[sb.length]="private";
if(java.lang.reflect.Modifier.isAbstract(modifiers))sb[sb.length]="abstract";
if(java.lang.reflect.Modifier.isStatic(modifiers))sb[sb.length]="static";
if(java.lang.reflect.Modifier.isFinal(modifiers))sb[sb.length]="final";
if(java.lang.reflect.Modifier.isTransient(modifiers))sb[sb.length]="transient";
if(java.lang.reflect.Modifier.isVolatile(modifiers))sb[sb.length]="volatile";
if(java.lang.reflect.Modifier.isSynchronized(modifiers))sb[sb.length]="synchronized";
if(java.lang.reflect.Modifier.isNative(modifiers))sb[sb.length]="native";
if(java.lang.reflect.Modifier.isStrict(modifiers))sb[sb.length]="strictfp";
if(java.lang.reflect.Modifier.isInterface(modifiers))sb[sb.length]="interface";
if(sb.length>0){
return sb.join(" ");
}return"";
},"~N");

c$=Clazz_decorateAsClass(function(){
this.clazz=null;
this.parameterTypes=null;
this.exceptionTypes=null;
this.modifiers=0;
Clazz_instantialize(this,arguments);
},java.lang.reflect,"Constructor",java.lang.reflect.AccessibleObject,[java.lang.reflect.GenericDeclaration,java.lang.reflect.Member]);
Clazz_makeConstructor(c$,
function(declaringClass,parameterTypes,checkedExceptions,modifiers){
Clazz_superConstructor(this,java.lang.reflect.Constructor,[]);
this.clazz=declaringClass;
this.parameterTypes=parameterTypes;
this.exceptionTypes=checkedExceptions;
this.modifiers=modifiers;
},"Class,~A,~A,~N");
Clazz_overrideMethod(c$,"getTypeParameters",
function(){
return null;
});
Clazz_defineMethod(c$,"toGenericString",
function(){
return null;
});
Clazz_defineMethod(c$,"getGenericParameterTypes",
function(){
return null;
});
Clazz_defineMethod(c$,"getGenericExceptionTypes",
function(){
return null;
});
Clazz_defineMethod(c$,"getParameterAnnotations",
function(){
return null;
});
Clazz_defineMethod(c$,"isVarArgs",
function(){
return false;
});
Clazz_overrideMethod(c$,"isSynthetic",
function(){
return false;
});
Clazz_overrideMethod(c$,"equals",
function(object){
if(object!=null&&Clazz_instanceOf(object,java.lang.reflect.Constructor)){
var other=object;
if(this.getDeclaringClass()===other.getDeclaringClass()){
var params1=this.parameterTypes;
var params2=other.parameterTypes;
if(params1.length==params2.length){
for(var i=0;i<params1.length;i++){
if(params1[i]!==params2[i])return false;
}
return true;
}}}return false;
},"~O");
Clazz_overrideMethod(c$,"getDeclaringClass",
function(){
return this.clazz;
});
Clazz_defineMethod(c$,"getExceptionTypes",
function(){
return this.exceptionTypes;
});
Clazz_overrideMethod(c$,"getModifiers",
function(){
return this.modifiers;
});
Clazz_overrideMethod(c$,"getName",
function(){
return this.getDeclaringClass().getName();
});
Clazz_defineMethod(c$,"getParameterTypes",
function(){
return this.parameterTypes;
});
Clazz_overrideMethod(c$,"hashCode",
function(){
return this.getDeclaringClass().getName().hashCode();
});
Clazz_defineMethod(c$,"newInstance",
function(args){
var instance=new this.clazz(Clazz_inheritArgs);
Clazz_instantialize(instance,args);
return instance;
},"~A");
Clazz_overrideMethod(c$,"toString",
function(){
return null;
});

c$=Clazz_declareType(java.lang.reflect,"Field",java.lang.reflect.AccessibleObject,java.lang.reflect.Member);
Clazz_overrideMethod(c$,"isSynthetic",
function(){
return false;
});
Clazz_defineMethod(c$,"toGenericString",
function(){
return null;
});
Clazz_defineMethod(c$,"isEnumConstant",
function(){
return false;
});
Clazz_defineMethod(c$,"getGenericType",
function(){
return null;
});
Clazz_overrideMethod(c$,"equals",
function(object){
return false;
},"~O");
Clazz_overrideMethod(c$,"getDeclaringClass",
function(){
return null;
});
Clazz_overrideMethod(c$,"getName",
function(){
return null;
});
Clazz_defineMethod(c$,"getType",
function(){
return null;
});
Clazz_overrideMethod(c$,"hashCode",
function(){
return 0;
});
Clazz_overrideMethod(c$,"toString",
function(){
return null;
});

c$=Clazz_decorateAsClass(function(){
this.clazz=null;
this.name=null;
this.returnType=null;
this.parameterTypes=null;
this.exceptionTypes=null;
this.modifiers=0;
Clazz_instantialize(this,arguments);
},java.lang.reflect,"Method",java.lang.reflect.AccessibleObject,[java.lang.reflect.GenericDeclaration,java.lang.reflect.Member]);
Clazz_makeConstructor(c$,
function(declaringClass,name,parameterTypes,returnType,checkedExceptions,modifiers){
Clazz_superConstructor(this,java.lang.reflect.Method,[]);
this.clazz=declaringClass;
this.name=name;
this.parameterTypes=parameterTypes;
this.returnType=returnType;
this.exceptionTypes=checkedExceptions;
this.modifiers=modifiers;
},"Class,~S,~A,Class,~A,~N");
Clazz_overrideMethod(c$,"getTypeParameters",
function(){
return null;
});
Clazz_defineMethod(c$,"toGenericString",
function(){
return null;
});
Clazz_defineMethod(c$,"getGenericParameterTypes",
function(){
return null;
});
Clazz_defineMethod(c$,"getGenericExceptionTypes",
function(){
return null;
});
Clazz_defineMethod(c$,"getGenericReturnType",
function(){
return null;
});
Clazz_defineMethod(c$,"getParameterAnnotations",
function(){
return null;
});
Clazz_defineMethod(c$,"isVarArgs",
function(){
return false;
});
Clazz_defineMethod(c$,"isBridge",
function(){
return false;
});
Clazz_overrideMethod(c$,"isSynthetic",
function(){
return false;
});
Clazz_defineMethod(c$,"getDefaultValue",
function(){
return null;
});
Clazz_overrideMethod(c$,"equals",
function(object){
if(object!=null&&Clazz_instanceOf(object,java.lang.reflect.Method)){
var other=object;
if((this.getDeclaringClass()===other.getDeclaringClass())&&(this.getName()===other.getName())){
var params1=this.parameterTypes;
var params2=other.parameterTypes;
if(params1.length==params2.length){
for(var i=0;i<params1.length;i++){
if(params1[i]!==params2[i])return false;
}
return true;
}}}return false;
},"~O");
Clazz_overrideMethod(c$,"getDeclaringClass",
function(){
return this.clazz;
});
Clazz_defineMethod(c$,"getExceptionTypes",
function(){
return this.exceptionTypes;
});
Clazz_overrideMethod(c$,"getModifiers",
function(){
return this.modifiers;
});
Clazz_overrideMethod(c$,"getName",
function(){
return this.name;
});
Clazz_defineMethod(c$,"getParameterTypes",
function(){
return this.parameterTypes; 
});
Clazz_defineMethod(c$,"getReturnType",
function(){
return this.returnType;
});
Clazz_overrideMethod(c$,"hashCode",
function(){
return this.getDeclaringClass().getName().hashCode()^this.getName().hashCode();
});
Clazz_defineMethod(c$,"invoke",
function(receiver,args){
var m=this.clazz.prototype[this.getName()];
if(m==null){
m=this.clazz[this.getName()];
}
if(m!=null){
m.apply(receiver,args);
}else{

}
},"~O,~A");
Clazz_overrideMethod(c$,"toString",
function(){
return null;
});

})(Clazz);
;(function() {

if (Jmol._debugCode)return;

Clazz_declarePackage("J.adapter.readers.more");
Clazz_load(["J.adapter.readers.molxyz.MolReader", "J.api.JmolJDXMOLReader", "JU.Lst"], "J.adapter.readers.more.JcampdxReader", ["JU.BS", "$.PT", "$.Rdr", "J.adapter.smarter.SmarterJmolAdapter", "J.jsv.JDXMOLParser", "JU.Logger"], function(){
var c$ = Clazz_decorateAsClass(function(){
this.selectedModel = 0;
this.mpr = null;
this.acdMolFile = null;
this.nPeaks = 0;
this.acdAssignments = null;
this.title = null;
this.nucleus = "";
this.type = null;
this.firstModel = null;
this.doStartJSV = false;
this.peakData = null;
this.allTypes = null;
Clazz_instantialize(this, arguments);}, J.adapter.readers.more, "JcampdxReader", J.adapter.readers.molxyz.MolReader, J.api.JmolJDXMOLReader);
Clazz_prepareFields (c$, function(){
this.peakData =  new JU.Lst();
});
Clazz_overrideMethod(c$, "initializeReader", 
function(){
this.vwr.setBooleanProperty("_JSV", true);
if (this.isTrajectory) {
JU.Logger.warn("TRAJECTORY keyword ignored");
this.isTrajectory = false;
}if (this.reverseModels) {
JU.Logger.warn("REVERSE keyword ignored");
this.reverseModels = false;
}this.selectedModel = this.desiredModelNumber;
this.desiredModelNumber = -2147483648;
this.doStartJSV = !this.checkFilterKey("NOSYNC");
});
Clazz_overrideMethod(c$, "checkLine", 
function(){
var i = this.line.indexOf("=");
if (i < 0 || !this.line.startsWith("##")) return true;
var label = JU.PT.replaceAllCharacters(this.line.substring(0, i).trim(), " ", "").toUpperCase();
if (label.length > 12) label = label.substring(0, 12);
var pt = ("##$MODELS   ##$PEAKS    ##$SIGNALS  ##$MOLFILE  ##NPOINTS   ##TITLE     ##PEAKASSIGN##$UVIR_ASSI##$MS_FRAGME##.OBSERVENU##DATATYPE  ").indexOf(label);
if (pt < 0) return true;
if (this.mpr == null) {
this.mpr =  new J.jsv.JDXMOLParser().set(this, this.filePath, this.htParams);
}var value = this.line.substring(i + 1).trim();
this.mpr.setLine(value);
switch (pt) {
case 0:
this.mpr.readModels();
break;
case 12:
case 24:
this.mpr.readPeaks(pt == 24, -1);
var model = this.mpr.getFirstModelWithPeaks();
if (model != null && this.firstModel == null) {
this.firstModel = model;
}break;
case 36:
this.acdMolFile = this.mpr.readACDMolFile();
this.processModelData(this.acdMolFile, this.title + " (assigned)", "MOL", "mol", "", 0.01, NaN, true);
if (this.asc.errorMessage != null) {
this.continuing = false;
return false;
}break;
case 48:
this.nPeaks = JU.PT.parseInt(value);
break;
case 60:
this.title = JU.PT.split(value, "$$")[0].trim();
break;
case 72:
case 84:
case 96:
this.acdAssignments =  new JU.Lst();
return this.mpr.readACDAssignments(this.nPeaks, pt == 72, this.acdAssignments);
case 108:
this.nucleus = value.substring(1);
break;
case 120:
this.type = value;
if ((pt = this.type.indexOf(" ")) >= 0) this.type = this.type.substring(0, pt);
break;
}
return true;
});
Clazz_overrideMethod(c$, "finalizeSubclassReader", 
function(){
if (this.mpr != null) this.processPeakData();
this.finalizeReaderMR();
});
Clazz_overrideMethod(c$, "processModelData", 
function(data, id, type, base, last, modelScale, vibScale, isFirst){
var model0 = this.asc.iSet;
var model = null;
var haveScaling = !Float.isNaN(modelScale);
while (true) {
var ret = J.adapter.smarter.SmarterJmolAdapter.staticGetAtomSetCollectionReader(this.filePath, type, JU.Rdr.getBR(data), this.htParams);
if ((typeof(ret)=='string')) {
JU.Logger.warn("" + ret);
if ((ret).startsWith("File reader was not found:")) this.asc.errorMessage = ret;
break;
}ret = J.adapter.smarter.SmarterJmolAdapter.staticGetAtomSetCollection(ret);
if ((typeof(ret)=='string')) {
JU.Logger.warn("" + ret);
break;
}model = ret;
var baseModel = base;
if (baseModel.length == 0) baseModel = last;
if (baseModel.length != 0) {
var ibase = this.findModelById(baseModel);
if (ibase >= 0) {
this.asc.setModelInfoForSet("jdxModelID", baseModel, ibase);
for (var i = model.atomSetCount; --i >= 0; ) model.setModelInfoForSet("jdxBaseModel", baseModel, i);

if (model.bondCount == 0) this.setBonding(model, ibase);
}}if (!Float.isNaN(vibScale)) {
JU.Logger.info("JcampdxReader applying vibration scaling of " + vibScale + " to " + model.ac + " atoms");
var atoms = model.atoms;
for (var i = model.ac; --i >= 0; ) {
if (atoms[i].vib != null && !Float.isNaN(atoms[i].vib.z)) atoms[i].vib.scale(vibScale);
}
}if (haveScaling) {
if (model.bondCount > 0) {
var b = model.bonds[0];
var d = model.atoms[b.atomIndex1].distance(model.atoms[b.atomIndex2]);
if (d > 0.5) {
haveScaling = false;
}}}if (haveScaling) {
JU.Logger.info("JcampdxReader applying model scaling of " + modelScale + " to " + model.ac + " atoms");
var atoms = model.atoms;
for (var i = model.ac; --i >= 0; ) atoms[i].scale(modelScale);

}JU.Logger.info("jdx model=" + id + " type=" + model.fileTypeName);
this.asc.appendAtomSetCollection(-1, model);
break;
}
this.updateModelIDs(id, model0, isFirst);
}, "~S,~S,~S,~S,~S,~N,~N,~B");
Clazz_defineMethod(c$, "setBonding", 
function(a, ibase){
var n0 = this.asc.getAtomSetAtomCount(ibase);
var n = a.ac;
if (n % n0 != 0) {
JU.Logger.warn("atom count in secondary model (" + n + ") is not a multiple of " + n0 + " -- bonding ignored");
return;
}var bonds = this.asc.bonds;
var b0 = 0;
for (var i = 0; i < ibase; i++) b0 += this.asc.getAtomSetBondCount(i);

var b1 = b0 + this.asc.getAtomSetBondCount(ibase);
var ii0 = this.asc.getAtomSetAtomIndex(ibase);
var nModels = a.atomSetCount;
for (var j = 0; j < nModels; j++) {
var i0 = a.getAtomSetAtomIndex(j) - ii0;
if (a.getAtomSetAtomCount(j) != n0) {
JU.Logger.warn("atom set atom count in secondary model (" + a.getAtomSetAtomCount(j) + ") is not equal to " + n0 + " -- bonding ignored");
return;
}for (var i = b0; i < b1; i++) a.addNewBondWithOrder(bonds[i].atomIndex1 + i0, bonds[i].atomIndex2 + i0, bonds[i].order);

}
}, "J.adapter.smarter.AtomSetCollection,~N");
Clazz_defineMethod(c$, "updateModelIDs", 
function(id, model0, isFirst){
var n = this.asc.atomSetCount;
if (isFirst && n == model0 + 2) {
this.asc.setCurrentModelInfo("modelID", id);
return;
}for (var pt = 0, i = model0; ++i < n; ) this.asc.setModelInfoForSet("modelID", id + "." + (++pt), i);

}, "~S,~N,~B");
Clazz_overrideMethod(c$, "addPeakData", 
function(info){
this.peakData.addLast(info);
}, "~S");
Clazz_defineMethod(c$, "processPeakData", 
function(){
if (this.acdAssignments != null) {
try {
this.mpr.setACDAssignments(this.title, this.nucleus + this.type, 0, this.acdAssignments, this.acdMolFile);
} catch (e) {
if (Clazz_exceptionOf(e, Exception)){
} else {
throw e;
}
}
}var n = this.peakData.size();
if (n == 0) return;
var bsModels =  new JU.BS();
var havePeaks = (n > 0);
for (var p = 0; p < n; p++) {
this.line = this.peakData.get(p);
var type = this.mpr.getAttribute(this.line, "type");
var id = this.mpr.getAttribute(this.line, "model");
var i = this.findModelById(id);
if (i < 0) {
JU.Logger.warn("cannot find model " + id + " required for " + this.line);
continue;
}this.addType(i, type);
var title = type + ": " + this.mpr.getAttribute(this.line, "title");
var key = "jdxAtomSelect" + "_" + this.mpr.getAttribute(this.line, "type");
bsModels.set(i);
var s;
if (this.mpr.getAttribute(this.line, "atoms").length != 0) {
this.processPeakSelectModel(i, title);
this.processPeakSelectAtom(i, key, this.line);
s = type + ": ";
} else if (this.processPeakSelectModel(i, title)) {
s = "model: ";
} else {
s = "ignored: ";
}JU.Logger.info(s + this.line);
}
n = this.asc.atomSetCount;
for (var i = n; --i >= 0; ) {
var id = this.asc.getAtomSetAuxiliaryInfoValue(i, "modelID");
if (havePeaks && !bsModels.get(i) && id.indexOf(".") >= 0) {
this.asc.removeAtomSet(i);
n--;
}}
if (false) {
var names = "";
for (var i = 0; i < n; i++) {
var key = ";" + this.asc.getAtomSetAuxiliaryInfoValue(i, "modelID") + ";";
if (names.indexOf(key) >= 0) {
this.asc.removeAtomSet(i);
i--;
n--;
} else {
names += key;
}}
}if (this.selectedModel == -2147483648) {
if (this.allTypes != null) this.appendLoadNote(this.allTypes);
} else {
if (this.selectedModel == 0) this.selectedModel = n - 1;
for (var i = this.asc.atomSetCount; --i >= 0; ) if (i + 1 != this.selectedModel) this.asc.removeAtomSet(i);

if (n > 0) this.appendLoadNote(this.asc.getAtomSetAuxiliaryInfoValue(0, "name"));
this.firstModel = this.asc.getAtomSetAuxiliaryInfoValue(0, "modelID");
}if (this.doStartJSV) {
this.addJmolScript("sync on;");
this.asc.setInfo("_startJSpecView", Boolean.TRUE);
if (this.firstModel != null) {
this.addJmolScript("sync > '" + "JSpecView:" + "';model " + JU.PT.esc(this.firstModel));
}}for (var i = this.asc.atomSetCount; --i >= 0; ) this.asc.setAtomSetNumber(i, i + 1);

this.asc.centralize();
});
Clazz_defineMethod(c$, "findModelById", 
function(modelID){
for (var i = this.asc.atomSetCount; --i >= 0; ) {
var id = this.asc.getAtomSetAuxiliaryInfoValue(i, "modelID");
if (modelID.equals(id)) return i;
}
return -1;
}, "~S");
Clazz_defineMethod(c$, "addType", 
function(imodel, type){
var types = this.addTypeStr(this.asc.getAtomSetAuxiliaryInfoValue(imodel, "spectrumTypes"), type);
if (types == null) return;
this.asc.setModelInfoForSet("spectrumTypes", types, imodel);
var s = this.addTypeStr(this.allTypes, type);
if (s != null) this.allTypes = s;
}, "~N,~S");
Clazz_defineMethod(c$, "addTypeStr", 
function(types, type){
if (types != null && types.contains(type)) return null;
if (types == null) types = "";
 else types += ",";
return types + type;
}, "~S,~S");
Clazz_defineMethod(c$, "processPeakSelectAtom", 
function(i, key, data){
var peaks = this.asc.getAtomSetAuxiliaryInfoValue(i, key);
if (peaks == null) this.asc.setModelInfoForSet(key, peaks =  new JU.Lst(), i);
peaks.addLast(data);
}, "~N,~S,~S");
Clazz_defineMethod(c$, "processPeakSelectModel", 
function(i, title){
if (this.asc.getAtomSetAuxiliaryInfoValue(i, "jdxModelSelect") != null) return false;
this.asc.setModelInfoForSet("name", title, i);
this.asc.setModelInfoForSet("jdxModelSelect", this.line, i);
return true;
}, "~N,~S");
Clazz_overrideMethod(c$, "setSpectrumPeaks", 
function(nH, piUnitsX, piUnitsY){
}, "~N,~S,~S");
});
;//5.0.1-v7 Mon Aug 24 10:01:38 CDT 2026
Clazz_declarePackage("J.api");
Clazz_declareInterface(J.api, "JmolJSpecView");
;//5.0.1-v7 Mon Aug 24 10:01:38 CDT 2026
Clazz_declarePackage("J.thread");
Clazz_load(["J.thread.JmolThread"], "J.thread.VibrationThread", null, function(){
var c$ = Clazz_decorateAsClass(function(){
this.transformManager = null;
Clazz_instantialize(this, arguments);}, J.thread, "VibrationThread", J.thread.JmolThread);
Clazz_overrideMethod(c$, "setManager", 
function(manager, vwr, options){
this.transformManager = manager;
this.setViewer(vwr, "VibrationThread");
return 0;
}, "~O,JV.Viewer,~O");
Clazz_overrideMethod(c$, "run1", 
function(mode){
var elapsed;
while (true) switch (mode) {
case -1:
this.lastRepaintTime = this.startTime = System.currentTimeMillis();
this.vwr.startHoverWatcher(false);
this.haveReference = true;
mode = 0;
break;
case 0:
elapsed = (System.currentTimeMillis() - this.lastRepaintTime);
this.sleepTime = 33 - elapsed;
if (!this.runSleep(this.sleepTime, 1)) return;
mode = 1;
break;
case 1:
this.lastRepaintTime = System.currentTimeMillis();
elapsed = (this.lastRepaintTime - this.startTime);
if (this.transformManager.vibrationPeriodMs == 0) {
mode = -2;
} else {
var t = (elapsed % this.transformManager.vibrationPeriodMs) / this.transformManager.vibrationPeriodMs;
this.transformManager.setVibrationT(t);
this.vwr.refresh(3, "VibrationThread");
mode = (this.checkInterrupted(this.transformManager.vibrationThread) ? -2 : 0);
}break;
case -2:
this.vwr.startHoverWatcher(true);
return;
}

}, "~N");
});
;//5.0.1-v7 Mon Aug 24 10:01:38 CDT 2026
(function(){
var c$ = Clazz_decorateAsClass(function(){
this.$name = null;
this.$ordinal = 0;
Clazz_instantialize(this, arguments);}, java.lang, "Enum", null, [Comparable, java.io.Serializable]);
Clazz_makeConstructor(c$, 
function(name, ordinal){
this.$name = name;
this.$ordinal = ordinal;
}, "~S,~N");
Clazz_defineMethod(c$, "name", 
function(){
return this.$name;
});
Clazz_defineMethod(c$, "ordinal", 
function(){
return this.$ordinal;
});
Clazz_overrideMethod(c$, "toString", 
function(){
return this.$name;
});
Clazz_overrideMethod(c$, "equals", 
function(other){
return this === other;
}, "~O");
Clazz_overrideMethod(c$, "clone", 
function(){
throw  new CloneNotSupportedException();
});
Clazz_overrideMethod(c$, "compareTo", 
function(o){
var other = o;
var self = this;
if (self.getClass() !== other.getClass() && self.getDeclaringClass() !== other.getDeclaringClass()) throw  new ClassCastException();
return self.$ordinal - other.$ordinal;
}, "~O");
Clazz_defineMethod(c$, "getDeclaringClass", 
function(){
var clazz = this.getClass();
var zuper = clazz.getSuperclass();
return ((zuper === Enum) ? clazz : zuper);
});
c$.$valueOf = Clazz_defineMethod(c$, "$valueOf", 
function(enumType, name){
var result = null;
{
result = enumType.$clazz$[name];
}if (result != null) return result;
if (name == null) throw  new NullPointerException("Name is null");
throw  new IllegalArgumentException("No enum const " + enumType + "." + name);
}, "Class,~S");
Clazz_overrideMethod(c$, "finalize", 
function(){
});
})();
;//5.0.1-v7 Fri Nov 21 04:39:22 CST 2025
Clazz_load(null, "java.lang.Thread", ["java.util.Date"], function(){
var c$ = Clazz_decorateAsClass(function(){
this.target = null;
this.group = null;
this.name = null;
this.priority = 0;
Clazz_instantialize(this, arguments);}, java.lang, "Thread", null, Runnable);
/*LV!1824 unnec constructor*/Clazz_makeConstructor(c$, 
function(target){
this.init(null, target, "Thread-" +  new java.util.Date().getTime() + Math.random(), 0);
}, "Runnable");
Clazz_makeConstructor(c$, 
function(group, target){
this.init(group, target, "Thread-" +  new java.util.Date().getTime() + Math.random(), 0);
}, "ThreadGroup,Runnable");
Clazz_makeConstructor(c$, 
function(name){
this.init(null, null, name, 0);
}, "~S");
Clazz_makeConstructor(c$, 
function(group, name){
this.init(group, null, name, 0);
}, "ThreadGroup,~S");
Clazz_makeConstructor(c$, 
function(target, name){
this.init(null, target, name, 0);
}, "Runnable,~S");
Clazz_makeConstructor(c$, 
function(group, target, name){
this.init(group, target, name, 0);
}, "ThreadGroup,Runnable,~S");
Clazz_makeConstructor(c$, 
function(group, target, name, stackSize){
this.init(group, target, name, stackSize);
}, "ThreadGroup,Runnable,~S,~N");
c$.currentThread = Clazz_defineMethod(c$, "currentThread", 
function(){
if (Thread.J2S_THREAD == null) {
Thread.J2S_THREAD =  new Thread();
}return Thread.J2S_THREAD;
});
c$.sleep = Clazz_defineMethod(c$, "sleep", 
function(millis){
alert ("Thread.sleep is not implemented in Java2Script!");
}, "~N");
Clazz_defineMethod(c$, "init", 
function(g, target, name, stackSize){
if (g == null) {
g =  new ThreadGroup();
}this.group = g;
this.target = target;
this.name = name;
this.priority = 5;
}, "ThreadGroup,Runnable,~S,~N");
Clazz_defineMethod(c$, "start", 
function(){
this.startT();
});
Clazz_defineMethod(c$, "startT", 
function(){
{
window.setTimeout ((function (runnable) {
return function () {
runnable.run ();
};
}) (this), 0);
}});
Clazz_defineMethod(c$, "run", 
function(){
if (this.target != null) {
this.target.run();
}});
Clazz_defineMethod(c$, "setPriority", 
function(newPriority){
if (newPriority > 10 || newPriority < 1) {
throw  new IllegalArgumentException();
}this.priority = newPriority;
}, "~N");
Clazz_defineMethod(c$, "getPriority", 
function(){
return this.priority;
});
Clazz_defineMethod(c$, "setName", 
function(name){
this.name = name;
}, "~S");
Clazz_defineMethod(c$, "getName", 
function(){
return String.valueOf(this.name);
});
Clazz_defineMethod(c$, "getThreadGroup", 
function(){
return this.group;
});
Clazz_overrideMethod(c$, "toString", 
function(){
var group = this.getThreadGroup();
if (group != null) {
return "Thread[" + this.getName() + "," + this.getPriority() + "," + group.getName() + "]";
} else {
return "Thread[" + this.getName() + "," + this.getPriority() + "," + "" + "]";
}});
c$.J2S_THREAD = null;
});
;//5.0.1-v7 Fri Nov 21 04:39:22 CST 2025
(function(){
var c$ = Clazz_decorateAsClass(function(){
this.parent = null;
this.name = null;
this.maxPriority = 0;
Clazz_instantialize(this, arguments);}, java.lang, "ThreadGroup", null);
Clazz_makeConstructor(c$, 
function(){
this.name = "system";
this.maxPriority = 10;
});
Clazz_makeConstructor(c$, 
function(name){
this.construct (Thread.currentThread().getThreadGroup(), name);
}, "~S");
Clazz_makeConstructor(c$, 
function(parent, name){
if (parent == null) {
throw  new NullPointerException();
}this.name = name;
this.parent = parent;
this.maxPriority = 10;
}, "ThreadGroup,~S");
Clazz_defineMethod(c$, "getName", 
function(){
return this.name;
});
Clazz_defineMethod(c$, "getParent", 
function(){
return this.parent;
});
Clazz_defineMethod(c$, "getMaxPriority", 
function(){
return this.maxPriority;
});
})();
;//5.0.1-v7 Fri Nov 21 04:39:22 CST 2025
Clazz_load(["java.io.FilterInputStream"], "java.io.BufferedInputStream", null, function(){
var c$ = Clazz_decorateAsClass(function(){
this.buf = null;
this.count = 0;
this.pos = 0;
this.markpos = -1;
this.marklimit = 0;
Clazz_instantialize(this, arguments);}, java.io, "BufferedInputStream", java.io.FilterInputStream);
Clazz_makeConstructor(c$, 
function($in){
Clazz_superConstructor(this, java.io.BufferedInputStream, [$in]);
this.buf =  Clazz_newByteArray (8192, 0);
}, "java.io.InputStream");
Clazz_defineMethod(c$, "getInIfOpen", 
function(){
var input = this.$in;
if (input == null) throw  new java.io.IOException("Stream closed");
return input;
});
Clazz_defineMethod(c$, "getBufIfOpen", 
function(){
var buffer = this.buf;
if (buffer == null) throw  new java.io.IOException("Stream closed");
return buffer;
});
Clazz_overrideMethod(c$, "resetStream", 
function(){
});
Clazz_defineMethod(c$, "fill", 
function(){
var buffer = this.getBufIfOpen();
if (this.markpos < 0) this.pos = 0;
 else if (this.pos >= buffer.length) if (this.markpos > 0) {
var sz = this.pos - this.markpos;
System.arraycopy(buffer, this.markpos, buffer, 0, sz);
this.pos = sz;
this.markpos = 0;
} else if (buffer.length >= this.marklimit) {
this.markpos = -1;
this.pos = 0;
} else {
var nsz = this.pos * 2;
if (nsz > this.marklimit) nsz = this.marklimit;
var nbuf =  Clazz_newByteArray (nsz, 0);
System.arraycopy(buffer, 0, nbuf, 0, this.pos);
buffer = this.buf = nbuf;
}this.count = this.pos;
var n = this.isRead(buffer, this.pos, buffer.length - this.pos);
if (n > 0) this.count = n + this.pos;
});
Clazz_overrideMethod(c$, "readByteAsInt", 
function(){
if (this.pos >= this.count) {
this.fill();
if (this.pos >= this.count) return -1;
}return this.getBufIfOpen()[this.pos++] & 0xff;
});
Clazz_defineMethod(c$, "read1", 
function(b, off, len){
var avail = this.count - this.pos;
if (avail <= 0) {
if (len >= this.getBufIfOpen().length && this.markpos < 0) {
return this.isRead(b, off, len);
}this.fill();
avail = this.count - this.pos;
if (avail <= 0) return -1;
}var cnt = (avail < len) ? avail : len;
System.arraycopy(this.getBufIfOpen(), this.pos, b, off, cnt);
this.pos += cnt;
return cnt;
}, "~A,~N,~N");
Clazz_defineMethod(c$, "isRead", 
function(b, off, len){
var is = this.getInIfOpen();
{
if (is.readBAIS) return is.readBAIS(b, off, len);
}return is.read(b, off, len);
}, "~A,~N,~N");
Clazz_overrideMethod(c$, "read", 
function(b, off, len){
return this.readBIS(b, off, len);
}, "~A,~N,~N");
Clazz_defineMethod(c$, "readBIS", 
function(b, off, len){
this.getBufIfOpen();
if ((off | len | (off + len) | (b.length - (off + len))) < 0) {
throw  new IndexOutOfBoundsException();
} else if (len == 0) {
return 0;
}var n = 0;
for (; ; ) {
var nread = this.read1(b, off + n, len - n);
if (nread <= 0) return (n == 0) ? nread : n;
n += nread;
if (n >= len) return n;
var input = this.$in;
if (input != null && input.available() <= 0) return n;
}
}, "~A,~N,~N");
Clazz_overrideMethod(c$, "skip", 
function(n){
this.getBufIfOpen();
if (n <= 0) {
return 0;
}var avail = this.count - this.pos;
if (avail <= 0) {
if (this.markpos < 0) return this.getInIfOpen().skip(n);
this.fill();
avail = this.count - this.pos;
if (avail <= 0) return 0;
}var skipped = (avail < n) ? avail : n;
this.pos += skipped;
return skipped;
}, "~N");
Clazz_overrideMethod(c$, "available", 
function(){
var n = this.count - this.pos;
var avail = this.getInIfOpen().available();
return n > (2147483647 - avail) ? 2147483647 : n + avail;
});
Clazz_overrideMethod(c$, "mark", 
function(readlimit){
this.marklimit = readlimit;
this.markpos = this.pos;
}, "~N");
Clazz_overrideMethod(c$, "reset", 
function(){
this.getBufIfOpen();
if (this.markpos < 0) throw  new java.io.IOException("Resetting to invalid mark");
this.pos = this.markpos;
});
Clazz_overrideMethod(c$, "markSupported", 
function(){
return true;
});
Clazz_overrideMethod(c$, "close", 
function(){
var input = this.$in;
this.$in = null;
if (input != null) input.close();
return;
});
});
;//5.0.1-v7 Fri Nov 21 04:39:22 CST 2025
Clazz_load(["java.io.Reader"], "java.io.BufferedReader", null, function(){
var c$ = Clazz_decorateAsClass(function(){
this.$in = null;
this.cb = null;
this.nChars = 0;
this.nextChar = 0;
this.markedChar = -1;
this.readAheadLimit = 0;
this.skipLF = false;
this.markedSkipLF = false;
Clazz_instantialize(this, arguments);}, java.io, "BufferedReader", java.io.Reader);
Clazz_makeConstructor(c$, 
function($in){
Clazz_superConstructor(this, java.io.BufferedReader, [$in]);
this.$in = $in;
this.setSize(8192);
}, "java.io.Reader");
Clazz_defineMethod(c$, "setSize", 
function(sz){
if (sz <= 0) throw  new IllegalArgumentException("Buffer size <= 0");
this.cb =  Clazz_newCharArray (sz, '\0');
this.nextChar = this.nChars = 0;
}, "~N");
Clazz_defineMethod(c$, "ensureOpen", 
function(){
if (this.$in == null) throw  new java.io.IOException("Stream closed");
});
Clazz_defineMethod(c$, "fill", 
function(){
var dst;
if (this.markedChar <= -1) {
dst = 0;
} else {
var delta = this.nextChar - this.markedChar;
if (delta >= this.readAheadLimit) {
this.markedChar = -2;
this.readAheadLimit = 0;
dst = 0;
} else {
if (this.readAheadLimit <= this.cb.length) {
System.arraycopy(this.cb, this.markedChar, this.cb, 0, delta);
this.markedChar = 0;
dst = delta;
} else {
var ncb =  Clazz_newCharArray (this.readAheadLimit, '\0');
System.arraycopy(this.cb, this.markedChar, ncb, 0, delta);
this.cb = ncb;
this.markedChar = 0;
dst = delta;
}this.nextChar = this.nChars = delta;
}}var n;
do {
n = this.$in.read(this.cb, dst, this.cb.length - dst);
} while (n == 0);
if (n > 0) {
this.nChars = dst + n;
this.nextChar = dst;
}});
Clazz_defineMethod(c$, "read1", 
function(cbuf, off, len){
if (this.nextChar >= this.nChars) {
if (len >= this.cb.length && this.markedChar <= -1 && !this.skipLF) {
return this.$in.read(cbuf, off, len);
}this.fill();
}if (this.nextChar >= this.nChars) return -1;
if (this.skipLF) {
this.skipLF = false;
if (this.cb[this.nextChar] == '\n') {
this.nextChar++;
if (this.nextChar >= this.nChars) this.fill();
if (this.nextChar >= this.nChars) return -1;
}}var n = Math.min(len, this.nChars - this.nextChar);
System.arraycopy(this.cb, this.nextChar, cbuf, off, n);
this.nextChar += n;
return n;
}, "~A,~N,~N");
Clazz_defineMethod(c$, "read", 
function(cbuf, off, len){
{
this.ensureOpen();
if ((off < 0) || (off > cbuf.length) || (len < 0) || ((off + len) > cbuf.length) || ((off + len) < 0)) {
throw  new IndexOutOfBoundsException();
} else if (len == 0) {
return 0;
}var n = this.read1(cbuf, off, len);
if (n <= 0) return n;
while ((n < len) && this.$in.ready()) {
var n1 = this.read1(cbuf, off + n, len - n);
if (n1 <= 0) break;
n += n1;
}
return n;
}}, "~A,~N,~N");
Clazz_defineMethod(c$, "readLine1", 
function(ignoreLF){
var s = null;
var startChar;
{
this.ensureOpen();
var omitLF = ignoreLF || this.skipLF;
for (; ; ) {
if (this.nextChar >= this.nChars) this.fill();
if (this.nextChar >= this.nChars) {
if (s != null && s.length > 0) return s.toString();
return null;
}var eol = false;
var c = String.fromCharCode(0);
var i;
if (omitLF && (this.cb[this.nextChar] == '\n')) this.nextChar++;
this.skipLF = false;
omitLF = false;
charLoop : for (i = this.nextChar; i < this.nChars; i++) {
c = this.cb[i];
if ((c == '\n') || (c == '\r')) {
eol = true;
break charLoop;
}}
startChar = this.nextChar;
this.nextChar = i;
var str =  String.instantialize(this.cb, startChar, i - startChar);
if (eol) {
if (s != null) {
s += str;
str = s;
}this.nextChar++;
if (c == '\r') {
this.skipLF = true;
}return str;
}if (s == null) s = "";
s += str;
}
}}, "~B");
Clazz_defineMethod(c$, "readLine", 
function(){
return this.readLine1(false);
});
Clazz_overrideMethod(c$, "skip", 
function(n){
if (n < 0) {
throw  new IllegalArgumentException("skip value is negative");
}{
this.ensureOpen();
var r = n;
while (r > 0) {
if (this.nextChar >= this.nChars) this.fill();
if (this.nextChar >= this.nChars) break;
if (this.skipLF) {
this.skipLF = false;
if (this.cb[this.nextChar] == '\n') {
this.nextChar++;
}}var d = this.nChars - this.nextChar;
if (r <= d) {
this.nextChar += r;
r = 0;
break;
}r -= d;
this.nextChar = this.nChars;
}
return n - r;
}}, "~N");
Clazz_defineMethod(c$, "ready", 
function(){
{
this.ensureOpen();
if (this.skipLF) {
if (this.nextChar >= this.nChars && this.$in.ready()) {
this.fill();
}if (this.nextChar < this.nChars) {
if (this.cb[this.nextChar] == '\n') this.nextChar++;
this.skipLF = false;
}}return (this.nextChar < this.nChars) || this.$in.ready();
}});
Clazz_overrideMethod(c$, "markSupported", 
function(){
return true;
});
Clazz_overrideMethod(c$, "mark", 
function(readAheadLimit){
if (readAheadLimit < 0) {
throw  new IllegalArgumentException("Read-ahead limit < 0");
}{
this.ensureOpen();
this.readAheadLimit = readAheadLimit;
this.markedChar = this.nextChar;
this.markedSkipLF = this.skipLF;
}}, "~N");
Clazz_overrideMethod(c$, "reset", 
function(){
{
this.ensureOpen();
if (this.markedChar < 0) throw  new java.io.IOException((this.markedChar == -2) ? "Mark invalid" : "Stream not marked");
this.nextChar = this.markedChar;
this.skipLF = this.markedSkipLF;
}});
Clazz_defineMethod(c$, "close", 
function(){
{
if (this.$in == null) return;
this.$in.close();
this.$in = null;
this.cb = null;
}});
});
;//5.0.1-v7 Fri Nov 21 04:39:22 CST 2025
Clazz_load(["java.io.Writer"], "java.io.BufferedWriter", null, function(){
var c$ = Clazz_decorateAsClass(function(){
this.out = null;
this.buf = null;
this.pos = 0;
this.lineSeparator = "\r\n";
Clazz_instantialize(this, arguments);}, java.io, "BufferedWriter", java.io.Writer);
Clazz_makeConstructor(c$, 
function(out){
Clazz_superConstructor(this, java.io.BufferedWriter, [out]);
this.out = out;
this.buf =  Clazz_newCharArray (8192, '\0');
}, "java.io.Writer");
Clazz_makeConstructor(c$, 
function(out, size){
Clazz_superConstructor(this, java.io.BufferedWriter, [out]);
if (size > 0) {
this.out = out;
this.buf =  Clazz_newCharArray (size, '\0');
} else {
throw  new IllegalArgumentException(("K0058"));
}}, "java.io.Writer,~N");
Clazz_defineMethod(c$, "close", 
function(){
{
if (this.isOpen()) {
this.flush();
this.out.close();
this.buf = null;
this.out = null;
}}});
Clazz_defineMethod(c$, "flush", 
function(){
{
if (this.isOpen()) {
if (this.pos > 0) {
this.out.write(this.buf, 0, this.pos);
}this.pos = 0;
this.out.flush();
} else {
throw  new java.io.IOException(("K005d"));
}}});
Clazz_defineMethod(c$, "isOpen", 
function(){
return this.out != null;
});
Clazz_defineMethod(c$, "newLine", 
function(){
this.write("\r\n", 0, "\r\n".length);
});
Clazz_defineMethod(c$, "write", 
function(cbuf, offset, count){
{
if (!this.isOpen()) {
throw  new java.io.IOException(("K005d"));
}if (offset < 0 || offset > cbuf.length - count || count < 0) {
throw  new IndexOutOfBoundsException();
}if (this.pos == 0 && count >= this.buf.length) {
this.out.write(cbuf, offset, count);
return;
}var available = this.buf.length - this.pos;
if (count < available) {
available = count;
}if (available > 0) {
System.arraycopy(cbuf, offset, this.buf, this.pos, available);
this.pos += available;
}if (this.pos == this.buf.length) {
this.out.write(this.buf, 0, this.buf.length);
this.pos = 0;
if (count > available) {
offset += available;
available = count - available;
if (available >= this.buf.length) {
this.out.write(cbuf, offset, available);
return;
}System.arraycopy(cbuf, offset, this.buf, this.pos, available);
this.pos += available;
}}}}, "~A,~N,~N");
Clazz_defineMethod(c$, "write", 
function(oneChar){
{
if (this.isOpen()) {
if (this.pos >= this.buf.length) {
this.out.write(this.buf, 0, this.buf.length);
this.pos = 0;
}this.buf[this.pos++] = String.fromCharCode(oneChar);
} else {
throw  new java.io.IOException(("K005d"));
}}}, "~N");
Clazz_defineMethod(c$, "write", 
function(str, offset, count){
{
if (!this.isOpen()) {
throw  new java.io.IOException(("K005d"));
}if (count <= 0) {
return;
}if (offset > str.length - count || offset < 0) {
throw  new StringIndexOutOfBoundsException();
}if (this.pos == 0 && count >= this.buf.length) {
var chars =  Clazz_newCharArray (count, '\0');
str.getChars(offset, offset + count, chars, 0);
this.out.write(chars, 0, count);
return;
}var available = this.buf.length - this.pos;
if (count < available) {
available = count;
}if (available > 0) {
str.getChars(offset, offset + available, this.buf, this.pos);
this.pos += available;
}if (this.pos == this.buf.length) {
this.out.write(this.buf, 0, this.buf.length);
this.pos = 0;
if (count > available) {
offset += available;
available = count - available;
if (available >= this.buf.length) {
var chars =  Clazz_newCharArray (count, '\0');
str.getChars(offset, offset + available, chars, 0);
this.out.write(chars, 0, available);
return;
}str.getChars(offset, offset + available, this.buf, this.pos);
this.pos += available;
}}}}, "~S,~N,~N");
});
;//5.0.1-v7 Fri Nov 21 04:39:22 CST 2025
Clazz_load(["java.io.InputStream"], "java.io.ByteArrayInputStream", null, function(){
var c$ = Clazz_decorateAsClass(function(){
this.buf = null;
this.pos = 0;
this.$mark = 0;
this.count = 0;
Clazz_instantialize(this, arguments);}, java.io, "ByteArrayInputStream", java.io.InputStream);
Clazz_makeConstructor(c$, 
function(buf){
Clazz_superConstructor (this, java.io.ByteArrayInputStream, []);
this.buf = buf;
this.pos = 0;
this.count = buf.length;
}, "~A");
Clazz_overrideMethod(c$, "readByteAsInt", 
function(){
return (this.pos < this.count) ? (this.buf[this.pos++] & 0xff) : -1;
});
Clazz_overrideMethod(c$, "read", 
function(b, off, len){
return this.readBAIS(b, off, len);
}, "~A,~N,~N");
Clazz_defineMethod(c$, "readBAIS", 
function(b, off, len){
if (b == null) {
throw  new NullPointerException();
} else if (off < 0 || len < 0 || len > b.length - off) {
throw  new IndexOutOfBoundsException();
}if (this.pos >= this.count) {
return -1;
}var avail = this.count - this.pos;
if (len > avail) {
len = avail;
}if (len <= 0) {
return 0;
}System.arraycopy(this.buf, this.pos, b, off, len);
this.pos += len;
return len;
}, "~A,~N,~N");
Clazz_overrideMethod(c$, "skip", 
function(n){
var k = this.count - this.pos;
if (n < k) {
k = n < 0 ? 0 : n;
}this.pos += k;
return k;
}, "~N");
Clazz_overrideMethod(c$, "available", 
function(){
return this.count - this.pos;
});
Clazz_overrideMethod(c$, "markSupported", 
function(){
return true;
});
Clazz_overrideMethod(c$, "mark", 
function(readAheadLimit){
this.$mark = this.pos;
}, "~N");
Clazz_overrideMethod(c$, "resetStream", 
function(){
});
Clazz_overrideMethod(c$, "reset", 
function(){
this.pos = this.$mark;
});
Clazz_overrideMethod(c$, "close", 
function(){
});
});
;//5.0.1-v7 Fri Nov 21 04:39:22 CST 2025
Clazz_load(["java.io.OutputStream"], "java.io.ByteArrayOutputStream", null, function(){
var c$ = Clazz_decorateAsClass(function(){
this.buf = null;
this.count = 0;
Clazz_instantialize(this, arguments);}, java.io, "ByteArrayOutputStream", java.io.OutputStream);
Clazz_makeConstructor(c$, 
function(){
this.construct (32);
});
Clazz_makeConstructor(c$, 
function(size){
Clazz_superConstructor (this, java.io.ByteArrayOutputStream, []);
if (size < 0) {
throw  new IllegalArgumentException("Negative initial size: " + size);
}this.buf =  Clazz_newByteArray (size, 0);
}, "~N");
Clazz_defineMethod(c$, "ensureCapacity", 
function(minCapacity){
if (minCapacity - this.buf.length > 0) this.grow(minCapacity);
}, "~N");
Clazz_defineMethod(c$, "grow", 
function(minCapacity){
var oldCapacity = this.buf.length;
var newCapacity = oldCapacity << 1;
if (newCapacity - minCapacity < 0) newCapacity = minCapacity;
if (newCapacity < 0) {
if (minCapacity < 0) throw  new OutOfMemoryError();
newCapacity = minCapacity;
}this.buf = java.io.ByteArrayOutputStream.arrayCopyByte(this.buf, newCapacity);
}, "~N");
c$.arrayCopyByte = Clazz_defineMethod(c$, "arrayCopyByte", 
function(array, newLength){
var t =  Clazz_newByteArray (newLength, 0);
System.arraycopy(array, 0, t, 0, array.length < newLength ? array.length : newLength);
return t;
}, "~A,~N");
Clazz_overrideMethod(c$, "writeByteAsInt", 
function(b){
this.ensureCapacity(this.count + 1);
this.buf[this.count] = b;
this.count += 1;
}, "~N");
Clazz_defineMethod(c$, "write", 
function(b, off, len){
if ((off < 0) || (off > b.length) || (len < 0) || ((off + len) - b.length > 0)) {
throw  new IndexOutOfBoundsException();
}this.ensureCapacity(this.count + len);
System.arraycopy(b, off, this.buf, this.count, len);
this.count += len;
}, "~A,~N,~N");
Clazz_defineMethod(c$, "writeTo", 
function(out){
out.write(this.buf, 0, this.count);
}, "java.io.OutputStream");
Clazz_defineMethod(c$, "reset", 
function(){
this.count = 0;
});
Clazz_defineMethod(c$, "toByteArray", 
function(){
return (this.count == this.buf.length ? this.buf : java.io.ByteArrayOutputStream.arrayCopyByte(this.buf, this.count));
});
Clazz_defineMethod(c$, "size", 
function(){
return this.count;
});
Clazz_overrideMethod(c$, "toString", 
function(){
return  String.instantialize(this.buf, 0, this.count);
});
Clazz_overrideMethod(c$, "close", 
function(){
});
});
;//5.0.1-v7 Fri Nov 21 04:39:22 CST 2025
Clazz_load(["java.io.InputStream"], "java.io.FilterInputStream", null, function(){
var c$ = Clazz_decorateAsClass(function(){
this.$in = null;
Clazz_instantialize(this, arguments);}, java.io, "FilterInputStream", java.io.InputStream);
Clazz_makeConstructor(c$, 
function($in){
Clazz_superConstructor (this, java.io.FilterInputStream, []);
this.$in = $in;
}, "java.io.InputStream");
Clazz_defineMethod(c$, "readByteAsInt", 
function(){
return this.$in.readByteAsInt();
});
Clazz_overrideMethod(c$, "read", 
function(b, off, len){
return this.$in.read(b, off, len);
}, "~A,~N,~N");
Clazz_defineMethod(c$, "skip", 
function(n){
return this.$in.skip(n);
}, "~N");
Clazz_defineMethod(c$, "available", 
function(){
return this.$in.available();
});
Clazz_defineMethod(c$, "close", 
function(){
this.$in.close();
});
Clazz_defineMethod(c$, "mark", 
function(readlimit){
this.$in.mark(readlimit);
}, "~N");
Clazz_defineMethod(c$, "reset", 
function(){
this.$in.reset();
});
Clazz_defineMethod(c$, "markSupported", 
function(){
return this.$in.markSupported();
});
});
;//5.0.1-v7 Fri Nov 21 04:39:22 CST 2025
Clazz_load(["java.io.Closeable"], "java.io.InputStream", null, function(){
var c$ = Clazz_declareType(java.io, "InputStream", null, java.io.Closeable);
Clazz_defineMethod(c$, "read", 
function(b, off, len){
if (b == null) {
throw  new NullPointerException();
} else if (off < 0 || len < 0 || len > b.length - off) {
throw  new IndexOutOfBoundsException();
} else if (len == 0) {
return 0;
}var c = this.readByteAsInt();
if (c == -1) {
return -1;
}b[off] = c;
var i = 1;
try {
for (; i < len; i++) {
c = this.readByteAsInt();
if (c == -1) {
break;
}b[off + i] = c;
}
} catch (ee) {
if (Clazz_exceptionOf(ee,"java.io.IOException")){
} else {
throw ee;
}
}
return i;
}, "~A,~N,~N");
Clazz_defineMethod(c$, "skip", 
function(n){
var remaining = n;
var nr;
if (java.io.InputStream.skipBuffer == null) java.io.InputStream.skipBuffer =  Clazz_newByteArray (2048, 0);
var localSkipBuffer = java.io.InputStream.skipBuffer;
if (n <= 0) {
return 0;
}while (remaining > 0) {
nr = this.read(localSkipBuffer, 0, Math.min(2048, remaining));
if (nr < 0) {
break;
}remaining -= nr;
}
return n - remaining;
}, "~N");
Clazz_defineMethod(c$, "available", 
function(){
return 0;
});
Clazz_overrideMethod(c$, "close", 
function(){
});
Clazz_defineMethod(c$, "mark", 
function(readlimit){
}, "~N");
Clazz_defineMethod(c$, "reset", 
function(){
throw  new java.io.IOException("mark/reset not supported");
});
Clazz_defineMethod(c$, "markSupported", 
function(){
return false;
});
Clazz_defineMethod(c$, "resetStream", 
function(){
});
c$.skipBuffer = null;
});
;//5.0.1-v7 Fri Nov 21 04:39:22 CST 2025
Clazz_load(["java.io.Reader"], "java.io.InputStreamReader", null, function(){
var c$ = Clazz_decorateAsClass(function(){
this.$in = null;
this.isOpen = true;
this.charsetName = null;
this.isUTF8 = false;
this.bytearr = null;
this.pos = 0;
Clazz_instantialize(this, arguments);}, java.io, "InputStreamReader", java.io.Reader);
Clazz_makeConstructor(c$, 
function($in, charsetName){
Clazz_superConstructor(this, java.io.InputStreamReader, [$in]);
this.$in = $in;
this.charsetName = charsetName;
if (!(this.isUTF8 = "UTF-8".equals(charsetName)) && !"ISO-8859-1".equals(charsetName)) throw  new NullPointerException("charsetName");
}, "java.io.InputStream,~S");
Clazz_defineMethod(c$, "getEncoding", 
function(){
return this.charsetName;
});
Clazz_overrideMethod(c$, "read", 
function(cbuf, offset, length){
if (this.bytearr == null || this.bytearr.length < length) this.bytearr =  Clazz_newByteArray (length, 0);
var c;
var char2;
var char3;
var byteCount = 0;
var charCount = offset;
var byteLen = this.$in.read(this.bytearr, this.pos, length - this.pos);
var nAvail = this.$in.available();
if (byteLen < 0) return -1;
var nMax = byteLen;
while (byteCount < nMax) {
c = this.bytearr[byteCount] & 0xff;
if (this.isUTF8) switch (c >> 4) {
case 0xC:
case 0xD:
if (byteCount + 1 >= byteLen) {
if (nAvail >= 1) {
nMax = byteCount;
continue;
}} else if (((char2 = this.bytearr[byteCount + 1]) & 0xC0) == 0x80) {
cbuf[charCount++] = String.fromCharCode(((c & 0x1F) << 6) | (char2 & 0x3F));
byteCount += 2;
continue;
}this.isUTF8 = false;
break;
case 0xE:
if (byteCount + 2 >= byteLen) {
if (nAvail >= 2) {
nMax = byteCount;
continue;
}} else if (((char2 = this.bytearr[byteCount + 1]) & 0xC0) == 0x80 && ((char3 = this.bytearr[byteCount + 2]) & 0xC0) == 0x80) {
cbuf[charCount++] = String.fromCharCode(((c & 0x0F) << 12) | ((char2 & 0x3F) << 6) | (char3 & 0x3F));
byteCount += 3;
continue;
}this.isUTF8 = false;
break;
}
byteCount++;
cbuf[charCount++] = String.fromCharCode(c);
}
this.pos = byteLen - byteCount;
for (var i = 0; i < this.pos; i++) {
this.bytearr[i] = this.bytearr[byteCount++];
}
return charCount - offset;
}, "~A,~N,~N");
Clazz_overrideMethod(c$, "ready", 
function(){
return this.isOpen;
});
Clazz_overrideMethod(c$, "close", 
function(){
this.$in.close();
this.isOpen = false;
});
});
;//5.0.1-v7 Fri Nov 21 04:39:22 CST 2025
Clazz_load(["java.io.Closeable", "$.Flushable"], "java.io.OutputStream", null, function(){
var c$ = Clazz_declareType(java.io, "OutputStream", null, [java.io.Closeable, java.io.Flushable]);
Clazz_defineMethod(c$, "write", 
function(b, off, len){
if (b == null) {
throw  new NullPointerException();
} else if ((off < 0) || (off > b.length) || (len < 0) || ((off + len) > b.length) || ((off + len) < 0)) {
throw  new IndexOutOfBoundsException();
} else if (len == 0) {
return;
}for (var i = 0; i < len; i++) {
this.writeByteAsInt(b[off + i]);
}
}, "~A,~N,~N");
Clazz_overrideMethod(c$, "flush", 
function(){
});
Clazz_overrideMethod(c$, "close", 
function(){
});
});
;//5.0.1-v7 Fri Dec 19 08:21:45 CST 2025
Clazz_load(["java.io.Closeable"], "java.io.Reader", null, function(){
var c$ = Clazz_decorateAsClass(function(){
this.lock = null;
this.skipBuffer = String.fromCharCode(null);
Clazz_instantialize(this, arguments);}, java.io, "Reader", null, java.io.Closeable);
Clazz_makeConstructor(c$, 
function(lock){
if (lock == null) {
throw  new NullPointerException();
}this.lock = lock;
}, "~O");
Clazz_defineMethod(c$, "skip", 
function(n){
if (n < 0) throw  new IllegalArgumentException("skip value is negative");
var nn = Math.min(n, 8192);
{
if ((this.skipBuffer == null) || (this.skipBuffer.length < nn)) this.skipBuffer =  Clazz_newCharArray (nn, '\0');
var r = n;
while (r > 0) {
var nc = this.read(this.skipBuffer, 0, Math.min(r, nn));
if (nc == -1) break;
r -= nc;
}
return n - r;
}}, "~N");
Clazz_defineMethod(c$, "ready", 
function(){
return false;
});
Clazz_defineMethod(c$, "markSupported", 
function(){
return false;
});
Clazz_defineMethod(c$, "mark", 
function(readAheadLimit){
throw  new java.io.IOException("mark() not supported");
}, "~N");
Clazz_defineMethod(c$, "reset", 
function(){
throw  new java.io.IOException("reset() not supported");
});
});
;//5.0.1-v7 Fri Nov 21 04:39:22 CST 2025
Clazz_load(["java.io.Reader"], "java.io.StringReader", null, function(){
var c$ = Clazz_decorateAsClass(function(){
this.str = null;
this.length = 0;
this.next = 0;
this.$mark = 0;
Clazz_instantialize(this, arguments);}, java.io, "StringReader", java.io.Reader);
Clazz_makeConstructor(c$, 
function(s){
Clazz_superConstructor(this, java.io.StringReader, [s]);
this.str = s;
this.length = s.length;
}, "~S");
Clazz_defineMethod(c$, "ensureOpen", 
function(){
if (this.str == null) throw  new java.io.IOException("Stream closed");
});
Clazz_overrideMethod(c$, "read", 
function(cbuf, off, len){
{
this.ensureOpen();
if ((off < 0) || (off > cbuf.length) || (len < 0) || ((off + len) > cbuf.length) || ((off + len) < 0)) {
throw  new IndexOutOfBoundsException();
} else if (len == 0) {
return 0;
}if (this.next >= this.length) return -1;
var n = Math.min(this.length - this.next, len);
this.str.getChars(this.next, this.next + n, cbuf, off);
this.next += n;
return n;
}}, "~A,~N,~N");
Clazz_overrideMethod(c$, "skip", 
function(ns){
{
this.ensureOpen();
if (this.next >= this.length) return 0;
var n = Math.min(this.length - this.next, ns);
n = Math.max(-this.next, n);
this.next += n;
return n;
}}, "~N");
Clazz_overrideMethod(c$, "ready", 
function(){
{
this.ensureOpen();
return true;
}});
Clazz_overrideMethod(c$, "markSupported", 
function(){
return true;
});
Clazz_overrideMethod(c$, "mark", 
function(readAheadLimit){
if (readAheadLimit < 0) {
throw  new IllegalArgumentException("Read-ahead limit < 0");
}{
this.ensureOpen();
this.$mark = this.next;
}}, "~N");
Clazz_overrideMethod(c$, "reset", 
function(){
{
this.ensureOpen();
this.next = this.$mark;
}});
Clazz_overrideMethod(c$, "close", 
function(){
this.str = null;
});
});
;//5.0.1-v7 Fri Nov 21 04:39:22 CST 2025
Clazz_load(["java.io.Closeable", "$.Flushable", "java.lang.Appendable"], "java.io.Writer", null, function(){
var c$ = Clazz_decorateAsClass(function(){
this.lock = null;
Clazz_instantialize(this, arguments);}, java.io, "Writer", null, [Appendable, java.io.Closeable, java.io.Flushable]);
Clazz_makeConstructor(c$, 
function(){
this.lock = this;
});
Clazz_makeConstructor(c$, 
function(lock){
if (lock != null) {
this.lock = lock;
} else {
throw  new NullPointerException();
}}, "~O");
Clazz_defineMethod(c$, "write", 
function(buf){
this.write(buf, 0, buf.length);
}, "~A");
Clazz_defineMethod(c$, "write", 
function(oneChar){
{
var oneCharArray =  Clazz_newCharArray (1, '\0');
oneCharArray[0] = String.fromCharCode(oneChar);
this.write(oneCharArray);
}}, "~N");
Clazz_defineMethod(c$, "write", 
function(str){
var buf =  Clazz_newCharArray (str.length, '\0');
str.getChars(0, buf.length, buf, 0);
{
this.write(buf);
}}, "~S");
Clazz_defineMethod(c$, "write", 
function(str, offset, count){
if (count >= 0) {
var buf =  Clazz_newCharArray (count, '\0');
str.getChars(offset, offset + count, buf, 0);
{
this.write(buf);
}} else {
throw  new StringIndexOutOfBoundsException();
}}, "~S,~N,~N");
Clazz_defineMethod(c$, "append", 
function(c){
this.write(c.charCodeAt(0));
return this;
}, "~S");
Clazz_defineMethod(c$, "append", 
function(csq){
if (null == csq) {
this.write("null");
} else {
this.write(csq.toString());
}return this;
}, "CharSequence");
Clazz_defineMethod(c$, "append", 
function(csq, start, end){
if (null == csq) {
this.write("null".substring(start, end));
} else {
this.write(csq.subSequence(start, end).toString());
}return this;
}, "CharSequence,~N,~N");
});
;//5.0.1-v7 Fri Nov 21 04:39:22 CST 2025
Clazz_declarePackage("java.net");
Clazz_load(["java.io.IOException"], "java.net.MalformedURLException", null, function(){
var c$ = Clazz_declareType(java.net, "MalformedURLException", java.io.IOException);
Clazz_makeConstructor(c$, 
function(){
Clazz_superConstructor (this, java.net.MalformedURLException, []);
});
});
;//5.0.1-v7 Fri Nov 21 04:39:22 CST 2025
Clazz_declarePackage("java.net");
Clazz_load(["java.io.IOException"], "java.net.UnknownServiceException", null, function(){
var c$ = Clazz_declareType(java.net, "UnknownServiceException", java.io.IOException);
Clazz_makeConstructor(c$, 
function(){
Clazz_superConstructor (this, java.net.UnknownServiceException, []);
});
});
;//5.0.1-v7 Fri Nov 21 04:39:22 CST 2025
Clazz_declarePackage("java.net");
Clazz_load(["java.util.Hashtable"], "java.net.URL", null, function(){
var c$ = Clazz_decorateAsClass(function(){
this.protocol = null;
this.host = null;
this.port = -1;
this.file = null;
this.query = null;
this.authority = null;
this.path = null;
this.userInfo = null;
this.ref = null;
this.handler = null;
this.$hashCode = -1;
Clazz_instantialize(this, arguments);}, java.net, "URL", null);
Clazz_makeConstructor(c$, 
function(context, spec, handler){
{
switch (arguments.length) {
case 1:
spec = context;context = handler = null;
break;
case 2:
handler = null;
break;
case 3:
if (context == null || Clazz_instanceOf(context, java.net.URL))
break;
default:
alert("java.net.URL constructor format not supported");
break;
}
context && context.valueOf && context.valueOf() == null && (context = null);
}var original = spec;
var i;
var limit;
var c;
var start = 0;
var newProtocol = null;
var aRef = false;
var isRelative = false;
try {
limit = spec.length;
while ((limit > 0) && (spec.charAt(limit - 1) <= ' ')) {
limit--;
}
while ((start < limit) && (spec.charAt(start) <= ' ')) {
start++;
}
if (spec.regionMatches(true, start, "url:", 0, 4)) {
start += 4;
}if (start < spec.length && spec.charAt(start) == '#') {
aRef = true;
}for (i = start; !aRef && (i < limit) && ((c = (spec.charAt(i)).charCodeAt(0)) != 47); i++) {
if (c == 58) {
var s = spec.substring(start, i).toLowerCase();
if (this.isValidProtocol(s)) {
newProtocol = s;
start = i + 1;
}break;
}}
this.protocol = newProtocol;
if ((context != null) && ((newProtocol == null) || newProtocol.equalsIgnoreCase(context.protocol))) {
if (handler == null) {
handler = context.handler;
}if (context.path != null && context.path.startsWith("/")) newProtocol = null;
if (newProtocol == null) {
this.protocol = context.protocol;
this.authority = context.authority;
this.userInfo = context.userInfo;
this.host = context.host;
this.port = context.port;
this.file = context.file;
this.path = context.path;
isRelative = true;
}}if (this.protocol == null) {
throw  new java.net.MalformedURLException("no protocol: " + original);
}if (handler == null && (handler = java.net.URL.getURLStreamHandler(this.protocol)) == null) {
throw  new java.net.MalformedURLException("unknown protocol: " + this.protocol);
}this.handler = handler;
i = spec.indexOf('#', start);
if (i >= 0) {
this.ref = spec.substring(i + 1, limit);
limit = i;
}if (isRelative && start == limit) {
this.query = context.query;
if (this.ref == null) {
this.ref = context.ref;
}}handler.parseURL(this, spec, start, limit);
} catch (e$$) {
if (Clazz_exceptionOf(e$$,"java.net.MalformedURLException")){
var e = e$$;
{
throw e;
}
} else if (Clazz_exceptionOf(e$$, Exception)){
var e = e$$;
{
var exception =  new java.net.MalformedURLException(e.getMessage());
exception.initCause(e);
throw exception;
}
} else {
throw e$$;
}
}
}, "java.net.URL,~S,java.net.URLStreamHandler");
Clazz_defineMethod(c$, "isValidProtocol", 
function(protocol){
var len = protocol.length;
if (len < 1) return false;
var c = protocol.charAt(0);
if (!Character.isLetter(c)) return false;
for (var i = 1; i < len; i++) {
c = protocol.charAt(i);
if (!Character.isLetterOrDigit(c) && c != '.' && c != '+' && c != '-') {
return false;
}}
return true;
}, "~S");
Clazz_defineMethod(c$, "set5", 
function(protocol, host, port, file, ref){
{
this.protocol = protocol;
this.host = host;
this.authority = port == -1 ? host : host + ":" + port;
this.port = port;
this.file = file;
this.ref = ref;
this.$hashCode = -1;
var q = file.lastIndexOf('?');
if (q != -1) {
this.query = file.substring(q + 1);
this.path = file.substring(0, q);
} else this.path = file;
}}, "~S,~S,~N,~S,~S");
Clazz_defineMethod(c$, "set", 
function(protocol, host, port, authority, userInfo, path, query, ref){
{
this.protocol = protocol;
this.host = host;
this.port = port;
this.file = query == null ? path : path + "?" + query;
this.userInfo = userInfo;
this.path = path;
this.ref = ref;
this.$hashCode = -1;
this.query = query;
this.authority = authority;
}}, "~S,~S,~N,~S,~S,~S,~S,~S");
Clazz_defineMethod(c$, "getQuery", 
function(){
return this.query;
});
Clazz_defineMethod(c$, "getPath", 
function(){
return this.path;
});
Clazz_defineMethod(c$, "getUserInfo", 
function(){
return this.userInfo;
});
Clazz_defineMethod(c$, "getAuthority", 
function(){
return this.authority;
});
Clazz_defineMethod(c$, "getPort", 
function(){
return this.port;
});
Clazz_defineMethod(c$, "getDefaultPort", 
function(){
return this.handler.getDefaultPort();
});
Clazz_defineMethod(c$, "getProtocol", 
function(){
return this.protocol;
});
Clazz_defineMethod(c$, "getHost", 
function(){
return this.host;
});
Clazz_defineMethod(c$, "getFile", 
function(){
return this.file;
});
Clazz_defineMethod(c$, "getRef", 
function(){
return this.ref;
});
Clazz_overrideMethod(c$, "equals", 
function(obj){
if (!(Clazz_instanceOf(obj,"java.net.URL"))) return false;
var u2 = obj;
return this.handler.equals2(this, u2);
}, "~O");
Clazz_overrideMethod(c$, "hashCode", 
function(){
if (this.$hashCode != -1) return this.$hashCode;
this.$hashCode = this.handler.hashCode(this);
return this.$hashCode;
});
Clazz_defineMethod(c$, "sameFile", 
function(other){
return this.handler.sameFile(this, other);
}, "java.net.URL");
Clazz_overrideMethod(c$, "toString", 
function(){
return this.toExternalForm();
});
Clazz_defineMethod(c$, "toExternalForm", 
function(){
return this.handler.toExternalForm(this);
});
Clazz_defineMethod(c$, "openConnection", 
function(){
return this.handler.openConnection(this);
});
Clazz_defineMethod(c$, "openStream", 
function(){
return this.openConnection().getInputStream();
});
Clazz_defineMethod(c$, "getContent", 
function(){
return this.openConnection().getInputStream();
});
c$.setURLStreamHandlerFactory = Clazz_defineMethod(c$, "setURLStreamHandlerFactory", 
function(fac){
{
if (java.net.URL.factory != null) {
throw  new Error("factory already defined");
}var security = System.getSecurityManager();
if (security != null) {
security.checkSetFactory();
}java.net.URL.handlers.clear();
java.net.URL.factory = fac;
}}, "java.net.URLStreamHandlerFactory");
c$.getURLStreamHandler = Clazz_defineMethod(c$, "getURLStreamHandler", 
function(protocol){
var handler = java.net.URL.handlers.get(protocol);
if (handler == null) {
if (java.net.URL.factory != null) {
handler = java.net.URL.factory.createURLStreamHandler(protocol);
}}return handler;
}, "~S");
c$.factory = null;
c$.handlers =  new java.util.Hashtable();
c$.streamHandlerLock =  new Clazz._O();
});
;//5.0.1-v7 Fri Nov 21 04:39:22 CST 2025
Clazz_declarePackage("java.net");
Clazz_load(null, "java.net.URLConnection", ["java.util.ArrayList"], function(){
var c$ = Clazz_decorateAsClass(function(){
this.url = null;
this.doInput = true;
this.doOutput = false;
this.connected = false;
this.requests = null;
Clazz_instantialize(this, arguments);}, java.net, "URLConnection", null);
Clazz_makeConstructor(c$, 
function(url){
this.url = url;
}, "java.net.URL");
Clazz_defineMethod(c$, "setDoInput", 
function(doinput){
if (this.connected) throw  new IllegalStateException("Already connected");
this.doInput = doinput;
}, "~B");
Clazz_defineMethod(c$, "getDoInput", 
function(){
return this.doInput;
});
Clazz_defineMethod(c$, "setDoOutput", 
function(dooutput){
if (this.connected) throw  new IllegalStateException("Already connected");
this.doOutput = dooutput;
}, "~B");
Clazz_defineMethod(c$, "getDoOutput", 
function(){
return this.doOutput;
});
Clazz_defineMethod(c$, "getURL", 
function(){
return this.url;
});
Clazz_defineMethod(c$, "getInputStream", 
function(){
throw  new java.net.UnknownServiceException("protocol doesn't support input");
});
Clazz_defineMethod(c$, "getOutputStream", 
function(){
throw  new java.net.UnknownServiceException("protocol doesn't support output");
});
Clazz_defineMethod(c$, "setRequestProperty", 
function(key, value){
if (this.connected) throw  new IllegalStateException("Already connected");
if (key == null) throw  new NullPointerException("key is null");
if (this.requests == null) this.requests =  new java.util.ArrayList();
for (var i = this.requests.size(); --i >= 0; ) if (this.requests.get(i)[0].equals(key)) {
this.requests.get(i)[1] = value;
return;
}
this.requests.add( Clazz_newArray(-1, [key, value]));
}, "~S,~S");
});
;//5.0.1-v7 Fri Nov 21 04:39:22 CST 2025
Clazz_declarePackage("java.net");
(function(){
var c$ = Clazz_declareType(java.net, "URLEncoder", null);
c$.encode = Clazz_defineMethod(c$, "encode", 
function(s){
return encodeURIComponent(s);
}, "~S");
})();
;//5.0.1-v7 Fri Nov 21 04:39:22 CST 2025
Clazz_declarePackage("java.net");
(function(){
var c$ = Clazz_declareType(java.net, "URLStreamHandler", null);
Clazz_defineMethod(c$, "openConnectionProxy", 
function(u, p){
throw  new UnsupportedOperationException("Method not implemented.");
}, "java.net.URL,java.net.Proxy");
Clazz_defineMethod(c$, "parseURL", 
function(u, spec, start, limit){
var protocol = u.getProtocol();
var authority = u.getAuthority();
var userInfo = u.getUserInfo();
var host = u.getHost();
var port = u.getPort();
var path = u.getPath();
var query = u.getQuery();
var ref = u.getRef();
var isRelPath = false;
var queryOnly = false;
if (start < limit) {
var queryStart = spec.indexOf('?');
queryOnly = queryStart == start;
if ((queryStart != -1) && (queryStart < limit)) {
query = spec.substring(queryStart + 1, limit);
if (limit > queryStart) limit = queryStart;
spec = spec.substring(0, queryStart);
}}var i = 0;
var isUNCName = (start <= limit - 4) && (spec.charAt(start) == '/') && (spec.charAt(start + 1) == '/') && (spec.charAt(start + 2) == '/') && (spec.charAt(start + 3) == '/');
if (!isUNCName && (start <= limit - 2) && (spec.charAt(start) == '/') && (spec.charAt(start + 1) == '/')) {
start += 2;
i = spec.indexOf('/', start);
if (i < 0) {
i = spec.indexOf('?', start);
if (i < 0) i = limit;
}host = authority = spec.substring(start, i);
var ind = authority.indexOf('@');
if (ind != -1) {
userInfo = authority.substring(0, ind);
host = authority.substring(ind + 1);
} else {
userInfo = null;
}if (host != null) {
if (host.length > 0 && (host.charAt(0) == '[')) {
throw  new IllegalArgumentException("Invalid host: " + host);
}ind = host.indexOf(':');
port = -1;
if (ind >= 0) {
if (host.length > (ind + 1)) {
port = Integer.parseInt(host.substring(ind + 1));
}host = host.substring(0, ind);
}} else {
host = "";
}if (port < -1) throw  new IllegalArgumentException("Invalid port number :" + port);
start = i;
if (authority.length > 0) path = "";
}if (host == null) {
host = "";
}if (start < limit) {
if (spec.charAt(start) == '/') {
path = spec.substring(start, limit);
} else if (path != null && path.length > 0) {
isRelPath = true;
var ind = path.lastIndexOf('/');
var seperator = "";
if (ind == -1 && authority != null) seperator = "/";
path = path.substring(0, ind + 1) + seperator + spec.substring(start, limit);
} else {
var seperator = (authority != null) ? "/" : "";
path = seperator + spec.substring(start, limit);
}} else if (queryOnly && path != null) {
var ind = path.lastIndexOf('/');
if (ind < 0) ind = 0;
path = path.substring(0, ind) + "/";
}if (path == null) path = "";
if (isRelPath) {
while ((i = path.indexOf("/./")) >= 0) {
path = path.substring(0, i) + path.substring(i + 2);
}
i = 0;
while ((i = path.indexOf("/../", i)) >= 0) {
if (i > 0 && (limit = path.lastIndexOf('/', i - 1)) >= 0 && (path.indexOf("/../", limit) != 0)) {
path = path.substring(0, limit) + path.substring(i + 3);
i = 0;
} else {
i = i + 3;
}}
while (path.endsWith("/..")) {
i = path.indexOf("/..");
if ((limit = path.lastIndexOf('/', i - 1)) >= 0) {
path = path.substring(0, limit + 1);
} else {
break;
}}
if (path.startsWith("./") && path.length > 2) path = path.substring(2);
if (path.endsWith("/.")) path = path.substring(0, path.length - 1);
}this.setURL(u, protocol, host, port, authority, userInfo, path, query, ref);
}, "java.net.URL,~S,~N,~N");
Clazz_defineMethod(c$, "getDefaultPort", 
function(){
return -1;
});
Clazz_defineMethod(c$, "equals2", 
function(u1, u2){
var ref1 = u1.getRef();
var ref2 = u2.getRef();
return (ref1 === ref2 || (ref1 != null && ref1.equals(ref2))) && this.sameFile(u1, u2);
}, "java.net.URL,java.net.URL");
Clazz_defineMethod(c$, "hashCode", 
function(u){
var h = 0;
var protocol = u.getProtocol();
if (protocol != null) h += protocol.hashCode();
h += u.toString().hashCode();
var file = u.getFile();
if (file != null) h += file.hashCode();
if (u.getPort() == -1) h += this.getDefaultPort();
 else h += u.getPort();
var ref = u.getRef();
if (ref != null) h += ref.hashCode();
return h;
}, "java.net.URL");
Clazz_defineMethod(c$, "sameFile", 
function(u1, u2){
if (!((u1.getProtocol() === u2.getProtocol()) || (u1.getProtocol() != null && u1.getProtocol().equalsIgnoreCase(u2.getProtocol())))) return false;
if (!(u1.getFile() === u2.getFile() || (u1.getFile() != null && u1.getFile().equals(u2.getFile())))) return false;
var port1;
var port2;
port1 = (u1.getPort() != -1) ? u1.getPort() : u1.handler.getDefaultPort();
port2 = (u2.getPort() != -1) ? u2.getPort() : u2.handler.getDefaultPort();
if (port1 != port2) return false;
if (!this.hostsEqual(u1, u2)) return false;
return true;
}, "java.net.URL,java.net.URL");
Clazz_defineMethod(c$, "hostsEqual", 
function(u1, u2){
if (u1.getHost() != null && u2.getHost() != null) return u1.getHost().equalsIgnoreCase(u2.getHost());
return u1.getHost() == null && u2.getHost() == null;
}, "java.net.URL,java.net.URL");
Clazz_defineMethod(c$, "toExternalForm", 
function(u){
return "";
}, "java.net.URL");
Clazz_defineMethod(c$, "setURL", 
function(u, protocol, host, port, authority, userInfo, path, query, ref){
if (this !== u.handler) {
throw  new SecurityException("handler for url different from this handler");
}u.set(u.getProtocol(), host, port, authority, userInfo, path, query, ref);
}, "java.net.URL,~S,~S,~N,~S,~S,~S,~S,~S");
Clazz_defineMethod(c$, "setURLDeprecated", 
function(u, protocol, host, port, file, ref){
var authority = null;
var userInfo = null;
if (host != null && host.length != 0) {
authority = (port == -1) ? host : host + ":" + port;
var at = host.lastIndexOf('@');
if (at != -1) {
userInfo = host.substring(0, at);
host = host.substring(at + 1);
}}var path = null;
var query = null;
if (file != null) {
var q = file.lastIndexOf('?');
if (q != -1) {
query = file.substring(q + 1);
path = file.substring(0, q);
} else path = file;
}this.setURL(u, protocol, host, port, authority, userInfo, path, query, ref);
}, "java.net.URL,~S,~S,~N,~S,~S");
})();
;//5.0.1-v7 Fri Nov 21 04:39:22 CST 2025
Clazz_declarePackage("java.net");
Clazz_declareInterface(java.net, "URLStreamHandlerFactory");
;//5.0.1-v7 Fri Nov 21 04:39:22 CST 2025
Clazz_declarePackage("java.text");
(function(){
var c$ = Clazz_decorateAsClass(function(){
this.pattern = null;
Clazz_instantialize(this, arguments);}, java.text, "MessageFormat", null);
Clazz_makeConstructor(c$, 
function(pattern){
this.pattern = pattern;
}, "~S");
Clazz_makeConstructor(c$, 
function(pattern, locale){
this.pattern = pattern;
}, "~S,java.util.Locale");
c$.format = Clazz_defineMethod(c$, "format", 
function(pattern, args){
return pattern.replace (/\{(\d+)\}/g, function ($0, $1) {
var i = parseInt ($1);
if (args == null) return null;
return args[i];
});
}, "~S,~A");
Clazz_defineMethod(c$, "format", 
function(obj){
return java.text.MessageFormat.format(this.pattern,  Clazz_newArray(-1, [obj]));
}, "~O");
})();
;//5.0.1-v7 Fri Nov 21 04:39:22 CST 2025
(function(){
var c$ = Clazz_decorateAsClass(function(){
this.haveNextNextGaussian = false;
this.seed = 0;
this.nextNextGaussian = 0;
Clazz_instantialize(this, arguments);}, java.util, "Random", null, java.io.Serializable);
Clazz_makeConstructor(c$, 
function(){
var seed = -2147483648;
{
arguments.length == 1 && (seed = arguments[0]);
}if (seed == -2147483648) seed = System.currentTimeMillis();
this.setSeed(seed);
});
Clazz_defineMethod(c$, "next", 
function(bits){
this.seed = (this.seed * 25214903917 + 0xb) & (281474976710655);
return (this.seed >>> (48 - bits));
}, "~N");
Clazz_defineMethod(c$, "nextBoolean", 
function(){
{
return Math.random () > 0.5;
}});
Clazz_defineMethod(c$, "nextBytes", 
function(buf){
{
var rand = 0;
var count = 0;
var loop = 0;
while (count < buf.length) {
if (loop == 0) {
rand = this.nextInt();
loop = 3;
} else {
loop--;
}buf[count++] = rand;
rand >>= 8;
}
}}, "~A");
Clazz_defineMethod(c$, "nextDouble", 
function(){
{
return Math.random ();
}});
Clazz_defineMethod(c$, "nextFloat", 
function(){
{
return Math.random ();
}});
Clazz_defineMethod(c$, "nextGaussian", 
function(){
if (this.haveNextNextGaussian) {
this.haveNextNextGaussian = false;
return this.nextNextGaussian;
}var v1;
var v2;
var s;
do {
v1 = 2 * this.nextDouble() - 1;
v2 = 2 * this.nextDouble() - 1;
s = v1 * v1 + v2 * v2;
} while (s >= 1);
var norm = Math.sqrt(-2 * Math.log(s) / s);
this.nextNextGaussian = v2 * norm;
this.haveNextNextGaussian = true;
return v1 * norm;
});
Clazz_defineMethod(c$, "nextInt", 
function(n){
{
if (arguments.length == 0)
return Math.random()*0x100000000 | 0;
}if (n <= 0) {
throw  new IllegalArgumentException();
}{
return Math.random() * n|0
}}, "~N");
Clazz_defineMethod(c$, "nextLong", 
function(){
return (this.next(32) << 32) + this.next(32);
});
Clazz_defineMethod(c$, "setSeed", 
function(seed){
{
Math.seedrandom(seed);
}}, "~N");
{
{
(function (pool, math, width, chunks, significance, overflow, startdenom) {
var copyright = "Copyright 2010 David Bau, all rights reserved. (BSD)"
//
// seedrandom()
// This is the seedrandom function described above.
//
math['seedrandom'] = function seedrandom(seed, use_entropy) {
var key = [];
var arc4;
// Flatten the seed string or build one from local entropy if needed.
seed = mixkey(flatten(
use_entropy ? [seed, pool] :
arguments.length ? seed :
[new Date().getTime(), pool, window], 3), key);
// Use the seed to initialize an ARC4 generator.
arc4 = new ARC4(key);
// Mix the randomness into accumulated entropy.
mixkey(arc4.S, pool);
// Override Math.random
// This function returns a random double in [0, 1) that contains
// randomness in every bit of the mantissa of the IEEE 754 value.
math['random'] = function random() {  // Closure to return a random double:
var n = arc4.g(chunks);             // Start with a numerator n < 2 ^ 48
var d = startdenom;                 //   and denominator d = 2 ^ 48.
var x = 0;                          //   and no 'extra last byte'.
while (n < significance) {          // Fill up all significant digits by
n = (n + x) * width;              //   shifting numerator and
d *= width;                       //   denominator and generating a
x = arc4.g(1);                    //   new least-significant-byte.
}
while (n >= overflow) {             // To avoid rounding up, before adding
n /= 2;                           //   last byte, shift everything
d /= 2;                           //   right using integer math until
x >>>= 1;                         //   we have exactly the desired bits.
}
return (n + x) / d;                 // Form the number within [0, 1).
};
// Return the seed that was used
return seed;
};
//
// ARC4
//
// An ARC4 implementation.  The constructor takes a key in the form of
// an array of at most (width) integers that should be 0 <= x < (width).
//
// The g(count) method returns a pseudorandom integer that concatenates
// the next (count) outputs from ARC4.  Its return value is a number x
// that is in the range 0 <= x < (width ^ count).
//
function ARC4(key) {
var t, u, me = this, keylen = key.length;
var i = 0, j = me.i = me.j = me.m = 0;
me.S = [];
me.c = [];
// The empty key [] is treated as [0].
if (!keylen) { key = [keylen++]; }
// Set up S using the standard key scheduling algorithm.
while (i < width) { me.S[i] = i++; }
for (i = 0; i < width; i++) {
t = me.S[i];
j = lowbits(j + t + key[i % keylen]);
u = me.S[j];
me.S[i] = u;
me.S[j] = t;
}
// The "g" method returns the next (count) outputs as one number.
me.g = function getnext(count) {
var s = me.S;
var i = lowbits(me.i + 1); var t = s[i];
var j = lowbits(me.j + t); var u = s[j];
s[i] = u;
s[j] = t;
var r = s[lowbits(t + u)];
while (--count) {
i = lowbits(i + 1); t = s[i];
j = lowbits(j + t); u = s[j];
s[i] = u;
s[j] = t;
r = r * width + s[lowbits(t + u)];
}
me.i = i;
me.j = j;
return r;
};
// For robust unpredictability discard an initial batch of values.
// See http://www.rsa.com/rsalabs/node.asp?id=2009
me.g(width);
}
//
// flatten()
// Converts an object tree to nested arrays of strings.
//
function flatten(obj, depth, result, prop) {
result = [];
if (depth && typeof(obj) == 'object') {
for (prop in obj) {
if (prop.indexOf('S') < 5) {    // Avoid FF3 bug (local/sessionStorage)
try { result.push(flatten(obj[prop], depth - 1)); } catch (e) {}
}
}
}
return result.length ? result : '' + obj;
}
//
// mixkey()
// Mixes a string seed into a key that is an array of integers, and
// returns a shortened string seed that is equivalent to the result key.
//
function mixkey(seed, key, smear, j) {
seed += '';                         // Ensure the seed is a string
smear = 0;
for (j = 0; j < seed.length; j++) {
key[lowbits(j)] =
lowbits((smear ^= key[lowbits(j)] * 19) + seed.charCodeAt(j));
}
seed = '';
for (j in key) { seed += String.fromCharCode(key[j]); }
return seed;
}
//
// lowbits()
// A quick "n mod width" for width a power of 2.
//
function lowbits(n) { return n & (width - 1); }
//
// The following constants are related to IEEE 754 limits.
//
startdenom = math.pow(width, chunks);
significance = math.pow(2, significance);
overflow = significance * 2;
//
// When seedrandom.js is loaded, we immediately mix a few bits
// from the built-in RNG into the entropy pool.  Because we do
// not want to intefere with determinstic PRNG state later,
// seedrandom will not call math.random on its own again after
// initialization.
//
mixkey(math.random(), pool);
// End anonymous scope, and pass initial values.
})(
[],   // pool: entropy pool starts empty
Math, // math: package containing random, pow, and seedrandom
256,  // width: each RC4 output is 0 <= x < 256
6,    // chunks: at least six RC4 outputs for each double
52    // significance: there are 52 significant digits in a double
);
}}})();
;//5.0.1-v7 Fri Nov 21 04:39:22 CST 2025
Clazz_load(["java.util.Collection"], "java.util.AbstractCollection", ["java.lang.reflect.Array"], function(){
var c$ = Clazz_declareType(java.util, "AbstractCollection", null, java.util.Collection);
/*LV!1824 unnec constructor*/Clazz_overrideMethod(c$, "add", 
function(object){
throw  new UnsupportedOperationException();
}, "~O");
Clazz_overrideMethod(c$, "addAll", 
function(collection){
var result = false;
var it = collection.iterator();
while (it.hasNext()) {
if (this.add(it.next())) {
result = true;
}}
return result;
}, "java.util.Collection");
Clazz_overrideMethod(c$, "clear", 
function(){
var it = this.iterator();
while (it.hasNext()) {
it.next();
it.remove();
}
});
Clazz_overrideMethod(c$, "contains", 
function(object){
var it = this.iterator();
if (object != null) {
while (it.hasNext()) {
if (object.equals(it.next())) {
return true;
}}
} else {
while (it.hasNext()) {
if (it.next() == null) {
return true;
}}
}return false;
}, "~O");
Clazz_overrideMethod(c$, "containsAll", 
function(collection){
var it = collection.iterator();
while (it.hasNext()) {
if (!this.contains(it.next())) {
return false;
}}
return true;
}, "java.util.Collection");
Clazz_overrideMethod(c$, "isEmpty", 
function(){
return this.size() == 0;
});
Clazz_overrideMethod(c$, "remove", 
function(object){
var it = this.iterator();
if (object != null) {
while (it.hasNext()) {
if (object.equals(it.next())) {
it.remove();
return true;
}}
} else {
while (it.hasNext()) {
if (it.next() == null) {
it.remove();
return true;
}}
}return false;
}, "~O");
Clazz_overrideMethod(c$, "removeAll", 
function(collection){
var result = false;
var it = this.iterator();
while (it.hasNext()) {
if (collection.contains(it.next())) {
it.remove();
result = true;
}}
return result;
}, "java.util.Collection");
Clazz_overrideMethod(c$, "retainAll", 
function(collection){
var result = false;
var it = this.iterator();
while (it.hasNext()) {
if (!collection.contains(it.next())) {
it.remove();
result = true;
}}
return result;
}, "java.util.Collection");
Clazz_defineMethod(c$, "toArray", 
function(){
var size = this.size();
var index = 0;
var it = this.iterator();
var array =  new Array(size);
while (index < size) {
array[index++] = it.next();
}
return array;
});
Clazz_defineMethod(c$, "toArray", 
function(contents){
var size = this.size();
var index = 0;
if (size > contents.length) {
var ct = contents.getClass().getComponentType();
contents = java.lang.reflect.Array.newInstance(ct, size);
}for (var entry, $entry = this.iterator (); $entry.hasNext()&& ((entry = $entry.next ()) || true);) {
contents[index++] = entry;
}
if (index < contents.length) {
contents[index] = null;
}return contents;
}, "~A");
Clazz_overrideMethod(c$, "toString", 
function(){
if (this.isEmpty()) {
return "[]";
}var buffer = "[";
var it = this.iterator();
while (it.hasNext()) {
var next = it.next();
if (next !== this) {
buffer += next;
} else {
buffer += ("(this Collection)");
}if (it.hasNext()) {
buffer += (", ");
}}
buffer += (']');
return buffer;
});
});
;//5.0.1-v7 Fri Nov 21 04:39:22 CST 2025
Clazz_load(["java.util.AbstractCollection", "$.Iterator", "$.List", "$.ListIterator", "$.RandomAccess"], "java.util.AbstractList", null, function(){
var c$ = Clazz_decorateAsClass(function(){
this.modCount = 0;
Clazz_instantialize(this, arguments);}, java.util, "AbstractList", java.util.AbstractCollection, java.util.List);
Clazz_defineMethod(c$, "add", 
function(location, object){
throw  new UnsupportedOperationException();
}, "~N,~O");
Clazz_defineMethod(c$, "add", 
function(object){
this.add(this.size(), object);
return true;
}, "~O");
Clazz_defineMethod(c$, "addAll", 
function(location, collection){
var it = collection.iterator();
while (it.hasNext()) {
this.add(location++, it.next());
}
return !collection.isEmpty();
}, "~N,java.util.Collection");
Clazz_overrideMethod(c$, "clear", 
function(){
this.removeRange(0, this.size());
});
Clazz_overrideMethod(c$, "equals", 
function(object){
if (this === object) {
return true;
}if (Clazz_instanceOf(object,"java.util.List")) {
var list = object;
if (list.size() != this.size()) {
return false;
}var it1 = this.iterator();
var it2 = list.iterator();
while (it1.hasNext()) {
var e1 = it1.next();
var e2 = it2.next();
if (!(e1 == null ? e2 == null : e1.equals(e2))) {
return false;
}}
return true;
}return false;
}, "~O");
Clazz_overrideMethod(c$, "hashCode", 
function(){
var result = 1;
var it = this.iterator();
while (it.hasNext()) {
var object = it.next();
result = (31 * result) + (object == null ? 0 : object.hashCode());
}
return result;
});
Clazz_overrideMethod(c$, "indexOf", 
function(object){
var it = this.listIterator();
if (object != null) {
while (it.hasNext()) {
if (object.equals(it.next())) {
return it.previousIndex();
}}
} else {
while (it.hasNext()) {
if (it.next() == null) {
return it.previousIndex();
}}
}return -1;
}, "~O");
Clazz_overrideMethod(c$, "iterator", 
function(){
return  new java.util.AbstractList.SimpleListIterator(this);
});
Clazz_overrideMethod(c$, "lastIndexOf", 
function(object){
var it = this.listIterator(this.size());
if (object != null) {
while (it.hasPrevious()) {
if (object.equals(it.previous())) {
return it.nextIndex();
}}
} else {
while (it.hasPrevious()) {
if (it.previous() == null) {
return it.nextIndex();
}}
}return -1;
}, "~O");
Clazz_defineMethod(c$, "listIterator", 
function(){
return this.listIterator(0);
});
Clazz_defineMethod(c$, "listIterator", 
function(location){
return  new java.util.AbstractList.FullListIterator(this, location);
}, "~N");
Clazz_defineMethod(c$, "remove", 
function(location){
throw  new UnsupportedOperationException();
}, "~N");
Clazz_defineMethod(c$, "removeRange", 
function(start, end){
var it = this.listIterator(start);
for (var i = start; i < end; i++) {
it.next();
it.remove();
}
}, "~N,~N");
Clazz_overrideMethod(c$, "set", 
function(location, object){
throw  new UnsupportedOperationException();
}, "~N,~O");
Clazz_overrideMethod(c$, "subList", 
function(start, end){
if (0 <= start && end <= this.size()) {
if (start <= end) {
if (Clazz_instanceOf(this,"java.util.RandomAccess")) {
return  new java.util.AbstractList.SubAbstractListRandomAccess(this, start, end);
}return  new java.util.AbstractList.SubAbstractList(this, start, end);
}throw  new IllegalArgumentException();
}throw  new IndexOutOfBoundsException();
}, "~N,~N");
/*if3*/;(function(){
var c$ = Clazz_decorateAsClass(function(){
this.pos = -1;
this.expectedModCount = 0;
this.lastPosition = -1;
this.list = null;
Clazz_instantialize(this, arguments);}, java.util.AbstractList, "SimpleListIterator", null, java.util.Iterator);
Clazz_makeConstructor(c$, 
function(l){
this.list = l;
this.expectedModCount = l.modCount;
}, "java.util.AbstractList");
Clazz_overrideMethod(c$, "hasNext", 
function(){
return this.pos + 1 < this.list.size();
});
Clazz_overrideMethod(c$, "next", 
function(){
if (this.expectedModCount == this.list.modCount) {
try {
var result = this.list.get(this.pos + 1);
this.lastPosition = ++this.pos;
return result;
} catch (e) {
if (Clazz_exceptionOf(e,"IndexOutOfBoundsException")){
throw  new java.util.NoSuchElementException();
} else {
throw e;
}
}
}throw  new java.util.ConcurrentModificationException();
});
Clazz_overrideMethod(c$, "remove", 
function(){
if (this.expectedModCount == this.list.modCount) {
try {
this.list.remove(this.lastPosition);
} catch (e) {
if (Clazz_exceptionOf(e,"IndexOutOfBoundsException")){
throw  new IllegalStateException();
} else {
throw e;
}
}
if (this.list.modCount != this.expectedModCount) {
this.expectedModCount++;
}if (this.pos == this.lastPosition) {
this.pos--;
}this.lastPosition = -1;
} else {
throw  new java.util.ConcurrentModificationException();
}});
/*eoif3*/})();
/*if3*/;(function(){
var c$ = Clazz_declareType(java.util.AbstractList, "FullListIterator", java.util.AbstractList.SimpleListIterator, java.util.ListIterator);
Clazz_makeConstructor(c$, 
function(list, start){
Clazz_superConstructor(this, java.util.AbstractList.FullListIterator, [list]);
if (0 <= start && start <= list.size()) {
this.pos = start - 1;
} else {
throw  new IndexOutOfBoundsException();
}}, "java.util.AbstractList,~N");
Clazz_overrideMethod(c$, "add", 
function(object){
if (this.expectedModCount == this.list.modCount) {
try {
this.list.add(this.pos + 1, object);
} catch (e) {
if (Clazz_exceptionOf(e,"IndexOutOfBoundsException")){
throw  new java.util.NoSuchElementException();
} else {
throw e;
}
}
this.pos++;
this.lastPosition = -1;
if (this.list.modCount != this.expectedModCount) {
this.expectedModCount++;
}} else {
throw  new java.util.ConcurrentModificationException();
}}, "~O");
Clazz_overrideMethod(c$, "hasPrevious", 
function(){
return this.pos >= 0;
});
Clazz_overrideMethod(c$, "nextIndex", 
function(){
return this.pos + 1;
});
Clazz_overrideMethod(c$, "previous", 
function(){
if (this.expectedModCount == this.list.modCount) {
try {
var result = this.list.get(this.pos);
this.lastPosition = this.pos;
this.pos--;
return result;
} catch (e) {
if (Clazz_exceptionOf(e,"IndexOutOfBoundsException")){
throw  new java.util.NoSuchElementException();
} else {
throw e;
}
}
}throw  new java.util.ConcurrentModificationException();
});
Clazz_overrideMethod(c$, "previousIndex", 
function(){
return this.pos;
});
Clazz_overrideMethod(c$, "set", 
function(object){
if (this.expectedModCount == this.list.modCount) {
try {
this.list.set(this.lastPosition, object);
} catch (e) {
if (Clazz_exceptionOf(e,"IndexOutOfBoundsException")){
throw  new IllegalStateException();
} else {
throw e;
}
}
} else {
throw  new java.util.ConcurrentModificationException();
}}, "~O");
/*eoif3*/})();
/*if3*/;(function(){
var c$ = Clazz_declareType(java.util.AbstractList, "SubAbstractListRandomAccess", java.util.AbstractList.SubAbstractList, java.util.RandomAccess);
/*eoif3*/})();
/*if3*/;(function(){
var c$ = Clazz_decorateAsClass(function(){
this.fullList = null;
this.offset = 0;
this.$size = 0;
Clazz_instantialize(this, arguments);}, java.util.AbstractList, "SubAbstractList", java.util.AbstractList);
Clazz_makeConstructor(c$, 
function(list, start, end){
Clazz_superConstructor(this, java.util.AbstractList.SubAbstractList);
this.fullList = list;
this.modCount = this.fullList.modCount;
this.offset = start;
this.$size = end - start;
}, "java.util.AbstractList,~N,~N");
Clazz_defineMethod(c$, "add", 
function(location, object){
if (this.modCount == this.fullList.modCount) {
if (0 <= location && location <= this.$size) {
this.fullList.add(location + this.offset, object);
this.$size++;
this.modCount = this.fullList.modCount;
} else {
throw  new IndexOutOfBoundsException();
}} else {
throw  new java.util.ConcurrentModificationException();
}}, "~N,~O");
Clazz_defineMethod(c$, "addAll", 
function(location, collection){
if (this.modCount == this.fullList.modCount) {
if (0 <= location && location <= this.$size) {
var result = this.fullList.addAll(location + this.offset, collection);
if (result) {
this.$size += collection.size();
this.modCount = this.fullList.modCount;
}return result;
}throw  new IndexOutOfBoundsException();
}throw  new java.util.ConcurrentModificationException();
}, "~N,java.util.Collection");
Clazz_defineMethod(c$, "addAll", 
function(collection){
if (this.modCount == this.fullList.modCount) {
var result = this.fullList.addAll(this.offset + this.$size, collection);
if (result) {
this.$size += collection.size();
this.modCount = this.fullList.modCount;
}return result;
}throw  new java.util.ConcurrentModificationException();
}, "java.util.Collection");
Clazz_defineMethod(c$, "get", 
function(location){
if (this.modCount == this.fullList.modCount) {
if (0 <= location && location < this.$size) {
return this.fullList.get(location + this.offset);
}throw  new IndexOutOfBoundsException();
}throw  new java.util.ConcurrentModificationException();
}, "~N");
Clazz_overrideMethod(c$, "iterator", 
function(){
return this.listIterator(0);
});
Clazz_defineMethod(c$, "listIterator", 
function(location){
if (this.modCount == this.fullList.modCount) {
if (0 <= location && location <= this.$size) {
return  new java.util.AbstractList.SubAbstractList.SubAbstractListIterator(this.fullList.listIterator(location + this.offset), this, this.offset, this.$size);
}throw  new IndexOutOfBoundsException();
}throw  new java.util.ConcurrentModificationException();
}, "~N");
Clazz_defineMethod(c$, "remove", 
function(location){
if (this.modCount == this.fullList.modCount) {
if (0 <= location && location < this.$size) {
var result = this.fullList.remove(location + this.offset);
this.$size--;
this.modCount = this.fullList.modCount;
return result;
}throw  new IndexOutOfBoundsException();
}throw  new java.util.ConcurrentModificationException();
}, "~N");
Clazz_defineMethod(c$, "removeRange", 
function(start, end){
if (start != end) {
if (this.modCount == this.fullList.modCount) {
this.fullList.removeRange(start + this.offset, end + this.offset);
this.$size -= end - start;
this.modCount = this.fullList.modCount;
} else {
throw  new java.util.ConcurrentModificationException();
}}}, "~N,~N");
Clazz_defineMethod(c$, "set", 
function(location, object){
if (this.modCount == this.fullList.modCount) {
if (0 <= location && location < this.$size) {
return this.fullList.set(location + this.offset, object);
}throw  new IndexOutOfBoundsException();
}throw  new java.util.ConcurrentModificationException();
}, "~N,~O");
Clazz_overrideMethod(c$, "size", 
function(){
return this.$size;
});
Clazz_defineMethod(c$, "sizeChanged", 
function(increment){
if (increment) {
this.$size++;
} else {
this.$size--;
}this.modCount = this.fullList.modCount;
}, "~B");
/*if3*/;(function(){
var c$ = Clazz_decorateAsClass(function(){
this.subList = null;
this.iterator = null;
this.start = 0;
this.end = 0;
Clazz_instantialize(this, arguments);}, java.util.AbstractList.SubAbstractList, "SubAbstractListIterator", null, java.util.ListIterator);
Clazz_makeConstructor(c$, 
function(it, list, offset, length){
this.iterator = it;
this.subList = list;
this.start = offset;
this.end = this.start + length;
}, "java.util.ListIterator,java.util.AbstractList.SubAbstractList,~N,~N");
Clazz_defineMethod(c$, "add", 
function(object){
this.iterator.add(object);
this.subList.sizeChanged(true);
this.end++;
}, "~O");
Clazz_overrideMethod(c$, "hasNext", 
function(){
return this.iterator.nextIndex() < this.end;
});
Clazz_overrideMethod(c$, "hasPrevious", 
function(){
return this.iterator.previousIndex() >= this.start;
});
Clazz_defineMethod(c$, "next", 
function(){
if (this.iterator.nextIndex() < this.end) {
return this.iterator.next();
}throw  new java.util.NoSuchElementException();
});
Clazz_defineMethod(c$, "nextIndex", 
function(){
return this.iterator.nextIndex() - this.start;
});
Clazz_defineMethod(c$, "previous", 
function(){
if (this.iterator.previousIndex() >= this.start) {
return this.iterator.previous();
}throw  new java.util.NoSuchElementException();
});
Clazz_defineMethod(c$, "previousIndex", 
function(){
var previous = this.iterator.previousIndex();
if (previous >= this.start) {
return previous - this.start;
}return -1;
});
Clazz_defineMethod(c$, "remove", 
function(){
this.iterator.remove();
this.subList.sizeChanged(false);
this.end--;
});
Clazz_defineMethod(c$, "set", 
function(object){
this.iterator.set(object);
}, "~O");
/*eoif3*/})();
/*eoif3*/})();
});
;//5.0.1-v7 Fri Nov 21 04:39:22 CST 2025
Clazz_load(["java.util.Map"], "java.util.AbstractMap", ["java.util.AbstractCollection", "$.AbstractSet", "$.Iterator"], function(){
var c$ = Clazz_decorateAsClass(function(){
this.$keySet = null;
this.$values = null;
Clazz_instantialize(this, arguments);}, java.util, "AbstractMap", null, java.util.Map);
Clazz_overrideMethod(c$, "clear", 
function(){
this.entrySet().clear();
});
Clazz_overrideMethod(c$, "containsKey", 
function(key){
var it = this.entrySet().iterator();
if (key != null) {
while (it.hasNext()) {
if (key.equals(it.next().getKey())) {
return true;
}}
} else {
while (it.hasNext()) {
if (it.next().getKey() == null) {
return true;
}}
}return false;
}, "~O");
Clazz_overrideMethod(c$, "containsValue", 
function(value){
var it = this.entrySet().iterator();
if (value != null) {
while (it.hasNext()) {
if (value.equals(it.next().getValue())) {
return true;
}}
} else {
while (it.hasNext()) {
if (it.next().getValue() == null) {
return true;
}}
}return false;
}, "~O");
Clazz_overrideMethod(c$, "equals", 
function(object){
if (this === object) {
return true;
}if (Clazz_instanceOf(object,"java.util.Map")) {
var map = object;
if (this.size() != map.size()) {
return false;
}var objectSet = map.entrySet();
var it = this.entrySet().iterator();
while (it.hasNext()) {
if (!objectSet.contains(it.next())) {
return false;
}}
return true;
}return false;
}, "~O");
Clazz_overrideMethod(c$, "get", 
function(key){
var it = this.entrySet().iterator();
if (key != null) {
while (it.hasNext()) {
var entry = it.next();
if (key.equals(entry.getKey())) {
return entry.getValue();
}}
} else {
while (it.hasNext()) {
var entry = it.next();
if (entry.getKey() == null) {
return entry.getValue();
}}
}return null;
}, "~O");
Clazz_overrideMethod(c$, "hashCode", 
function(){
var result = 0;
var it = this.entrySet().iterator();
while (it.hasNext()) {
result += it.next().hashCode();
}
return result;
});
Clazz_overrideMethod(c$, "isEmpty", 
function(){
return this.size() == 0;
});
Clazz_overrideMethod(c$, "keySet", 
function(){
if (this.$keySet == null) {
this.$keySet = ((Clazz_isClassDefined("java.util.AbstractMap$1") ? 0 : java.util.AbstractMap.$AbstractMap$1$ ()), Clazz_innerTypeInstance(java.util.AbstractMap$1, this, null));
}return this.$keySet;
});
Clazz_overrideMethod(c$, "put", 
function(key, value){
throw  new UnsupportedOperationException();
}, "~O,~O");
Clazz_overrideMethod(c$, "putAll", 
function(map){
this.putAllAM(map);
}, "java.util.Map");
Clazz_defineMethod(c$, "putAllAM", 
function(map){
if (!map.isEmpty()) for (var entry, $entry = map.entrySet().iterator (); $entry.hasNext()&& ((entry = $entry.next ()) || true);) {
this.put(entry.getKey(), entry.getValue());
}
}, "java.util.Map");
Clazz_overrideMethod(c$, "remove", 
function(key){
var it = this.entrySet().iterator();
if (key != null) {
while (it.hasNext()) {
var entry = it.next();
if (key.equals(entry.getKey())) {
it.remove();
return entry.getValue();
}}
} else {
while (it.hasNext()) {
var entry = it.next();
if (entry.getKey() == null) {
it.remove();
return entry.getValue();
}}
}return null;
}, "~O");
Clazz_overrideMethod(c$, "size", 
function(){
return this.entrySet().size();
});
Clazz_overrideMethod(c$, "toString", 
function(){
if (this.isEmpty()) {
return "{}";
}var buffer = "{";
var it = this.entrySet().iterator();
while (it.hasNext()) {
var entry = it.next();
var key = entry.getKey();
if (key !== this) {
buffer += (key);
} else {
buffer += ("(this Map)");
}buffer += ('=');
var value = entry.getValue();
if (value !== this) {
buffer += (value);
} else {
buffer += ("(this Map)");
}if (it.hasNext()) {
buffer += (", ");
}}
buffer += ('}');
return buffer;
});
Clazz_overrideMethod(c$, "values", 
function(){
if (this.$values == null) {
this.$values = ((Clazz_isClassDefined("java.util.AbstractMap$2") ? 0 : java.util.AbstractMap.$AbstractMap$2$ ()), Clazz_innerTypeInstance(java.util.AbstractMap$2, this, null));
}return this.$values;
});
Clazz_defineMethod(c$, "clone", 
function(){
return this.cloneAM();
});
Clazz_defineMethod(c$, "cloneAM", 
function(){
var result;
{
result = Clazz_clone(this);
}result.$keySet = null;
result.$values = null;
return result;
});
c$.$AbstractMap$1$=function(){
/*if5*/;(function(){
var c$ = Clazz_declareAnonymous(java.util, "AbstractMap$1", java.util.AbstractSet);
Clazz_overrideMethod(c$, "contains", 
function(object){
return this.b$["java.util.AbstractMap"].containsKey(object);
}, "~O");
Clazz_overrideMethod(c$, "size", 
function(){
return this.b$["java.util.AbstractMap"].size();
});
Clazz_overrideMethod(c$, "iterator", 
function(){
return ((Clazz_isClassDefined("java.util.AbstractMap$1$1") ? 0 : java.util.AbstractMap.$AbstractMap$1$1$ ()), Clazz_innerTypeInstance(java.util.AbstractMap$1$1, this, null));
});
/*eoif5*/})();
};
c$.$AbstractMap$1$1$=function(){
/*if5*/;(function(){
var c$ = Clazz_decorateAsClass(function(){
Clazz_prepareCallback(this, arguments);
this.setIterator = null;
Clazz_instantialize(this, arguments);}, java.util, "AbstractMap$1$1", null, java.util.Iterator);
Clazz_prepareFields (c$, function(){
this.setIterator = this.b$["java.util.AbstractMap"].entrySet().iterator();
});
Clazz_overrideMethod(c$, "hasNext", 
function(){
return this.setIterator.hasNext();
});
Clazz_overrideMethod(c$, "next", 
function(){
return this.setIterator.next().getKey();
});
Clazz_overrideMethod(c$, "remove", 
function(){
this.setIterator.remove();
});
/*eoif5*/})();
};
c$.$AbstractMap$2$=function(){
/*if5*/;(function(){
var c$ = Clazz_declareAnonymous(java.util, "AbstractMap$2", java.util.AbstractCollection);
Clazz_overrideMethod(c$, "size", 
function(){
return this.b$["java.util.AbstractMap"].size();
});
Clazz_overrideMethod(c$, "contains", 
function(object){
return this.b$["java.util.AbstractMap"].containsValue(object);
}, "~O");
Clazz_overrideMethod(c$, "iterator", 
function(){
return ((Clazz_isClassDefined("java.util.AbstractMap$2$1") ? 0 : java.util.AbstractMap.$AbstractMap$2$1$ ()), Clazz_innerTypeInstance(java.util.AbstractMap$2$1, this, null));
});
/*eoif5*/})();
};
c$.$AbstractMap$2$1$=function(){
/*if5*/;(function(){
var c$ = Clazz_decorateAsClass(function(){
Clazz_prepareCallback(this, arguments);
this.setIterator = null;
Clazz_instantialize(this, arguments);}, java.util, "AbstractMap$2$1", null, java.util.Iterator);
Clazz_prepareFields (c$, function(){
this.setIterator = this.b$["java.util.AbstractMap"].entrySet().iterator();
});
Clazz_overrideMethod(c$, "hasNext", 
function(){
return this.setIterator.hasNext();
});
Clazz_overrideMethod(c$, "next", 
function(){
return this.setIterator.next().getValue();
});
Clazz_overrideMethod(c$, "remove", 
function(){
this.setIterator.remove();
});
/*eoif5*/})();
};
});
;//5.0.1-v7 Fri Nov 21 04:39:22 CST 2025
Clazz_load(["java.util.AbstractCollection", "$.Set"], "java.util.AbstractSet", null, function(){
var c$ = Clazz_declareType(java.util, "AbstractSet", java.util.AbstractCollection, java.util.Set);
Clazz_overrideMethod(c$, "equals", 
function(object){
if (this === object) {
return true;
}if (Clazz_instanceOf(object,"java.util.Set")) {
var s = object;
return this.size() == s.size() && this.containsAll(s);
}return false;
}, "~O");
Clazz_overrideMethod(c$, "hashCode", 
function(){
var result = 0;
var it = this.iterator();
while (it.hasNext()) {
var next = it.next();
result += next == null ? 0 : next.hashCode();
}
return result;
});
Clazz_overrideMethod(c$, "removeAll", 
function(collection){
var result = false;
if (this.size() <= collection.size()) {
var it = this.iterator();
while (it.hasNext()) {
if (collection.contains(it.next())) {
it.remove();
result = true;
}}
} else {
var it = collection.iterator();
while (it.hasNext()) {
result = this.remove(it.next()) || result;
}
}return result;
}, "java.util.Collection");
});
;//5.0.1-v7 Fri Nov 21 04:39:22 CST 2025
Clazz_load(["java.util.AbstractList", "$.List", "$.RandomAccess"], "java.util.ArrayList", ["java.util.Arrays"], function(){
var c$ = Clazz_decorateAsClass(function(){
this.firstIndex = 0;
this.lastIndex = 0;
this.array = null;
Clazz_instantialize(this, arguments);}, java.util, "ArrayList", java.util.AbstractList, [java.util.List, Cloneable, java.io.Serializable, java.util.RandomAccess]);
Clazz_makeConstructor(c$, 
function(){
Clazz_superConstructor (this, java.util.ArrayList, []);
this.setCapacity(0);
});
Clazz_makeConstructor(c$, 
function(capacity){
Clazz_superConstructor (this, java.util.ArrayList, []);
this.setCapacity(capacity);
}, "~N");
Clazz_makeConstructor(c$, 
function(collection){
this.firstIndex = this.lastIndex = 0;
var n = -1;
{
if (!collection) {
n = 0;
} else if (typeof collection == "number") {
n = collection;
}
}if (n >= 0) {
this.setCapacity(n);
return;
}var size = collection.size();
this.array = this.newElementArray(size + (Clazz_doubleToInt(size / 10)));
this.addAll(collection);
}, "java.util.Collection");
Clazz_defineMethod(c$, "setCapacity", 
function(capacity){
try {
this.array = this.newElementArray(capacity);
} catch (e) {
if (Clazz_exceptionOf(e,"NegativeArraySizeException")){
throw  new IllegalArgumentException();
} else {
throw e;
}
}
}, "~N");
Clazz_defineMethod(c$, "newElementArray", 
function(size){
return  new Array(size);
}, "~N");
Clazz_defineMethod(c$, "add", 
function(location, object){
this.add2(location, object);
}, "~N,~O");
Clazz_defineMethod(c$, "add2", 
function(location, object){
var size = this.size();
if (0 < location && location < size) {
if (this.firstIndex == 0 && this.lastIndex == this.array.length) {
this.growForInsert(location, 1);
} else if ((location < Clazz_doubleToInt(size / 2) && this.firstIndex > 0) || this.lastIndex == this.array.length) {
System.arraycopy(this.array, this.firstIndex, this.array, --this.firstIndex, location);
} else {
var index = location + this.firstIndex;
System.arraycopy(this.array, index, this.array, index + 1, size - location);
this.lastIndex++;
}this.array[location + this.firstIndex] = object;
} else if (location == 0) {
if (this.firstIndex == 0) {
this.growAtFront(1);
}this.array[--this.firstIndex] = object;
} else if (location == size) {
if (this.lastIndex == this.array.length) {
this.growAtEnd(1);
}this.array[this.lastIndex++] = object;
} else {
throw  new IndexOutOfBoundsException();
}this.modCount++;
}, "~N,~O");
Clazz_defineMethod(c$, "add", 
function(object){
return this.add1(object);
}, "~O");
Clazz_defineMethod(c$, "add1", 
function(object){
if (this.lastIndex == this.array.length) {
this.growAtEnd(1);
}this.array[this.lastIndex++] = object;
this.modCount++;
return true;
}, "~O");
Clazz_defineMethod(c$, "addAll", 
function(location, collection){
var size = this.size();
if (location < 0 || location > size) {
throw  new IndexOutOfBoundsException();
}var growSize = collection.size();
if (0 < location && location < size) {
if (this.array.length - size < growSize) {
this.growForInsert(location, growSize);
} else if ((location < Clazz_doubleToInt(size / 2) && this.firstIndex > 0) || this.lastIndex > this.array.length - growSize) {
var newFirst = this.firstIndex - growSize;
if (newFirst < 0) {
var index = location + this.firstIndex;
System.arraycopy(this.array, index, this.array, index - newFirst, size - location);
this.lastIndex -= newFirst;
newFirst = 0;
}System.arraycopy(this.array, this.firstIndex, this.array, newFirst, location);
this.firstIndex = newFirst;
} else {
var index = location + this.firstIndex;
System.arraycopy(this.array, index, this.array, index + growSize, size - location);
this.lastIndex += growSize;
}} else if (location == 0) {
this.growAtFront(growSize);
this.firstIndex -= growSize;
} else if (location == size) {
if (this.lastIndex > this.array.length - growSize) {
this.growAtEnd(growSize);
}this.lastIndex += growSize;
}if (growSize > 0) {
var it = collection.iterator();
var index = location + this.firstIndex;
var end = index + growSize;
while (index < end) {
this.array[index++] = it.next();
}
this.modCount++;
return true;
}return false;
}, "~N,java.util.Collection");
Clazz_defineMethod(c$, "addAll", 
function(collection){
var growSize = collection.size();
if (growSize > 0) {
if (this.lastIndex > this.array.length - growSize) {
this.growAtEnd(growSize);
}var it = collection.iterator();
var end = this.lastIndex + growSize;
while (this.lastIndex < end) {
this.array[this.lastIndex++] = it.next();
}
this.modCount++;
return true;
}return false;
}, "java.util.Collection");
Clazz_overrideMethod(c$, "clear", 
function(){
if (this.firstIndex != this.lastIndex) {
java.util.Arrays.fill(this.array, this.firstIndex, this.lastIndex, null);
this.firstIndex = this.lastIndex = 0;
this.modCount++;
}});
Clazz_defineMethod(c$, "clone", 
function(){
try {
var newList = Clazz_superCall(this, java.util.ArrayList, "clone", []);
newList.array = this.array.clone();
return newList;
} catch (e) {
if (Clazz_exceptionOf(e,"CloneNotSupportedException")){
return null;
} else {
throw e;
}
}
});
Clazz_overrideMethod(c$, "contains", 
function(object){
if (object != null) {
for (var i = this.firstIndex; i < this.lastIndex; i++) {
if (object.equals(this.array[i])) {
return true;
}}
} else {
for (var i = this.firstIndex; i < this.lastIndex; i++) {
if (this.array[i] == null) {
return true;
}}
}return false;
}, "~O");
Clazz_defineMethod(c$, "ensureCapacity", 
function(minimumCapacity){
if (this.array.length < minimumCapacity) {
if (this.firstIndex > 0) {
this.growAtFront(minimumCapacity - this.array.length);
} else {
this.growAtEnd(minimumCapacity - this.array.length);
}}}, "~N");
Clazz_overrideMethod(c$, "get", 
function(location){
if (0 <= location && location < this.size()) {
return this.array[this.firstIndex + location];
}throw  new IndexOutOfBoundsException();
}, "~N");
Clazz_defineMethod(c$, "growAtEnd", 
function(required){
var size = this.size();
if (this.firstIndex >= required - (this.array.length - this.lastIndex)) {
var newLast = this.lastIndex - this.firstIndex;
if (size > 0) {
System.arraycopy(this.array, this.firstIndex, this.array, 0, size);
var start = newLast < this.firstIndex ? this.firstIndex : newLast;
java.util.Arrays.fill(this.array, start, this.array.length, null);
}this.firstIndex = 0;
this.lastIndex = newLast;
} else {
var increment = Clazz_doubleToInt(size / 2);
if (required > increment) {
increment = required;
}if (increment < 12) {
increment = 12;
}var newArray = this.newElementArray(size + increment);
if (size > 0) {
System.arraycopy(this.array, this.firstIndex, newArray, this.firstIndex, size);
}this.array = newArray;
}}, "~N");
Clazz_defineMethod(c$, "growAtFront", 
function(required){
var size = this.size();
if (this.array.length - this.lastIndex >= required) {
var newFirst = this.array.length - size;
if (size > 0) {
System.arraycopy(this.array, this.firstIndex, this.array, newFirst, size);
var length = this.firstIndex + size > newFirst ? newFirst : this.firstIndex + size;
java.util.Arrays.fill(this.array, this.firstIndex, length, null);
}this.firstIndex = newFirst;
this.lastIndex = this.array.length;
} else {
var increment = Clazz_doubleToInt(size / 2);
if (required > increment) {
increment = required;
}if (increment < 12) {
increment = 12;
}var newArray = this.newElementArray(size + increment);
if (size > 0) {
System.arraycopy(this.array, this.firstIndex, newArray, newArray.length - size, size);
}this.firstIndex = newArray.length - size;
this.lastIndex = newArray.length;
this.array = newArray;
}}, "~N");
Clazz_defineMethod(c$, "growForInsert", 
function(location, required){
var size = this.size();
var increment = Clazz_doubleToInt(size / 2);
if (required > increment) {
increment = required;
}if (increment < 12) {
increment = 12;
}var newArray = this.newElementArray(size + increment);
if (location < Clazz_doubleToInt(size / 2)) {
var newFirst = newArray.length - (size + required);
System.arraycopy(this.array, location, newArray, location + increment, size - location);
System.arraycopy(this.array, this.firstIndex, newArray, newFirst, location);
this.firstIndex = newFirst;
this.lastIndex = newArray.length;
} else {
System.arraycopy(this.array, this.firstIndex, newArray, 0, location);
System.arraycopy(this.array, location, newArray, location + required, size - location);
this.firstIndex = 0;
this.lastIndex += required;
}this.array = newArray;
}, "~N,~N");
Clazz_overrideMethod(c$, "indexOf", 
function(object){
if (object != null) {
for (var i = this.firstIndex; i < this.lastIndex; i++) {
if (object.equals(this.array[i])) {
return i - this.firstIndex;
}}
} else {
for (var i = this.firstIndex; i < this.lastIndex; i++) {
if (this.array[i] == null) {
return i - this.firstIndex;
}}
}return -1;
}, "~O");
Clazz_overrideMethod(c$, "isEmpty", 
function(){
return this.lastIndex == this.firstIndex;
});
Clazz_overrideMethod(c$, "lastIndexOf", 
function(object){
if (object != null) {
for (var i = this.lastIndex - 1; i >= this.firstIndex; i--) {
if (object.equals(this.array[i])) {
return i - this.firstIndex;
}}
} else {
for (var i = this.lastIndex - 1; i >= this.firstIndex; i--) {
if (this.array[i] == null) {
return i - this.firstIndex;
}}
}return -1;
}, "~O");
Clazz_defineMethod(c$, "remove", 
function(location){
{
}return this._removeItemAt(location);
}, "~N");
Clazz_defineMethod(c$, "_removeObject", 
function(o){
var i = this.indexOf(o);
if (i < 0) return false;
this._removeItemAt(i);
return true;
}, "~O");
Clazz_defineMethod(c$, "_removeItemAt", 
function(location){
var result;
var size = this.size();
if (0 <= location && location < size) {
if (location == size - 1) {
result = this.array[--this.lastIndex];
this.array[this.lastIndex] = null;
} else if (location == 0) {
result = this.array[this.firstIndex];
this.array[this.firstIndex++] = null;
} else {
var elementIndex = this.firstIndex + location;
result = this.array[elementIndex];
if (location < Clazz_doubleToInt(size / 2)) {
System.arraycopy(this.array, this.firstIndex, this.array, this.firstIndex + 1, location);
this.array[this.firstIndex++] = null;
} else {
System.arraycopy(this.array, elementIndex + 1, this.array, elementIndex, size - location - 1);
this.array[--this.lastIndex] = null;
}}} else {
throw  new IndexOutOfBoundsException();
}this.modCount++;
return result;
}, "~N");
Clazz_overrideMethod(c$, "removeRange", 
function(start, end){
if (start >= 0 && start <= end && end <= this.size()) {
if (start == end) {
return;
}var size = this.size();
if (end == size) {
java.util.Arrays.fill(this.array, this.firstIndex + start, this.lastIndex, null);
this.lastIndex = this.firstIndex + start;
} else if (start == 0) {
java.util.Arrays.fill(this.array, this.firstIndex, this.firstIndex + end, null);
this.firstIndex += end;
} else {
System.arraycopy(this.array, this.firstIndex + end, this.array, this.firstIndex + start, size - end);
var newLast = this.lastIndex + start - end;
java.util.Arrays.fill(this.array, newLast, this.lastIndex, null);
this.lastIndex = newLast;
}this.modCount++;
} else {
throw  new IndexOutOfBoundsException();
}}, "~N,~N");
Clazz_overrideMethod(c$, "set", 
function(location, object){
if (0 <= location && location < this.size()) {
var result = this.array[this.firstIndex + location];
this.array[this.firstIndex + location] = object;
return result;
}throw  new IndexOutOfBoundsException();
}, "~N,~O");
Clazz_overrideMethod(c$, "size", 
function(){
return this.lastIndex - this.firstIndex;
});
Clazz_overrideMethod(c$, "toArray", 
function(contents){
var size = this.size();
if (contents == null || size > contents.length) {
{
return this.array.slice(this.firstIndex, this.firstIndex + size);
}}System.arraycopy(this.array, this.firstIndex, contents, 0, size);
if (size < contents.length) {
contents[size] = null;
}return contents;
}, "~A");
Clazz_defineMethod(c$, "trimToSize", 
function(){
var size = this.size();
var newArray = this.newElementArray(size);
System.arraycopy(this.array, this.firstIndex, newArray, 0, size);
this.array = newArray;
this.firstIndex = 0;
this.lastIndex = this.array.length;
});
});
;//5.0.1-v7 Fri Nov 21 04:39:22 CST 2025
Clazz_load(["java.util.AbstractList", "$.RandomAccess"], "java.util.Arrays", null, function(){
var c$ = Clazz_declareType(java.util, "Arrays", null);
c$.fill = Clazz_defineMethod(c$, "fill", 
function(a, fromIndex, toIndex, val){
{
if (arguments.length == 2) {
val = arguments[1];
fromIndex = 0;
toIndex = a.length;
}
}java.util.Arrays.rangeCheck(a.length, fromIndex, toIndex);
for (var i = fromIndex; i < toIndex; i++) a[i] = val;

}, "~A,~N,~N,~O");
c$.asList = Clazz_defineMethod(c$, "asList", 
function(a){
return  new java.util.Arrays.ArrayList(a);
}, "~A");
c$.rangeCheck = Clazz_defineMethod(c$, "rangeCheck", 
function(arrayLen, fromIndex, toIndex){
if (fromIndex > toIndex) throw  new IllegalArgumentException("fromIndex(" + fromIndex + ") > toIndex(" + toIndex + ")");
if (fromIndex < 0) throw  new ArrayIndexOutOfBoundsException(fromIndex);
if (toIndex > arrayLen) throw  new ArrayIndexOutOfBoundsException(toIndex);
}, "~N,~N,~N");
c$.binarySearch = Clazz_defineMethod(c$, "binarySearch", 
function(a, key){
var low = 0;
var high = a.length - 1;
while (low <= high) {
var mid = (low + high) >> 1;
var midVal = a[mid];
if (midVal < key) low = mid + 1;
 else if (midVal > key) high = mid - 1;
 else return mid;
}
return -(low + 1);
}, "~A,~N");
c$.binarySearch = Clazz_defineMethod(c$, "binarySearch", 
function(a, key){
var low = 0;
var high = a.length - 1;
while (low <= high) {
var mid = (low + high) >> 1;
var midVal = a[mid];
var cmp = (midVal).compareTo(key);
if (cmp < 0) low = mid + 1;
 else if (cmp > 0) high = mid - 1;
 else return mid;
}
return -(low + 1);
}, "~A,~O");
c$.binarySearch = Clazz_defineMethod(c$, "binarySearch", 
function(a, key, c){
if (c == null) return java.util.Arrays.binarySearch(a, key);
var low = 0;
var high = a.length - 1;
while (low <= high) {
var mid = (low + high) >> 1;
var midVal = a[mid];
var cmp = c.compare(midVal, key);
if (cmp < 0) low = mid + 1;
 else if (cmp > 0) high = mid - 1;
 else return mid;
}
return -(low + 1);
}, "~A,~O,java.util.Comparator");
c$.equals = Clazz_defineMethod(c$, "equals", 
function(a, a2){
if (a === a2) return true;
if (a == null || a2 == null) return false;
var length = a.length;
if (a2.length != length) return false;
for (var i = 0; i < length; i++) {
var o1 = a[i];
var o2 = a2[i];
{
if(!(o1==null?o2==null:(o1.equals==null?o1==o2:o1.equals(o2))))return false;
}}
return true;
}, "~A,~A");
c$.sort = Clazz_defineMethod(c$, "sort", 
function(a, fromIndex, toIndex, c){
if (a.length < 2) return;
var n = 0;
var p = null;
{
n = arguments.length; p = fromIndex;
}var temp = a;
var ret = null;
switch (n) {
case 1:
p = null;
case 2:
fromIndex = 0;
toIndex = a.length;
break;
case 3:
c = null;
case 4:
p = c;
if (fromIndex == 0 && toIndex == a.length) {
temp = a;
} else {
{
temp = a.slice(fromIndex, toIndex);
}ret = a;
}break;
}
java.util.Arrays.rangeCheck(a.length, fromIndex, toIndex);
if (p == null) p = java.util.Arrays.comp;
c = p;
{
temp.sort(function(a,b){return c.compare(a,b)});
}if (ret != null) {
System.arraycopy(temp, 0, ret, fromIndex, toIndex);
}}, "~A,~N,~N,java.util.Comparator");
/*if3*/;(function(){
var c$ = Clazz_decorateAsClass(function(){
this.a = null;
Clazz_instantialize(this, arguments);}, java.util.Arrays, "ArrayList", java.util.AbstractList, [java.util.RandomAccess, java.io.Serializable]);
Clazz_makeConstructor(c$, 
function(array){
Clazz_superConstructor (this, java.util.Arrays.ArrayList, []);
if (array == null) throw  new NullPointerException();
this.a = array;
}, "~A");
Clazz_overrideMethod(c$, "size", 
function(){
return this.a.length;
});
Clazz_defineMethod(c$, "toArray", 
function(){
return this.a.clone();
});
Clazz_overrideMethod(c$, "get", 
function(index){
return this.a[index];
}, "~N");
Clazz_overrideMethod(c$, "set", 
function(index, element){
var oldValue = this.a[index];
this.a[index] = element;
return oldValue;
}, "~N,~O");
Clazz_overrideMethod(c$, "indexOf", 
function(o){
if (o == null) {
for (var i = 0; i < this.a.length; i++) if (this.a[i] == null) return i;

} else {
for (var i = 0; i < this.a.length; i++) if (o.equals(this.a[i])) return i;

}return -1;
}, "~O");
Clazz_overrideMethod(c$, "contains", 
function(o){
return this.indexOf(o) != -1;
}, "~O");
/*eoif3*/})();
c$.comp = null;
{
c$.comp = {compare: function (o1, o2) {
return (o1 == null ? (o2 == null ? 0 : -1) : o2 == null ? 1
: typeof o1 == "number" ? o1 - o2 : o1.compareTo(o2))}};
}});
;//5.0.1-v7 Fri Nov 21 04:39:22 CST 2025
Clazz_load(["java.util.AbstractList", "$.AbstractMap", "$.AbstractSet", "$.Collection", "$.Enumeration", "$.Iterator", "$.List", "$.ListIterator", "$.Map", "$.RandomAccess", "$.Set", "$.SortedMap", "$.SortedSet", "java.lang.reflect.Array"], "java.util.Collections", ["java.util.ArrayList", "$.Arrays", "java.util.Map.Entry", "java.util.Random"], function(){
var c$ = Clazz_declareType(java.util, "Collections", null);
c$.emptyEnumeration = Clazz_defineMethod(c$, "emptyEnumeration", 
function(){
if (java.util.Collections.EMPTY_ENUMERATION == null) java.util.Collections.EMPTY_ENUMERATION =  new java.util.Collections.EmptyEnumeration();
return java.util.Collections.EMPTY_ENUMERATION;
});
c$.emptyIterator = Clazz_defineMethod(c$, "emptyIterator", 
function(){
if (java.util.Collections.EMPTY_ITERATOR == null) {
java.util.Collections.EMPTY_ITERATOR =  new java.util.Collections.EmptyIterator();
}return java.util.Collections.EMPTY_ITERATOR;
});
c$.binarySearch = Clazz_defineMethod(c$, "binarySearch", 
function(list, object){
if (list == null) {
throw  new NullPointerException();
}if (list.isEmpty()) {
return -1;
}var key = object;
if (!(Clazz_instanceOf(list,"java.util.RandomAccess"))) {
var it = list.listIterator();
while (it.hasNext()) {
var result;
if ((result = key.compareTo(it.next())) <= 0) {
if (result == 0) {
return it.previousIndex();
}return -it.previousIndex() - 1;
}}
return -list.size() - 1;
}var low = 0;
var mid = list.size();
var high = mid - 1;
var result = -1;
while (low <= high) {
mid = (low + high) >> 1;
if ((result = key.compareTo(list.get(mid))) > 0) {
low = mid + 1;
} else if (result == 0) {
return mid;
} else {
high = mid - 1;
}}
return -mid - (result < 0 ? 1 : 2);
}, "java.util.List,~O");
c$.binarySearch = Clazz_defineMethod(c$, "binarySearch", 
function(list, object, comparator){
if (comparator == null) {
return java.util.Collections.binarySearch(list, object);
}if (!(Clazz_instanceOf(list,"java.util.RandomAccess"))) {
var it = list.listIterator();
while (it.hasNext()) {
var result;
if ((result = comparator.compare(object, it.next())) <= 0) {
if (result == 0) {
return it.previousIndex();
}return -it.previousIndex() - 1;
}}
return -list.size() - 1;
}var low = 0;
var mid = list.size();
var high = mid - 1;
var result = -1;
while (low <= high) {
mid = (low + high) >> 1;
if ((result = comparator.compare(object, list.get(mid))) > 0) {
low = mid + 1;
} else if (result == 0) {
return mid;
} else {
high = mid - 1;
}}
return -mid - (result < 0 ? 1 : 2);
}, "java.util.List,~O,java.util.Comparator");
c$.copy = Clazz_defineMethod(c$, "copy", 
function(destination, source){
if (destination.size() < source.size()) {
throw  new ArrayIndexOutOfBoundsException();
}var srcIt = source.iterator();
var destIt = destination.listIterator();
while (srcIt.hasNext()) {
try {
destIt.next();
} catch (e) {
if (Clazz_exceptionOf(e,"java.util.NoSuchElementException")){
throw  new ArrayIndexOutOfBoundsException();
} else {
throw e;
}
}
destIt.set(srcIt.next());
}
}, "java.util.List,java.util.List");
c$.enumeration = Clazz_defineMethod(c$, "enumeration", 
function(collection){
var c = collection;
return ((Clazz_isClassDefined("java.util.Collections$1") ? 0 : java.util.Collections.$Collections$1$ ()), Clazz_innerTypeInstance(java.util.Collections$1, this, Clazz_cloneFinals("c", c)));
}, "java.util.Collection");
c$.fill = Clazz_defineMethod(c$, "fill", 
function(list, object){
var it = list.listIterator();
while (it.hasNext()) {
it.next();
it.set(object);
}
}, "java.util.List,~O");
c$.max = Clazz_defineMethod(c$, "max", 
function(collection){
var it = collection.iterator();
var max = it.next();
while (it.hasNext()) {
var next = it.next();
if (max.compareTo(next) < 0) {
max = next;
}}
return max;
}, "java.util.Collection");
c$.max = Clazz_defineMethod(c$, "max", 
function(collection, comparator){
var it = collection.iterator();
var max = it.next();
while (it.hasNext()) {
var next = it.next();
if (comparator.compare(max, next) < 0) {
max = next;
}}
return max;
}, "java.util.Collection,java.util.Comparator");
c$.min = Clazz_defineMethod(c$, "min", 
function(collection){
var it = collection.iterator();
var min = it.next();
while (it.hasNext()) {
var next = it.next();
if (min.compareTo(next) > 0) {
min = next;
}}
return min;
}, "java.util.Collection");
c$.min = Clazz_defineMethod(c$, "min", 
function(collection, comparator){
var it = collection.iterator();
var min = it.next();
while (it.hasNext()) {
var next = it.next();
if (comparator.compare(min, next) > 0) {
min = next;
}}
return min;
}, "java.util.Collection,java.util.Comparator");
c$.nCopies = Clazz_defineMethod(c$, "nCopies", 
function(length, object){
return  new java.util.Collections.CopiesList(length, object);
}, "~N,~O");
c$.reverse = Clazz_defineMethod(c$, "reverse", 
function(list){
var size = list.size();
var front = list.listIterator();
var back = list.listIterator(size);
for (var i = 0; i < Clazz_doubleToInt(size / 2); i++) {
var frontNext = front.next();
var backPrev = back.previous();
front.set(backPrev);
back.set(frontNext);
}
}, "java.util.List");
c$.reverseOrder = Clazz_defineMethod(c$, "reverseOrder", 
function(){
return  new java.util.Collections.ReverseComparator();
});
c$.reverseOrder = Clazz_defineMethod(c$, "reverseOrder", 
function(c){
if (c == null) {
return java.util.Collections.reverseOrder();
}return  new java.util.Collections.ReverseComparatorWithComparator(c);
}, "java.util.Comparator");
c$.shuffle = Clazz_defineMethod(c$, "shuffle", 
function(list){
java.util.Collections.shuffle(list,  new java.util.Random());
}, "java.util.List");
c$.shuffle = Clazz_defineMethod(c$, "shuffle", 
function(list, random){
if (!(Clazz_instanceOf(list,"java.util.RandomAccess"))) {
var array = list.toArray();
for (var i = array.length - 1; i > 0; i--) {
var index = random.nextInt() % (i + 1);
if (index < 0) {
index = -index;
}var temp = array[i];
array[i] = array[index];
array[index] = temp;
}
var i = 0;
var it = list.listIterator();
while (it.hasNext()) {
it.next();
it.set(array[i++]);
}
} else {
var rawList = list;
for (var i = rawList.size() - 1; i > 0; i--) {
var index = random.nextInt() % (i + 1);
if (index < 0) {
index = -index;
}rawList.set(index, rawList.set(i, rawList.get(index)));
}
}}, "java.util.List,java.util.Random");
c$.singleton = Clazz_defineMethod(c$, "singleton", 
function(object){
return  new java.util.Collections.SingletonSet(object);
}, "~O");
c$.singletonList = Clazz_defineMethod(c$, "singletonList", 
function(object){
return  new java.util.Collections.SingletonList(object);
}, "~O");
c$.singletonMap = Clazz_defineMethod(c$, "singletonMap", 
function(key, value){
return  new java.util.Collections.SingletonMap(key, value);
}, "~O,~O");
c$.sort = Clazz_defineMethod(c$, "sort", 
function(list){
var array = list.toArray();
java.util.Arrays.sort(array);
var i = 0;
var it = list.listIterator();
while (it.hasNext()) {
it.next();
it.set(array[i++]);
}
}, "java.util.List");
c$.sort = Clazz_defineMethod(c$, "sort", 
function(list, comparator){
var array = list.toArray( new Array(list.size()));
java.util.Arrays.sort(array, comparator);
var i = 0;
var it = list.listIterator();
while (it.hasNext()) {
it.next();
it.set(array[i++]);
}
}, "java.util.List,java.util.Comparator");
c$.swap = Clazz_defineMethod(c$, "swap", 
function(list, index1, index2){
if (list == null) {
throw  new NullPointerException();
}if (index1 == index2) {
return;
}var rawList = list;
rawList.set(index2, rawList.set(index1, rawList.get(index2)));
}, "java.util.List,~N,~N");
c$.replaceAll = Clazz_defineMethod(c$, "replaceAll", 
function(list, obj, obj2){
var index;
var found = false;
while ((index = list.indexOf(obj)) > -1) {
found = true;
list.set(index, obj2);
}
return found;
}, "java.util.List,~O,~O");
c$.rotate = Clazz_defineMethod(c$, "rotate", 
function(lst, dist){
var list = lst;
var size = list.size();
if (size == 0) {
return;
}var normdist;
if (dist > 0) {
normdist = dist % size;
} else {
normdist = size - ((dist % size) * (-1));
}if (normdist == 0 || normdist == size) {
return;
}if (Clazz_instanceOf(list,"java.util.RandomAccess")) {
var temp = list.get(0);
var index = 0;
var beginIndex = 0;
for (var i = 0; i < size; i++) {
index = (index + normdist) % size;
temp = list.set(index, temp);
if (index == beginIndex) {
index = ++beginIndex;
temp = list.get(beginIndex);
}}
} else {
var divideIndex = (size - normdist) % size;
var sublist1 = list.subList(0, divideIndex);
var sublist2 = list.subList(divideIndex, size);
java.util.Collections.reverse(sublist1);
java.util.Collections.reverse(sublist2);
java.util.Collections.reverse(list);
}}, "java.util.List,~N");
c$.indexOfSubList = Clazz_defineMethod(c$, "indexOfSubList", 
function(list, sublist){
var size = list.size();
var sublistSize = sublist.size();
if (sublistSize > size) {
return -1;
}if (sublistSize == 0) {
return 0;
}var firstObj = sublist.get(0);
var index = list.indexOf(firstObj);
if (index == -1) {
return -1;
}while (index < size && (size - index >= sublistSize)) {
var listIt = list.listIterator(index);
if ((firstObj == null) ? listIt.next() == null : firstObj.equals(listIt.next())) {
var sublistIt = sublist.listIterator(1);
var difFound = false;
while (sublistIt.hasNext()) {
var element = sublistIt.next();
if (!listIt.hasNext()) {
return -1;
}if ((element == null) ? listIt.next() != null : !element.equals(listIt.next())) {
difFound = true;
break;
}}
if (!difFound) {
return index;
}}index++;
}
return -1;
}, "java.util.List,java.util.List");
c$.lastIndexOfSubList = Clazz_defineMethod(c$, "lastIndexOfSubList", 
function(list, sublist){
var sublistSize = sublist.size();
var size = list.size();
if (sublistSize > size) {
return -1;
}if (sublistSize == 0) {
return size;
}var lastObj = sublist.get(sublistSize - 1);
var index = list.lastIndexOf(lastObj);
while ((index > -1) && (index + 1 >= sublistSize)) {
var listIt = list.listIterator(index + 1);
if ((lastObj == null) ? listIt.previous() == null : lastObj.equals(listIt.previous())) {
var sublistIt = sublist.listIterator(sublistSize - 1);
var difFound = false;
while (sublistIt.hasPrevious()) {
var element = sublistIt.previous();
if (!listIt.hasPrevious()) {
return -1;
}if ((element == null) ? listIt.previous() != null : !element.equals(listIt.previous())) {
difFound = true;
break;
}}
if (!difFound) {
return listIt.nextIndex();
}}index--;
}
return -1;
}, "java.util.List,java.util.List");
c$.list = Clazz_defineMethod(c$, "list", 
function(enumeration){
var list =  new java.util.ArrayList();
while (enumeration.hasMoreElements()) {
list.add(enumeration.nextElement());
}
return list;
}, "java.util.Enumeration");
c$.synchronizedCollection = Clazz_defineMethod(c$, "synchronizedCollection", 
function(collection){
if (collection == null) {
throw  new NullPointerException();
}return  new java.util.Collections.SynchronizedCollection(collection);
}, "java.util.Collection");
c$.synchronizedList = Clazz_defineMethod(c$, "synchronizedList", 
function(list){
if (list == null) {
throw  new NullPointerException();
}if (Clazz_instanceOf(list,"java.util.RandomAccess")) {
return  new java.util.Collections.SynchronizedRandomAccessList(list);
}return  new java.util.Collections.SynchronizedList(list);
}, "java.util.List");
c$.synchronizedMap = Clazz_defineMethod(c$, "synchronizedMap", 
function(map){
if (map == null) {
throw  new NullPointerException();
}return  new java.util.Collections.SynchronizedMap(map);
}, "java.util.Map");
c$.synchronizedSet = Clazz_defineMethod(c$, "synchronizedSet", 
function(set){
if (set == null) {
throw  new NullPointerException();
}return  new java.util.Collections.SynchronizedSet(set);
}, "java.util.Set");
c$.synchronizedSortedMap = Clazz_defineMethod(c$, "synchronizedSortedMap", 
function(map){
if (map == null) {
throw  new NullPointerException();
}return  new java.util.Collections.SynchronizedSortedMap(map);
}, "java.util.SortedMap");
c$.synchronizedSortedSet = Clazz_defineMethod(c$, "synchronizedSortedSet", 
function(set){
if (set == null) {
throw  new NullPointerException();
}return  new java.util.Collections.SynchronizedSortedSet(set);
}, "java.util.SortedSet");
c$.unmodifiableCollection = Clazz_defineMethod(c$, "unmodifiableCollection", 
function(collection){
if (collection == null) {
throw  new NullPointerException();
}return  new java.util.Collections.UnmodifiableCollection(collection);
}, "java.util.Collection");
c$.unmodifiableList = Clazz_defineMethod(c$, "unmodifiableList", 
function(list){
if (list == null) {
throw  new NullPointerException();
}if (Clazz_instanceOf(list,"java.util.RandomAccess")) {
return  new java.util.Collections.UnmodifiableRandomAccessList(list);
}return  new java.util.Collections.UnmodifiableList(list);
}, "java.util.List");
c$.unmodifiableMap = Clazz_defineMethod(c$, "unmodifiableMap", 
function(map){
if (map == null) {
throw  new NullPointerException();
}return  new java.util.Collections.UnmodifiableMap(map);
}, "java.util.Map");
c$.unmodifiableSet = Clazz_defineMethod(c$, "unmodifiableSet", 
function(set){
if (set == null) {
throw  new NullPointerException();
}return  new java.util.Collections.UnmodifiableSet(set);
}, "java.util.Set");
c$.unmodifiableSortedMap = Clazz_defineMethod(c$, "unmodifiableSortedMap", 
function(map){
if (map == null) {
throw  new NullPointerException();
}return  new java.util.Collections.UnmodifiableSortedMap(map);
}, "java.util.SortedMap");
c$.unmodifiableSortedSet = Clazz_defineMethod(c$, "unmodifiableSortedSet", 
function(set){
if (set == null) {
throw  new NullPointerException();
}return  new java.util.Collections.UnmodifiableSortedSet(set);
}, "java.util.SortedSet");
c$.frequency = Clazz_defineMethod(c$, "frequency", 
function(c, o){
if (c == null) {
throw  new NullPointerException();
}if (c.isEmpty()) {
return 0;
}var result = 0;
var itr = c.iterator();
while (itr.hasNext()) {
var e = itr.next();
if (o == null ? e == null : o.equals(e)) {
result++;
}}
return result;
}, "java.util.Collection,~O");
c$.emptyList = Clazz_defineMethod(c$, "emptyList", 
function(){
return java.util.Collections.EMPTY_LIST;
});
c$.emptySet = Clazz_defineMethod(c$, "emptySet", 
function(){
return java.util.Collections.EMPTY_SET;
});
c$.emptyMap = Clazz_defineMethod(c$, "emptyMap", 
function(){
return java.util.Collections.EMPTY_MAP;
});
c$.checkedCollection = Clazz_defineMethod(c$, "checkedCollection", 
function(c, type){
return  new java.util.Collections.CheckedCollection(c, type);
}, "java.util.Collection,Class");
c$.checkedMap = Clazz_defineMethod(c$, "checkedMap", 
function(m, keyType, valueType){
return  new java.util.Collections.CheckedMap(m, keyType, valueType);
}, "java.util.Map,Class,Class");
c$.checkedList = Clazz_defineMethod(c$, "checkedList", 
function(list, type){
if (Clazz_instanceOf(list,"java.util.RandomAccess")) {
return  new java.util.Collections.CheckedRandomAccessList(list, type);
}return  new java.util.Collections.CheckedList(list, type);
}, "java.util.List,Class");
c$.checkedSet = Clazz_defineMethod(c$, "checkedSet", 
function(s, type){
return  new java.util.Collections.CheckedSet(s, type);
}, "java.util.Set,Class");
c$.checkedSortedMap = Clazz_defineMethod(c$, "checkedSortedMap", 
function(m, keyType, valueType){
return  new java.util.Collections.CheckedSortedMap(m, keyType, valueType);
}, "java.util.SortedMap,Class,Class");
c$.checkedSortedSet = Clazz_defineMethod(c$, "checkedSortedSet", 
function(s, type){
return  new java.util.Collections.CheckedSortedSet(s, type);
}, "java.util.SortedSet,Class");
c$.addAll = Clazz_defineMethod(c$, "addAll", 
function(c, a){
var modified = false;
for (var i = 0; i < a.length; i++) {
modified = new Boolean (modified | c.add(a[i])).valueOf();
}
return modified;
}, "java.util.Collection,~A");
c$.disjoint = Clazz_defineMethod(c$, "disjoint", 
function(c1, c2){
if ((Clazz_instanceOf(c1,"java.util.Set")) && !(Clazz_instanceOf(c2,"java.util.Set")) || (c2.size()) > c1.size()) {
var tmp = c1;
c1 = c2;
c2 = tmp;
}var it = c1.iterator();
while (it.hasNext()) {
if (c2.contains(it.next())) {
return false;
}}
return true;
}, "java.util.Collection,java.util.Collection");
c$.checkType = Clazz_defineMethod(c$, "checkType", 
function(obj, type){
if (!type.isInstance(obj)) {
throw  new ClassCastException("Attempt to insert " + obj.getClass() + " element into collection with element type " + type);
}return obj;
}, "~O,Class");
c$.$Collections$1$=function(){
/*if5*/;(function(){
var c$ = Clazz_decorateAsClass(function(){
Clazz_prepareCallback(this, arguments);
this.it = null;
Clazz_instantialize(this, arguments);}, java.util, "Collections$1", null, java.util.Enumeration);
Clazz_prepareFields (c$, function(){
this.it = this.f$.c.iterator();
});
Clazz_defineMethod(c$, "hasMoreElements", 
function(){
return this.it.hasNext();
});
Clazz_defineMethod(c$, "nextElement", 
function(){
return this.it.next();
});
/*eoif5*/})();
};
/*if3*/;(function(){
var c$ = Clazz_declareType(java.util.Collections, "EmptyEnumeration", null, java.util.Enumeration);
Clazz_overrideMethod(c$, "hasMoreElements", 
function(){
return false;
});
Clazz_overrideMethod(c$, "nextElement", 
function(){
throw  new java.util.NoSuchElementException();
});
/*eoif3*/})();
/*if3*/;(function(){
var c$ = Clazz_declareType(java.util.Collections, "EmptyIterator", null, java.util.Iterator);
Clazz_overrideMethod(c$, "hasNext", 
function(){
return false;
});
Clazz_overrideMethod(c$, "next", 
function(){
throw  new java.util.NoSuchElementException();
});
Clazz_overrideMethod(c$, "remove", 
function(){
throw  new IllegalStateException();
});
/*eoif3*/})();
/*if3*/;(function(){
var c$ = Clazz_decorateAsClass(function(){
this.n = 0;
this.element = null;
Clazz_instantialize(this, arguments);}, java.util.Collections, "CopiesList", java.util.AbstractList, java.io.Serializable);
Clazz_makeConstructor(c$, 
function(length, object){
Clazz_superConstructor (this, java.util.Collections.CopiesList, []);
if (length < 0) {
throw  new IllegalArgumentException();
}this.n = length;
this.element = object;
}, "~N,~O");
Clazz_overrideMethod(c$, "contains", 
function(object){
return this.element == null ? object == null : this.element.equals(object);
}, "~O");
Clazz_overrideMethod(c$, "size", 
function(){
return this.n;
});
Clazz_overrideMethod(c$, "get", 
function(location){
if (0 <= location && location < this.n) {
return this.element;
}throw  new IndexOutOfBoundsException();
}, "~N");
/*eoif3*/})();
/*if3*/;(function(){
var c$ = Clazz_declareType(java.util.Collections, "EmptyList", java.util.AbstractList, java.io.Serializable);
Clazz_overrideMethod(c$, "contains", 
function(object){
return false;
}, "~O");
Clazz_overrideMethod(c$, "size", 
function(){
return 0;
});
Clazz_overrideMethod(c$, "get", 
function(location){
throw  new IndexOutOfBoundsException();
}, "~N");
/*eoif3*/})();
/*if3*/;(function(){
var c$ = Clazz_declareType(java.util.Collections, "EmptySet", java.util.AbstractSet, java.io.Serializable);
Clazz_overrideMethod(c$, "contains", 
function(object){
return false;
}, "~O");
Clazz_overrideMethod(c$, "size", 
function(){
return 0;
});
Clazz_overrideMethod(c$, "iterator", 
function(){
return ((Clazz_isClassDefined("java.util.Collections$EmptySet$1") ? 0 : java.util.Collections.EmptySet.$Collections$EmptySet$1$ ()), Clazz_innerTypeInstance(java.util.Collections$EmptySet$1, this, null));
});
c$.$Collections$EmptySet$1$=function(){
/*if5*/;(function(){
var c$ = Clazz_declareAnonymous(java.util, "Collections$EmptySet$1", null, java.util.Iterator);
Clazz_overrideMethod(c$, "hasNext", 
function(){
return false;
});
Clazz_overrideMethod(c$, "next", 
function(){
throw  new java.util.NoSuchElementException();
});
Clazz_overrideMethod(c$, "remove", 
function(){
throw  new UnsupportedOperationException();
});
/*eoif5*/})();
};
/*eoif3*/})();
/*if3*/;(function(){
var c$ = Clazz_declareType(java.util.Collections, "EmptyMap", java.util.AbstractMap, java.io.Serializable);
Clazz_overrideMethod(c$, "containsKey", 
function(key){
return false;
}, "~O");
Clazz_overrideMethod(c$, "containsValue", 
function(value){
return false;
}, "~O");
Clazz_overrideMethod(c$, "entrySet", 
function(){
return java.util.Collections.EMPTY_SET;
});
Clazz_overrideMethod(c$, "get", 
function(key){
return null;
}, "~O");
Clazz_overrideMethod(c$, "keySet", 
function(){
return java.util.Collections.EMPTY_SET;
});
Clazz_overrideMethod(c$, "values", 
function(){
return java.util.Collections.EMPTY_LIST;
});
/*eoif3*/})();
/*if3*/;(function(){
var c$ = Clazz_declareType(java.util.Collections, "ReverseComparator", null, [java.util.Comparator, java.io.Serializable]);
Clazz_overrideMethod(c$, "compare", 
function(o1, o2){
var c2 = o2;
return c2.compareTo(o1);
}, "~O,~O");
/*eoif3*/})();
/*if3*/;(function(){
var c$ = Clazz_decorateAsClass(function(){
this.comparator = null;
Clazz_instantialize(this, arguments);}, java.util.Collections, "ReverseComparatorWithComparator", null, [java.util.Comparator, java.io.Serializable]);
Clazz_makeConstructor(c$, 
function(comparator){
this.comparator = comparator;
}, "java.util.Comparator");
Clazz_defineMethod(c$, "compare", 
function(o1, o2){
return this.comparator.compare(o2, o1);
}, "~O,~O");
/*eoif3*/})();
/*if3*/;(function(){
var c$ = Clazz_decorateAsClass(function(){
this.element = null;
Clazz_instantialize(this, arguments);}, java.util.Collections, "SingletonSet", java.util.AbstractSet, java.io.Serializable);
Clazz_makeConstructor(c$, 
function(object){
Clazz_superConstructor (this, java.util.Collections.SingletonSet, []);
this.element = object;
}, "~O");
Clazz_overrideMethod(c$, "contains", 
function(object){
return this.element == null ? object == null : this.element.equals(object);
}, "~O");
Clazz_overrideMethod(c$, "size", 
function(){
return 1;
});
Clazz_overrideMethod(c$, "iterator", 
function(){
return ((Clazz_isClassDefined("java.util.Collections$SingletonSet$1") ? 0 : java.util.Collections.SingletonSet.$Collections$SingletonSet$1$ ()), Clazz_innerTypeInstance(java.util.Collections$SingletonSet$1, this, null));
});
c$.$Collections$SingletonSet$1$=function(){
/*if5*/;(function(){
var c$ = Clazz_decorateAsClass(function(){
Clazz_prepareCallback(this, arguments);
this.$hasNext = true;
Clazz_instantialize(this, arguments);}, java.util, "Collections$SingletonSet$1", null, java.util.Iterator);
Clazz_overrideMethod(c$, "hasNext", 
function(){
return this.$hasNext;
});
Clazz_overrideMethod(c$, "next", 
function(){
if (this.$hasNext) {
this.$hasNext = false;
return this.b$["java.util.Collections.SingletonSet"].element;
}throw  new java.util.NoSuchElementException();
});
Clazz_overrideMethod(c$, "remove", 
function(){
throw  new UnsupportedOperationException();
});
/*eoif5*/})();
};
/*eoif3*/})();
/*if3*/;(function(){
var c$ = Clazz_decorateAsClass(function(){
this.element = null;
Clazz_instantialize(this, arguments);}, java.util.Collections, "SingletonList", java.util.AbstractList, java.io.Serializable);
Clazz_makeConstructor(c$, 
function(object){
Clazz_superConstructor (this, java.util.Collections.SingletonList, []);
this.element = object;
}, "~O");
Clazz_overrideMethod(c$, "contains", 
function(object){
return this.element == null ? object == null : this.element.equals(object);
}, "~O");
Clazz_overrideMethod(c$, "get", 
function(location){
if (location == 0) {
return this.element;
}throw  new IndexOutOfBoundsException();
}, "~N");
Clazz_overrideMethod(c$, "size", 
function(){
return 1;
});
/*eoif3*/})();
/*if3*/;(function(){
var c$ = Clazz_decorateAsClass(function(){
this.k = null;
this.v = null;
Clazz_instantialize(this, arguments);}, java.util.Collections, "SingletonMap", java.util.AbstractMap, java.io.Serializable);
Clazz_makeConstructor(c$, 
function(key, value){
Clazz_superConstructor (this, java.util.Collections.SingletonMap, []);
this.k = key;
this.v = value;
}, "~O,~O");
Clazz_overrideMethod(c$, "containsKey", 
function(key){
return this.k == null ? key == null : this.k.equals(key);
}, "~O");
Clazz_overrideMethod(c$, "containsValue", 
function(value){
return this.v == null ? value == null : this.v.equals(value);
}, "~O");
Clazz_overrideMethod(c$, "get", 
function(key){
if (this.containsKey(key)) {
return this.v;
}return null;
}, "~O");
Clazz_overrideMethod(c$, "size", 
function(){
return 1;
});
Clazz_overrideMethod(c$, "entrySet", 
function(){
return ((Clazz_isClassDefined("java.util.Collections$SingletonMap$1") ? 0 : java.util.Collections.SingletonMap.$Collections$SingletonMap$1$ ()), Clazz_innerTypeInstance(java.util.Collections$SingletonMap$1, this, null));
});
c$.$Collections$SingletonMap$1$=function(){
/*if5*/;(function(){
var c$ = Clazz_declareAnonymous(java.util, "Collections$SingletonMap$1", java.util.AbstractSet);
Clazz_overrideMethod(c$, "contains", 
function(object){
if (Clazz_instanceOf(object,"java.util.Map.Entry")) {
var entry = object;
return this.b$["java.util.Collections.SingletonMap"].containsKey(entry.getKey()) && this.b$["java.util.Collections.SingletonMap"].containsValue(entry.getValue());
}return false;
}, "~O");
Clazz_overrideMethod(c$, "size", 
function(){
return 1;
});
Clazz_overrideMethod(c$, "iterator", 
function(){
return ((Clazz_isClassDefined("java.util.Collections$SingletonMap$1$1") ? 0 : java.util.Collections.$Collections$SingletonMap$1$1$ ()), Clazz_innerTypeInstance(java.util.Collections$SingletonMap$1$1, this, null));
});
/*eoif5*/})();
};
c$.$Collections$SingletonMap$1$1$=function(){
/*if5*/;(function(){
var c$ = Clazz_decorateAsClass(function(){
Clazz_prepareCallback(this, arguments);
this.$hasNext = true;
Clazz_instantialize(this, arguments);}, java.util, "Collections$SingletonMap$1$1", null, java.util.Iterator);
Clazz_overrideMethod(c$, "hasNext", 
function(){
return this.$hasNext;
});
Clazz_overrideMethod(c$, "next", 
function(){
if (this.$hasNext) {
this.$hasNext = false;
return ((Clazz_isClassDefined("java.util.Collections$SingletonMap$1$1$1") ? 0 : java.util.Collections.$Collections$SingletonMap$1$1$1$ ()), Clazz_innerTypeInstance(java.util.Collections$SingletonMap$1$1$1, this, null));
}throw  new java.util.NoSuchElementException();
});
Clazz_overrideMethod(c$, "remove", 
function(){
throw  new UnsupportedOperationException();
});
/*eoif5*/})();
};
c$.$Collections$SingletonMap$1$1$1$=function(){
/*if5*/;(function(){
var c$ = Clazz_declareAnonymous(java.util, "Collections$SingletonMap$1$1$1", null, java.util.Map.Entry);
Clazz_overrideMethod(c$, "equals", 
function(object){
return this.b$["java.util.Collections$SingletonMap$1"].contains(object);
}, "~O");
Clazz_overrideMethod(c$, "getKey", 
function(){
return this.b$["java.util.Collections.SingletonMap"].k;
});
Clazz_overrideMethod(c$, "getValue", 
function(){
return this.b$["java.util.Collections.SingletonMap"].v;
});
Clazz_overrideMethod(c$, "hashCode", 
function(){
return (this.b$["java.util.Collections.SingletonMap"].k == null ? 0 : this.b$["java.util.Collections.SingletonMap"].k.hashCode()) ^ (this.b$["java.util.Collections.SingletonMap"].v == null ? 0 : this.b$["java.util.Collections.SingletonMap"].v.hashCode());
});
Clazz_overrideMethod(c$, "setValue", 
function(value){
throw  new UnsupportedOperationException();
}, "~O");
/*eoif5*/})();
};
/*eoif3*/})();
/*if3*/;(function(){
var c$ = Clazz_decorateAsClass(function(){
this.c = null;
this.mutex = null;
Clazz_instantialize(this, arguments);}, java.util.Collections, "SynchronizedCollection", null, [java.util.Collection, java.io.Serializable]);
Clazz_makeConstructor(c$, 
function(collection){
this.c = collection;
this.mutex = this;
}, "java.util.Collection");
Clazz_makeConstructor(c$, 
function(collection, mutex){
this.c = collection;
this.mutex = mutex;
}, "java.util.Collection,~O");
Clazz_defineMethod(c$, "add", 
function(object){
{
return this.c.add(object);
}}, "~O");
Clazz_defineMethod(c$, "addAll", 
function(collection){
{
return this.c.addAll(collection);
}}, "java.util.Collection");
Clazz_defineMethod(c$, "clear", 
function(){
{
this.c.clear();
}});
Clazz_defineMethod(c$, "contains", 
function(object){
{
return this.c.contains(object);
}}, "~O");
Clazz_defineMethod(c$, "containsAll", 
function(collection){
{
return this.c.containsAll(collection);
}}, "java.util.Collection");
Clazz_defineMethod(c$, "isEmpty", 
function(){
{
return this.c.isEmpty();
}});
Clazz_defineMethod(c$, "iterator", 
function(){
{
return this.c.iterator();
}});
Clazz_defineMethod(c$, "remove", 
function(object){
{
return this.c.remove(object);
}}, "~O");
Clazz_defineMethod(c$, "removeAll", 
function(collection){
{
return this.c.removeAll(collection);
}}, "java.util.Collection");
Clazz_defineMethod(c$, "retainAll", 
function(collection){
{
return this.c.retainAll(collection);
}}, "java.util.Collection");
Clazz_defineMethod(c$, "size", 
function(){
{
return this.c.size();
}});
Clazz_defineMethod(c$, "toArray", 
function(){
{
return this.c.toArray();
}});
Clazz_defineMethod(c$, "toString", 
function(){
{
return this.c.toString();
}});
Clazz_defineMethod(c$, "toArray", 
function(array){
{
return this.c.toArray(array);
}}, "~A");
/*eoif3*/})();
/*if3*/;(function(){
var c$ = Clazz_declareType(java.util.Collections, "SynchronizedRandomAccessList", java.util.Collections.SynchronizedList, java.util.RandomAccess);
Clazz_overrideMethod(c$, "subList", 
function(start, end){
{
return  new java.util.Collections.SynchronizedRandomAccessList(this.list.subList(start, end), this.mutex);
}}, "~N,~N");
/*eoif3*/})();
/*if3*/;(function(){
var c$ = Clazz_decorateAsClass(function(){
this.list = null;
Clazz_instantialize(this, arguments);}, java.util.Collections, "SynchronizedList", java.util.Collections.SynchronizedCollection, java.util.List);
Clazz_makeConstructor(c$, 
function(l){
Clazz_superConstructor(this, java.util.Collections.SynchronizedList, [l]);
this.list = l;
}, "java.util.List");
Clazz_makeConstructor(c$, 
function(l, mutex){
Clazz_superConstructor(this, java.util.Collections.SynchronizedList, [l, mutex]);
this.list = l;
}, "java.util.List,~O");
Clazz_defineMethod(c$, "add", 
function(location, object){
{
this.list.add(location, object);
}}, "~N,~O");
Clazz_defineMethod(c$, "addAll", 
function(location, collection){
{
return this.list.addAll(location, collection);
}}, "~N,java.util.Collection");
Clazz_defineMethod(c$, "equals", 
function(object){
{
return this.list.equals(object);
}}, "~O");
Clazz_defineMethod(c$, "get", 
function(location){
{
return this.list.get(location);
}}, "~N");
Clazz_defineMethod(c$, "hashCode", 
function(){
{
return this.list.hashCode();
}});
Clazz_defineMethod(c$, "indexOf", 
function(object){
{
return this.list.indexOf(object);
}}, "~O");
Clazz_defineMethod(c$, "lastIndexOf", 
function(object){
{
return this.list.lastIndexOf(object);
}}, "~O");
Clazz_defineMethod(c$, "listIterator", 
function(){
{
return this.list.listIterator();
}});
Clazz_defineMethod(c$, "listIterator", 
function(location){
{
return this.list.listIterator(location);
}}, "~N");
Clazz_defineMethod(c$, "remove", 
function(location){
{
return this.list.remove(location);
}}, "~N");
Clazz_defineMethod(c$, "set", 
function(location, object){
{
return this.list.set(location, object);
}}, "~N,~O");
Clazz_defineMethod(c$, "subList", 
function(start, end){
{
return  new java.util.Collections.SynchronizedList(this.list.subList(start, end), this.mutex);
}}, "~N,~N");
/*eoif3*/})();
/*if3*/;(function(){
var c$ = Clazz_decorateAsClass(function(){
this.m = null;
this.mutex = null;
Clazz_instantialize(this, arguments);}, java.util.Collections, "SynchronizedMap", null, [java.util.Map, java.io.Serializable]);
Clazz_makeConstructor(c$, 
function(map){
this.m = map;
this.mutex = this;
}, "java.util.Map");
Clazz_makeConstructor(c$, 
function(map, mutex){
this.m = map;
this.mutex = mutex;
}, "java.util.Map,~O");
Clazz_defineMethod(c$, "clear", 
function(){
{
this.m.clear();
}});
Clazz_defineMethod(c$, "containsKey", 
function(key){
{
return this.m.containsKey(key);
}}, "~O");
Clazz_defineMethod(c$, "containsValue", 
function(value){
{
return this.m.containsValue(value);
}}, "~O");
Clazz_defineMethod(c$, "entrySet", 
function(){
{
return  new java.util.Collections.SynchronizedSet(this.m.entrySet(), this.mutex);
}});
Clazz_defineMethod(c$, "equals", 
function(object){
{
return this.m.equals(object);
}}, "~O");
Clazz_defineMethod(c$, "get", 
function(key){
{
return this.m.get(key);
}}, "~O");
Clazz_defineMethod(c$, "hashCode", 
function(){
{
return this.m.hashCode();
}});
Clazz_defineMethod(c$, "isEmpty", 
function(){
{
return this.m.isEmpty();
}});
Clazz_defineMethod(c$, "keySet", 
function(){
{
return  new java.util.Collections.SynchronizedSet(this.m.keySet(), this.mutex);
}});
Clazz_defineMethod(c$, "put", 
function(key, value){
{
return this.m.put(key, value);
}}, "~O,~O");
Clazz_defineMethod(c$, "putAll", 
function(map){
{
this.m.putAll(map);
}}, "java.util.Map");
Clazz_defineMethod(c$, "remove", 
function(key){
{
return this.m.remove(key);
}}, "~O");
Clazz_defineMethod(c$, "size", 
function(){
{
return this.m.size();
}});
Clazz_defineMethod(c$, "values", 
function(){
{
return  new java.util.Collections.SynchronizedCollection(this.m.values(), this.mutex);
}});
Clazz_defineMethod(c$, "toString", 
function(){
{
return this.m.toString();
}});
/*eoif3*/})();
/*if3*/;(function(){
var c$ = Clazz_declareType(java.util.Collections, "SynchronizedSet", java.util.Collections.SynchronizedCollection, java.util.Set);
Clazz_overrideMethod(c$, "equals", 
function(object){
{
return this.c.equals(object);
}}, "~O");
Clazz_overrideMethod(c$, "hashCode", 
function(){
{
return this.c.hashCode();
}});
/*eoif3*/})();
/*if3*/;(function(){
var c$ = Clazz_decorateAsClass(function(){
this.sm = null;
Clazz_instantialize(this, arguments);}, java.util.Collections, "SynchronizedSortedMap", java.util.Collections.SynchronizedMap, java.util.SortedMap);
Clazz_makeConstructor(c$, 
function(map){
Clazz_superConstructor(this, java.util.Collections.SynchronizedSortedMap, [map]);
this.sm = map;
}, "java.util.SortedMap");
Clazz_makeConstructor(c$, 
function(map, mutex){
Clazz_superConstructor(this, java.util.Collections.SynchronizedSortedMap, [map, mutex]);
this.sm = map;
}, "java.util.SortedMap,~O");
Clazz_defineMethod(c$, "comparator", 
function(){
{
return this.sm.comparator();
}});
Clazz_defineMethod(c$, "firstKey", 
function(){
{
return this.sm.firstKey();
}});
Clazz_defineMethod(c$, "headMap", 
function(endKey){
{
return  new java.util.Collections.SynchronizedSortedMap(this.sm.headMap(endKey), this.mutex);
}}, "~O");
Clazz_defineMethod(c$, "lastKey", 
function(){
{
return this.sm.lastKey();
}});
Clazz_defineMethod(c$, "subMap", 
function(startKey, endKey){
{
return  new java.util.Collections.SynchronizedSortedMap(this.sm.subMap(startKey, endKey), this.mutex);
}}, "~O,~O");
Clazz_defineMethod(c$, "tailMap", 
function(startKey){
{
return  new java.util.Collections.SynchronizedSortedMap(this.sm.tailMap(startKey), this.mutex);
}}, "~O");
/*eoif3*/})();
/*if3*/;(function(){
var c$ = Clazz_decorateAsClass(function(){
this.ss = null;
Clazz_instantialize(this, arguments);}, java.util.Collections, "SynchronizedSortedSet", java.util.Collections.SynchronizedSet, java.util.SortedSet);
Clazz_makeConstructor(c$, 
function(set){
Clazz_superConstructor(this, java.util.Collections.SynchronizedSortedSet, [set]);
this.ss = set;
}, "java.util.SortedSet");
Clazz_makeConstructor(c$, 
function(set, mutex){
Clazz_superConstructor(this, java.util.Collections.SynchronizedSortedSet, [set, mutex]);
this.ss = set;
}, "java.util.SortedSet,~O");
Clazz_defineMethod(c$, "comparator", 
function(){
{
return this.ss.comparator();
}});
Clazz_defineMethod(c$, "first", 
function(){
{
return this.ss.first();
}});
Clazz_defineMethod(c$, "headSet", 
function(end){
{
return  new java.util.Collections.SynchronizedSortedSet(this.ss.headSet(end), this.mutex);
}}, "~O");
Clazz_defineMethod(c$, "last", 
function(){
{
return this.ss.last();
}});
Clazz_defineMethod(c$, "subSet", 
function(start, end){
{
return  new java.util.Collections.SynchronizedSortedSet(this.ss.subSet(start, end), this.mutex);
}}, "~O,~O");
Clazz_defineMethod(c$, "tailSet", 
function(start){
{
return  new java.util.Collections.SynchronizedSortedSet(this.ss.tailSet(start), this.mutex);
}}, "~O");
/*eoif3*/})();
/*if3*/;(function(){
var c$ = Clazz_decorateAsClass(function(){
this.c = null;
Clazz_instantialize(this, arguments);}, java.util.Collections, "UnmodifiableCollection", null, [java.util.Collection, java.io.Serializable]);
Clazz_makeConstructor(c$, 
function(collection){
this.c = collection;
}, "java.util.Collection");
Clazz_overrideMethod(c$, "add", 
function(object){
throw  new UnsupportedOperationException();
}, "~O");
Clazz_overrideMethod(c$, "addAll", 
function(collection){
throw  new UnsupportedOperationException();
}, "java.util.Collection");
Clazz_overrideMethod(c$, "clear", 
function(){
throw  new UnsupportedOperationException();
});
Clazz_defineMethod(c$, "contains", 
function(object){
return this.c.contains(object);
}, "~O");
Clazz_defineMethod(c$, "containsAll", 
function(collection){
return this.c.containsAll(collection);
}, "java.util.Collection");
Clazz_defineMethod(c$, "isEmpty", 
function(){
return this.c.isEmpty();
});
Clazz_defineMethod(c$, "iterator", 
function(){
return ((Clazz_isClassDefined("java.util.Collections$UnmodifiableCollection$1") ? 0 : java.util.Collections.UnmodifiableCollection.$Collections$UnmodifiableCollection$1$ ()), Clazz_innerTypeInstance(java.util.Collections$UnmodifiableCollection$1, this, null));
});
Clazz_overrideMethod(c$, "remove", 
function(object){
throw  new UnsupportedOperationException();
}, "~O");
Clazz_overrideMethod(c$, "removeAll", 
function(collection){
throw  new UnsupportedOperationException();
}, "java.util.Collection");
Clazz_overrideMethod(c$, "retainAll", 
function(collection){
throw  new UnsupportedOperationException();
}, "java.util.Collection");
Clazz_defineMethod(c$, "size", 
function(){
return this.c.size();
});
Clazz_defineMethod(c$, "toArray", 
function(){
return this.c.toArray();
});
Clazz_defineMethod(c$, "toArray", 
function(array){
return this.c.toArray(array);
}, "~A");
Clazz_defineMethod(c$, "toString", 
function(){
return this.c.toString();
});
c$.$Collections$UnmodifiableCollection$1$=function(){
/*if5*/;(function(){
var c$ = Clazz_decorateAsClass(function(){
Clazz_prepareCallback(this, arguments);
this.iterator = null;
Clazz_instantialize(this, arguments);}, java.util, "Collections$UnmodifiableCollection$1", null, java.util.Iterator);
Clazz_prepareFields (c$, function(){
this.iterator = this.b$["java.util.Collections.UnmodifiableCollection"].c.iterator();
});
Clazz_defineMethod(c$, "hasNext", 
function(){
return this.iterator.hasNext();
});
Clazz_defineMethod(c$, "next", 
function(){
return this.iterator.next();
});
Clazz_overrideMethod(c$, "remove", 
function(){
throw  new UnsupportedOperationException();
});
/*eoif5*/})();
};
/*eoif3*/})();
/*if3*/;(function(){
var c$ = Clazz_declareType(java.util.Collections, "UnmodifiableRandomAccessList", java.util.Collections.UnmodifiableList, java.util.RandomAccess);
Clazz_overrideMethod(c$, "subList", 
function(start, end){
return  new java.util.Collections.UnmodifiableRandomAccessList(this.list.subList(start, end));
}, "~N,~N");
/*eoif3*/})();
/*if3*/;(function(){
var c$ = Clazz_decorateAsClass(function(){
this.list = null;
Clazz_instantialize(this, arguments);}, java.util.Collections, "UnmodifiableList", java.util.Collections.UnmodifiableCollection, java.util.List);
Clazz_makeConstructor(c$, 
function(l){
Clazz_superConstructor(this, java.util.Collections.UnmodifiableList, [l]);
this.list = l;
}, "java.util.List");
Clazz_defineMethod(c$, "add", 
function(location, object){
throw  new UnsupportedOperationException();
}, "~N,~O");
Clazz_defineMethod(c$, "addAll", 
function(location, collection){
throw  new UnsupportedOperationException();
}, "~N,java.util.Collection");
Clazz_defineMethod(c$, "equals", 
function(object){
return this.list.equals(object);
}, "~O");
Clazz_defineMethod(c$, "get", 
function(location){
return this.list.get(location);
}, "~N");
Clazz_defineMethod(c$, "hashCode", 
function(){
return this.list.hashCode();
});
Clazz_defineMethod(c$, "indexOf", 
function(object){
return this.list.indexOf(object);
}, "~O");
Clazz_defineMethod(c$, "lastIndexOf", 
function(object){
return this.list.lastIndexOf(object);
}, "~O");
Clazz_defineMethod(c$, "listIterator", 
function(){
return this.listIterator(0);
});
Clazz_defineMethod(c$, "listIterator", 
function(location){
return ((Clazz_isClassDefined("java.util.Collections$UnmodifiableList$1") ? 0 : java.util.Collections.UnmodifiableList.$Collections$UnmodifiableList$1$ ()), Clazz_innerTypeInstance(java.util.Collections$UnmodifiableList$1, this, Clazz_cloneFinals("location", location)));
}, "~N");
Clazz_defineMethod(c$, "remove", 
function(location){
throw  new UnsupportedOperationException();
}, "~N");
Clazz_overrideMethod(c$, "set", 
function(location, object){
throw  new UnsupportedOperationException();
}, "~N,~O");
Clazz_defineMethod(c$, "subList", 
function(start, end){
return  new java.util.Collections.UnmodifiableList(this.list.subList(start, end));
}, "~N,~N");
c$.$Collections$UnmodifiableList$1$=function(){
/*if5*/;(function(){
var c$ = Clazz_decorateAsClass(function(){
Clazz_prepareCallback(this, arguments);
this.iterator = null;
Clazz_instantialize(this, arguments);}, java.util, "Collections$UnmodifiableList$1", null, java.util.ListIterator);
Clazz_prepareFields (c$, function(){
this.iterator = this.b$["java.util.Collections.UnmodifiableList"].list.listIterator(this.f$.location);
});
Clazz_overrideMethod(c$, "add", 
function(object){
throw  new UnsupportedOperationException();
}, "~O");
Clazz_defineMethod(c$, "hasNext", 
function(){
return this.iterator.hasNext();
});
Clazz_defineMethod(c$, "hasPrevious", 
function(){
return this.iterator.hasPrevious();
});
Clazz_defineMethod(c$, "next", 
function(){
return this.iterator.next();
});
Clazz_defineMethod(c$, "nextIndex", 
function(){
return this.iterator.nextIndex();
});
Clazz_defineMethod(c$, "previous", 
function(){
return this.iterator.previous();
});
Clazz_defineMethod(c$, "previousIndex", 
function(){
return this.iterator.previousIndex();
});
Clazz_overrideMethod(c$, "remove", 
function(){
throw  new UnsupportedOperationException();
});
Clazz_overrideMethod(c$, "set", 
function(object){
throw  new UnsupportedOperationException();
}, "~O");
/*eoif5*/})();
};
/*eoif3*/})();
/*if3*/;(function(){
var c$ = Clazz_decorateAsClass(function(){
this.m = null;
Clazz_instantialize(this, arguments);}, java.util.Collections, "UnmodifiableMap", null, [java.util.Map, java.io.Serializable]);
Clazz_makeConstructor(c$, 
function(map){
this.m = map;
}, "java.util.Map");
Clazz_overrideMethod(c$, "clear", 
function(){
throw  new UnsupportedOperationException();
});
Clazz_defineMethod(c$, "containsKey", 
function(key){
return this.m.containsKey(key);
}, "~O");
Clazz_defineMethod(c$, "containsValue", 
function(value){
return this.m.containsValue(value);
}, "~O");
Clazz_defineMethod(c$, "entrySet", 
function(){
return  new java.util.Collections.UnmodifiableMap.UnmodifiableEntrySet(this.m.entrySet());
});
Clazz_defineMethod(c$, "equals", 
function(object){
return this.m.equals(object);
}, "~O");
Clazz_defineMethod(c$, "get", 
function(key){
return this.m.get(key);
}, "~O");
Clazz_defineMethod(c$, "hashCode", 
function(){
return this.m.hashCode();
});
Clazz_defineMethod(c$, "isEmpty", 
function(){
return this.m.isEmpty();
});
Clazz_defineMethod(c$, "keySet", 
function(){
return  new java.util.Collections.UnmodifiableSet(this.m.keySet());
});
Clazz_overrideMethod(c$, "put", 
function(key, value){
throw  new UnsupportedOperationException();
}, "~O,~O");
Clazz_overrideMethod(c$, "putAll", 
function(map){
throw  new UnsupportedOperationException();
}, "java.util.Map");
Clazz_overrideMethod(c$, "remove", 
function(key){
throw  new UnsupportedOperationException();
}, "~O");
Clazz_defineMethod(c$, "size", 
function(){
return this.m.size();
});
Clazz_defineMethod(c$, "values", 
function(){
return  new java.util.Collections.UnmodifiableCollection(this.m.values());
});
Clazz_defineMethod(c$, "toString", 
function(){
return this.m.toString();
});
/*if3*/;(function(){
var c$ = Clazz_declareType(java.util.Collections.UnmodifiableMap, "UnmodifiableEntrySet", java.util.Collections.UnmodifiableSet);
Clazz_overrideMethod(c$, "iterator", 
function(){
return ((Clazz_isClassDefined("java.util.Collections$UnmodifiableMap$UnmodifiableEntrySet$1") ? 0 : java.util.Collections.UnmodifiableMap.UnmodifiableEntrySet.$Collections$UnmodifiableMap$UnmodifiableEntrySet$1$ ()), Clazz_innerTypeInstance(java.util.Collections$UnmodifiableMap$UnmodifiableEntrySet$1, this, null));
});
Clazz_defineMethod(c$, "toArray", 
function(){
var length = this.c.size();
var result =  new Array(length);
var it = this.iterator();
for (var i = length; --i >= 0; ) {
result[i] = it.next();
}
return result;
});
Clazz_defineMethod(c$, "toArray", 
function(contents){
var size = this.c.size();
var index = 0;
var it = this.iterator();
if (size > contents.length) {
var ct = contents.getClass().getComponentType();
contents = java.lang.reflect.Array.newInstance(ct, size);
}while (index < size) {
contents[index++] = it.next();
}
if (index < contents.length) {
contents[index] = null;
}return contents;
}, "~A");
c$.$Collections$UnmodifiableMap$UnmodifiableEntrySet$1$=function(){
/*if5*/;(function(){
var c$ = Clazz_decorateAsClass(function(){
Clazz_prepareCallback(this, arguments);
this.iterator = null;
Clazz_instantialize(this, arguments);}, java.util, "Collections$UnmodifiableMap$UnmodifiableEntrySet$1", null, java.util.Iterator);
Clazz_prepareFields (c$, function(){
this.iterator = this.b$["java.util.Collections.UnmodifiableMap.UnmodifiableEntrySet"].c.iterator();
});
Clazz_defineMethod(c$, "hasNext", 
function(){
return this.iterator.hasNext();
});
Clazz_defineMethod(c$, "next", 
function(){
return  new java.util.Collections.UnmodifiableMap.UnmodifiableEntrySet.UnmodifiableMapEntry(this.iterator.next());
});
Clazz_overrideMethod(c$, "remove", 
function(){
throw  new UnsupportedOperationException();
});
/*eoif5*/})();
};
/*if3*/;(function(){
var c$ = Clazz_decorateAsClass(function(){
this.mapEntry = null;
Clazz_instantialize(this, arguments);}, java.util.Collections.UnmodifiableMap.UnmodifiableEntrySet, "UnmodifiableMapEntry", null, java.util.Map.Entry);
Clazz_makeConstructor(c$, 
function(entry){
this.mapEntry = entry;
}, "java.util.Map.Entry");
Clazz_defineMethod(c$, "equals", 
function(object){
return this.mapEntry.equals(object);
}, "~O");
Clazz_defineMethod(c$, "getKey", 
function(){
return this.mapEntry.getKey();
});
Clazz_defineMethod(c$, "getValue", 
function(){
return this.mapEntry.getValue();
});
Clazz_defineMethod(c$, "hashCode", 
function(){
return this.mapEntry.hashCode();
});
Clazz_overrideMethod(c$, "setValue", 
function(object){
throw  new UnsupportedOperationException();
}, "~O");
Clazz_defineMethod(c$, "toString", 
function(){
return this.mapEntry.toString();
});
/*eoif3*/})();
/*eoif3*/})();
/*eoif3*/})();
/*if3*/;(function(){
var c$ = Clazz_declareType(java.util.Collections, "UnmodifiableSet", java.util.Collections.UnmodifiableCollection, java.util.Set);
Clazz_overrideMethod(c$, "equals", 
function(object){
return this.c.equals(object);
}, "~O");
Clazz_overrideMethod(c$, "hashCode", 
function(){
return this.c.hashCode();
});
/*eoif3*/})();
/*if3*/;(function(){
var c$ = Clazz_decorateAsClass(function(){
this.sm = null;
Clazz_instantialize(this, arguments);}, java.util.Collections, "UnmodifiableSortedMap", java.util.Collections.UnmodifiableMap, java.util.SortedMap);
Clazz_makeConstructor(c$, 
function(map){
Clazz_superConstructor(this, java.util.Collections.UnmodifiableSortedMap, [map]);
this.sm = map;
}, "java.util.SortedMap");
Clazz_defineMethod(c$, "comparator", 
function(){
return this.sm.comparator();
});
Clazz_defineMethod(c$, "firstKey", 
function(){
return this.sm.firstKey();
});
Clazz_defineMethod(c$, "headMap", 
function(before){
return  new java.util.Collections.UnmodifiableSortedMap(this.sm.headMap(before));
}, "~O");
Clazz_defineMethod(c$, "lastKey", 
function(){
return this.sm.lastKey();
});
Clazz_defineMethod(c$, "subMap", 
function(start, end){
return  new java.util.Collections.UnmodifiableSortedMap(this.sm.subMap(start, end));
}, "~O,~O");
Clazz_defineMethod(c$, "tailMap", 
function(after){
return  new java.util.Collections.UnmodifiableSortedMap(this.sm.tailMap(after));
}, "~O");
/*eoif3*/})();
/*if3*/;(function(){
var c$ = Clazz_decorateAsClass(function(){
this.ss = null;
Clazz_instantialize(this, arguments);}, java.util.Collections, "UnmodifiableSortedSet", java.util.Collections.UnmodifiableSet, java.util.SortedSet);
Clazz_makeConstructor(c$, 
function(set){
Clazz_superConstructor(this, java.util.Collections.UnmodifiableSortedSet, [set]);
this.ss = set;
}, "java.util.SortedSet");
Clazz_defineMethod(c$, "comparator", 
function(){
return this.ss.comparator();
});
Clazz_defineMethod(c$, "first", 
function(){
return this.ss.first();
});
Clazz_defineMethod(c$, "headSet", 
function(before){
return  new java.util.Collections.UnmodifiableSortedSet(this.ss.headSet(before));
}, "~O");
Clazz_defineMethod(c$, "last", 
function(){
return this.ss.last();
});
Clazz_defineMethod(c$, "subSet", 
function(start, end){
return  new java.util.Collections.UnmodifiableSortedSet(this.ss.subSet(start, end));
}, "~O,~O");
Clazz_defineMethod(c$, "tailSet", 
function(after){
return  new java.util.Collections.UnmodifiableSortedSet(this.ss.tailSet(after));
}, "~O");
/*eoif3*/})();
/*if3*/;(function(){
var c$ = Clazz_decorateAsClass(function(){
this.c = null;
this.type = null;
Clazz_instantialize(this, arguments);}, java.util.Collections, "CheckedCollection", null, [java.util.Collection, java.io.Serializable]);
Clazz_makeConstructor(c$, 
function(c, type){
if (c == null || type == null) {
throw  new NullPointerException();
}this.c = c;
this.type = type;
}, "java.util.Collection,Class");
Clazz_defineMethod(c$, "size", 
function(){
return this.c.size();
});
Clazz_defineMethod(c$, "isEmpty", 
function(){
return this.c.isEmpty();
});
Clazz_defineMethod(c$, "contains", 
function(obj){
return this.c.contains(obj);
}, "~O");
Clazz_defineMethod(c$, "iterator", 
function(){
var i = this.c.iterator();
if (Clazz_instanceOf(i,"java.util.ListIterator")) {
i =  new java.util.Collections.CheckedListIterator(i, this.type);
}return i;
});
Clazz_defineMethod(c$, "toArray", 
function(){
return this.c.toArray();
});
Clazz_defineMethod(c$, "toArray", 
function(arr){
return this.c.toArray(arr);
}, "~A");
Clazz_defineMethod(c$, "add", 
function(obj){
return this.c.add(java.util.Collections.checkType(obj, this.type));
}, "~O");
Clazz_defineMethod(c$, "remove", 
function(obj){
return this.c.remove(obj);
}, "~O");
Clazz_defineMethod(c$, "containsAll", 
function(c1){
return this.c.containsAll(c1);
}, "java.util.Collection");
Clazz_overrideMethod(c$, "addAll", 
function(c1){
var size = c1.size();
if (size == 0) {
return false;
}var arr =  new Array(size);
var it = c1.iterator();
for (var i = 0; i < size; i++) {
arr[i] = java.util.Collections.checkType(it.next(), this.type);
}
var added = false;
for (var i = 0; i < size; i++) {
added = new Boolean (added | this.c.add(arr[i])).valueOf();
}
return added;
}, "java.util.Collection");
Clazz_defineMethod(c$, "removeAll", 
function(c1){
return this.c.removeAll(c1);
}, "java.util.Collection");
Clazz_defineMethod(c$, "retainAll", 
function(c1){
return this.c.retainAll(c1);
}, "java.util.Collection");
Clazz_defineMethod(c$, "clear", 
function(){
this.c.clear();
});
Clazz_defineMethod(c$, "toString", 
function(){
return this.c.toString();
});
/*eoif3*/})();
/*if3*/;(function(){
var c$ = Clazz_decorateAsClass(function(){
this.i = null;
this.type = null;
Clazz_instantialize(this, arguments);}, java.util.Collections, "CheckedListIterator", null, java.util.ListIterator);
Clazz_makeConstructor(c$, 
function(i, type){
this.i = i;
this.type = type;
}, "java.util.ListIterator,Class");
Clazz_defineMethod(c$, "hasNext", 
function(){
return this.i.hasNext();
});
Clazz_defineMethod(c$, "next", 
function(){
return this.i.next();
});
Clazz_defineMethod(c$, "remove", 
function(){
this.i.remove();
});
Clazz_defineMethod(c$, "hasPrevious", 
function(){
return this.i.hasPrevious();
});
Clazz_defineMethod(c$, "previous", 
function(){
return this.i.previous();
});
Clazz_defineMethod(c$, "nextIndex", 
function(){
return this.i.nextIndex();
});
Clazz_defineMethod(c$, "previousIndex", 
function(){
return this.i.previousIndex();
});
Clazz_defineMethod(c$, "set", 
function(obj){
this.i.set(java.util.Collections.checkType(obj, this.type));
}, "~O");
Clazz_defineMethod(c$, "add", 
function(obj){
this.i.add(java.util.Collections.checkType(obj, this.type));
}, "~O");
/*eoif3*/})();
/*if3*/;(function(){
var c$ = Clazz_decorateAsClass(function(){
this.l = null;
Clazz_instantialize(this, arguments);}, java.util.Collections, "CheckedList", java.util.Collections.CheckedCollection, java.util.List);
Clazz_makeConstructor(c$, 
function(l, type){
Clazz_superConstructor(this, java.util.Collections.CheckedList, [l, type]);
this.l = l;
}, "java.util.List,Class");
Clazz_defineMethod(c$, "addAll", 
function(index, c1){
var size = c1.size();
if (size == 0) {
return false;
}var arr =  new Array(size);
var it = c1.iterator();
for (var i = 0; i < size; i++) {
arr[i] = java.util.Collections.checkType(it.next(), this.type);
}
return this.l.addAll(index, java.util.Arrays.asList(arr));
}, "~N,java.util.Collection");
Clazz_defineMethod(c$, "get", 
function(index){
return this.l.get(index);
}, "~N");
Clazz_defineMethod(c$, "set", 
function(index, obj){
return this.l.set(index, java.util.Collections.checkType(obj, this.type));
}, "~N,~O");
Clazz_defineMethod(c$, "add", 
function(index, obj){
this.l.add(index, java.util.Collections.checkType(obj, this.type));
}, "~N,~O");
Clazz_defineMethod(c$, "remove", 
function(index){
return this.l.remove(index);
}, "~N");
Clazz_defineMethod(c$, "indexOf", 
function(obj){
return this.l.indexOf(obj);
}, "~O");
Clazz_defineMethod(c$, "lastIndexOf", 
function(obj){
return this.l.lastIndexOf(obj);
}, "~O");
Clazz_defineMethod(c$, "listIterator", 
function(){
return  new java.util.Collections.CheckedListIterator(this.l.listIterator(), this.type);
});
Clazz_defineMethod(c$, "listIterator", 
function(index){
return  new java.util.Collections.CheckedListIterator(this.l.listIterator(index), this.type);
}, "~N");
Clazz_defineMethod(c$, "subList", 
function(fromIndex, toIndex){
return java.util.Collections.checkedList(this.l.subList(fromIndex, toIndex), this.type);
}, "~N,~N");
Clazz_defineMethod(c$, "equals", 
function(obj){
return this.l.equals(obj);
}, "~O");
Clazz_defineMethod(c$, "hashCode", 
function(){
return this.l.hashCode();
});
/*eoif3*/})();
/*if3*/;(function(){
var c$ = Clazz_declareType(java.util.Collections, "CheckedRandomAccessList", java.util.Collections.CheckedList, java.util.RandomAccess);
/*eoif3*/})();
/*if3*/;(function(){
var c$ = Clazz_declareType(java.util.Collections, "CheckedSet", java.util.Collections.CheckedCollection, java.util.Set);
Clazz_overrideMethod(c$, "equals", 
function(obj){
return this.c.equals(obj);
}, "~O");
Clazz_overrideMethod(c$, "hashCode", 
function(){
return this.c.hashCode();
});
/*eoif3*/})();
/*if3*/;(function(){
var c$ = Clazz_decorateAsClass(function(){
this.m = null;
this.keyType = null;
this.valueType = null;
Clazz_instantialize(this, arguments);}, java.util.Collections, "CheckedMap", null, [java.util.Map, java.io.Serializable]);
Clazz_makeConstructor(c$, 
function(m, keyType, valueType){
if (m == null || keyType == null || valueType == null) {
throw  new NullPointerException();
}this.m = m;
this.keyType = keyType;
this.valueType = valueType;
}, "java.util.Map,Class,Class");
Clazz_defineMethod(c$, "size", 
function(){
return this.m.size();
});
Clazz_defineMethod(c$, "isEmpty", 
function(){
return this.m.isEmpty();
});
Clazz_defineMethod(c$, "containsKey", 
function(key){
return this.m.containsKey(key);
}, "~O");
Clazz_defineMethod(c$, "containsValue", 
function(value){
return this.m.containsValue(value);
}, "~O");
Clazz_defineMethod(c$, "get", 
function(key){
return this.m.get(key);
}, "~O");
Clazz_defineMethod(c$, "put", 
function(key, value){
return this.m.put(java.util.Collections.checkType(key, this.keyType), java.util.Collections.checkType(value, this.valueType));
}, "~O,~O");
Clazz_defineMethod(c$, "remove", 
function(key){
return this.m.remove(key);
}, "~O");
Clazz_overrideMethod(c$, "putAll", 
function(map){
var size = map.size();
if (size == 0) {
return;
}var entries =  new Array(size);
var it = map.entrySet().iterator();
for (var i = 0; i < size; i++) {
var e = it.next();
java.util.Collections.checkType(e.getKey(), this.keyType);
java.util.Collections.checkType(e.getValue(), this.valueType);
entries[i] = e;
}
for (var i = 0; i < size; i++) {
this.m.put(entries[i].getKey(), entries[i].getValue());
}
}, "java.util.Map");
Clazz_defineMethod(c$, "clear", 
function(){
this.m.clear();
});
Clazz_defineMethod(c$, "keySet", 
function(){
return this.m.keySet();
});
Clazz_defineMethod(c$, "values", 
function(){
return this.m.values();
});
Clazz_defineMethod(c$, "entrySet", 
function(){
return  new java.util.Collections.CheckedMap.CheckedEntrySet(this.m.entrySet(), this.valueType);
});
Clazz_defineMethod(c$, "equals", 
function(obj){
return this.m.equals(obj);
}, "~O");
Clazz_defineMethod(c$, "hashCode", 
function(){
return this.m.hashCode();
});
Clazz_defineMethod(c$, "toString", 
function(){
return this.m.toString();
});
/*if3*/;(function(){
var c$ = Clazz_decorateAsClass(function(){
this.e = null;
this.valueType = null;
Clazz_instantialize(this, arguments);}, java.util.Collections.CheckedMap, "CheckedEntry", null, java.util.Map.Entry);
Clazz_makeConstructor(c$, 
function(e, valueType){
if (e == null) {
throw  new NullPointerException();
}this.e = e;
this.valueType = valueType;
}, "java.util.Map.Entry,Class");
Clazz_defineMethod(c$, "getKey", 
function(){
return this.e.getKey();
});
Clazz_defineMethod(c$, "getValue", 
function(){
return this.e.getValue();
});
Clazz_defineMethod(c$, "setValue", 
function(obj){
return this.e.setValue(java.util.Collections.checkType(obj, this.valueType));
}, "~O");
Clazz_defineMethod(c$, "equals", 
function(obj){
return this.e.equals(obj);
}, "~O");
Clazz_defineMethod(c$, "hashCode", 
function(){
return this.e.hashCode();
});
/*eoif3*/})();
/*if3*/;(function(){
var c$ = Clazz_decorateAsClass(function(){
this.s = null;
this.valueType = null;
Clazz_instantialize(this, arguments);}, java.util.Collections.CheckedMap, "CheckedEntrySet", null, java.util.Set);
Clazz_makeConstructor(c$, 
function(s, valueType){
this.s = s;
this.valueType = valueType;
}, "java.util.Set,Class");
Clazz_defineMethod(c$, "iterator", 
function(){
return  new java.util.Collections.CheckedMap.CheckedEntrySet.CheckedEntryIterator(this.s.iterator(), this.valueType);
});
Clazz_defineMethod(c$, "toArray", 
function(){
var thisSize = this.size();
var array =  new Array(thisSize);
var it = this.iterator();
for (var i = 0; i < thisSize; i++) {
array[i] = it.next();
}
return array;
});
Clazz_defineMethod(c$, "toArray", 
function(array){
var thisSize = this.size();
if (array.length < thisSize) {
var ct = array.getClass().getComponentType();
array = java.lang.reflect.Array.newInstance(ct, thisSize);
}var it = this.iterator();
for (var i = 0; i < thisSize; i++) {
array[i] = it.next();
}
if (thisSize < array.length) {
array[thisSize] = null;
}return array;
}, "~A");
Clazz_defineMethod(c$, "retainAll", 
function(c){
return this.s.retainAll(c);
}, "java.util.Collection");
Clazz_defineMethod(c$, "removeAll", 
function(c){
return this.s.removeAll(c);
}, "java.util.Collection");
Clazz_defineMethod(c$, "containsAll", 
function(c){
return this.s.containsAll(c);
}, "java.util.Collection");
Clazz_overrideMethod(c$, "addAll", 
function(c){
throw  new UnsupportedOperationException();
}, "java.util.Collection");
Clazz_defineMethod(c$, "remove", 
function(o){
return this.s.remove(o);
}, "~O");
Clazz_defineMethod(c$, "contains", 
function(o){
return this.s.contains(o);
}, "~O");
Clazz_overrideMethod(c$, "add", 
function(o){
throw  new UnsupportedOperationException();
}, "java.util.Map.Entry");
Clazz_defineMethod(c$, "isEmpty", 
function(){
return this.s.isEmpty();
});
Clazz_defineMethod(c$, "clear", 
function(){
this.s.clear();
});
Clazz_defineMethod(c$, "size", 
function(){
return this.s.size();
});
Clazz_defineMethod(c$, "hashCode", 
function(){
return this.s.hashCode();
});
Clazz_defineMethod(c$, "equals", 
function(object){
return this.s.equals(object);
}, "~O");
/*if3*/;(function(){
var c$ = Clazz_decorateAsClass(function(){
this.i = null;
this.valueType = null;
Clazz_instantialize(this, arguments);}, java.util.Collections.CheckedMap.CheckedEntrySet, "CheckedEntryIterator", null, java.util.Iterator);
Clazz_makeConstructor(c$, 
function(i, valueType){
this.i = i;
this.valueType = valueType;
}, "java.util.Iterator,Class");
Clazz_defineMethod(c$, "hasNext", 
function(){
return this.i.hasNext();
});
Clazz_defineMethod(c$, "remove", 
function(){
this.i.remove();
});
Clazz_defineMethod(c$, "next", 
function(){
return  new java.util.Collections.CheckedMap.CheckedEntry(this.i.next(), this.valueType);
});
/*eoif3*/})();
/*eoif3*/})();
/*eoif3*/})();
/*if3*/;(function(){
var c$ = Clazz_decorateAsClass(function(){
this.ss = null;
Clazz_instantialize(this, arguments);}, java.util.Collections, "CheckedSortedSet", java.util.Collections.CheckedSet, java.util.SortedSet);
Clazz_makeConstructor(c$, 
function(s, type){
Clazz_superConstructor(this, java.util.Collections.CheckedSortedSet, [s, type]);
this.ss = s;
}, "java.util.SortedSet,Class");
Clazz_defineMethod(c$, "comparator", 
function(){
return this.ss.comparator();
});
Clazz_defineMethod(c$, "subSet", 
function(fromElement, toElement){
return  new java.util.Collections.CheckedSortedSet(this.ss.subSet(fromElement, toElement), this.type);
}, "~O,~O");
Clazz_defineMethod(c$, "headSet", 
function(toElement){
return  new java.util.Collections.CheckedSortedSet(this.ss.headSet(toElement), this.type);
}, "~O");
Clazz_defineMethod(c$, "tailSet", 
function(fromElement){
return  new java.util.Collections.CheckedSortedSet(this.ss.tailSet(fromElement), this.type);
}, "~O");
Clazz_defineMethod(c$, "first", 
function(){
return this.ss.first();
});
Clazz_defineMethod(c$, "last", 
function(){
return this.ss.last();
});
/*eoif3*/})();
/*if3*/;(function(){
var c$ = Clazz_decorateAsClass(function(){
this.sm = null;
Clazz_instantialize(this, arguments);}, java.util.Collections, "CheckedSortedMap", java.util.Collections.CheckedMap, java.util.SortedMap);
Clazz_makeConstructor(c$, 
function(m, keyType, valueType){
Clazz_superConstructor(this, java.util.Collections.CheckedSortedMap, [m, keyType, valueType]);
this.sm = m;
}, "java.util.SortedMap,Class,Class");
Clazz_defineMethod(c$, "comparator", 
function(){
return this.sm.comparator();
});
Clazz_defineMethod(c$, "subMap", 
function(fromKey, toKey){
return  new java.util.Collections.CheckedSortedMap(this.sm.subMap(fromKey, toKey), this.keyType, this.valueType);
}, "~O,~O");
Clazz_defineMethod(c$, "headMap", 
function(toKey){
return  new java.util.Collections.CheckedSortedMap(this.sm.headMap(toKey), this.keyType, this.valueType);
}, "~O");
Clazz_defineMethod(c$, "tailMap", 
function(fromKey){
return  new java.util.Collections.CheckedSortedMap(this.sm.tailMap(fromKey), this.keyType, this.valueType);
}, "~O");
Clazz_defineMethod(c$, "firstKey", 
function(){
return this.sm.firstKey();
});
Clazz_defineMethod(c$, "lastKey", 
function(){
return this.sm.lastKey();
});
/*eoif3*/})();
c$.EMPTY_ENUMERATION = null;
c$.EMPTY_ITERATOR = null;
c$.EMPTY_LIST =  new java.util.Collections.EmptyList();
c$.EMPTY_SET =  new java.util.Collections.EmptySet();
c$.EMPTY_MAP =  new java.util.Collections.EmptyMap();
});
;//5.0.1-v7 Fri Nov 21 04:39:22 CST 2025
(function(){
var c$ = Clazz_declareType(java.util, "Dictionary", null);
})();
;//5.0.1-v7 Fri Nov 21 04:39:22 CST 2025
Clazz_load(["java.util.AbstractCollection", "$.AbstractSet", "$.Dictionary", "$.Enumeration", "$.Iterator", "$.Map"], "java.util.Hashtable", ["java.util.Collections"], function(){
var c$ = Clazz_decorateAsClass(function(){
this.table = null;
this.count = 0;
this.threshold = 0;
this.loadFactor = 0;
this.modCount = 0;
this.$keySet = null;
this.$entrySet = null;
this.$values = null;
this.__m = null;
this.__allowJS = false;
Clazz_instantialize(this, arguments);}, java.util, "Hashtable", java.util.Dictionary, [java.util.Map, Cloneable]);
Clazz_makeConstructor(c$, 
function(){
this.initHT();
});
Clazz_defineMethod(c$, "initHT", 
function(){
var map = null;
var capacity = 11;
var loadFactor = 0.75;
{
capacity = arguments[0];
loadFactor = arguments[1];
if (typeof capacity == "object") {
map = capacity;
capacity = Math.max(2*t.size(), 11);
this.__allowJS = map.__allowJS;
} else {
this.__allowJS = true;
}
capacity = (capacity || 11);
loadFactor = (loadFactor || 0.75);
}if (capacity < 0) throw  new IllegalArgumentException("Illegal Capacity: " + capacity);
if (loadFactor <= 0 || Float.isNaN(loadFactor)) throw  new IllegalArgumentException("Illegal Load: " + loadFactor);
if (capacity == 0) capacity = 1;
this.loadFactor = loadFactor;
this.table =  new Array(capacity);
this.threshold = Clazz_floatToInt(Math.min(capacity * loadFactor, 2147483640));
this.__setJS();
if (map != null) this.putAll(map);
});
Clazz_overrideMethod(c$, "size", 
function(){
var c = this.count;
{
c = this.__m && this.__m.size || c;
}return c;
});
Clazz_overrideMethod(c$, "isEmpty", 
function(){
return this.size() == 0;
});
Clazz_overrideMethod(c$, "keys", 
function(){
return this.getEnumeration(0);
});
Clazz_overrideMethod(c$, "elements", 
function(){
return this.getEnumeration(1);
});
Clazz_defineMethod(c$, "contains", 
function(value){
if (value == null) {
throw  new NullPointerException();
}if (this.size() == 0) return false;
if (java.util.Hashtable.__isSimple(this)) {
var m = this.__m;
{
var iter = m.values();
for (var n = iter.next(); !n.done; n = iter.next()) {
if (n.value == value || n.value.equals(value)) {
return true;
}
}
}} else {
var tab = this.table;
for (var i = tab.length; i-- > 0; ) {
for (var e = tab[i]; e != null; e = e.next_) {
if (e.value.equals(value)) {
return true;
}}
}
}return false;
}, "~O");
Clazz_overrideMethod(c$, "containsValue", 
function(value){
return this.contains(value);
}, "~O");
Clazz_overrideMethod(c$, "containsKey", 
function(key){
switch (java.util.Hashtable.__hasKey(this, key)) {
case 0:
break;
case 1:
java.util.Hashtable.__ensureJavaMap(this);
break;
case 2:
return false;
case 3:
return true;
}
var tab = this.table;
var hash = key.hashCode();
var index = (hash & 0x7FFFFFFF) % tab.length;
for (var e = tab[index]; e != null; e = e.next_) {
if ((e.hash == hash) && e.key.equals(key)) {
return true;
}}
return false;
}, "~O");
Clazz_overrideMethod(c$, "get", 
function(key){
if (key == null) return null;
switch (java.util.Hashtable.__hasKey(this, key)) {
case 0:
break;
case 1:
java.util.Hashtable.__ensureJavaMap(this);
break;
case 2:
return null;
case 3:
var v = null;
{
v = this.__m.get(key);
}return v;
}
var tab = this.table;
var hash = key.hashCode();
var index = (hash & 0x7FFFFFFF) % tab.length;
for (var e = tab[index]; e != null; e = e.next_) {
if ((e.hash == hash) && e.key.equals(key)) {
return e.value;
}}
return null;
}, "~O");
Clazz_defineMethod(c$, "rehash", 
function(){
var oldCapacity = this.table.length;
var oldMap = this.table;
var newCapacity = (oldCapacity << 1) + 1;
if (newCapacity - 2147483639 > 0) {
if (oldCapacity == 2147483639) return;
newCapacity = 2147483639;
}var newMap =  new Array(newCapacity);
this.modCount++;
this.threshold = Clazz_floatToInt(Math.min(newCapacity * this.loadFactor, 2147483640));
this.table = newMap;
for (var i = oldCapacity; i-- > 0; ) {
for (var old = oldMap[i]; old != null; ) {
var e = old;
old = old.next_;
var index = (e.hash & 0x7FFFFFFF) % newCapacity;
e.next_ = newMap[index];
newMap[index] = e;
}
}
});
Clazz_defineMethod(c$, "addEntry", 
function(hash, key, value, index){
this.modCount++;
var tab = this.table;
if (this.count >= this.threshold) {
this.rehash();
tab = this.table;
hash = key.hashCode();
index = (hash & 0x7FFFFFFF) % tab.length;
}var e = tab[index];
tab[index] =  new java.util.Hashtable.Entry(hash, key, value, e);
this.count++;
}, "~N,~O,~O,~N");
Clazz_overrideMethod(c$, "put", 
function(key, value){
if (value == null) {
throw  new NullPointerException();
}switch (java.util.Hashtable.__hasKey(this, key)) {
case 0:
break;
case 1:
java.util.Hashtable.__ensureJavaMap(this);
break;
case 2:
{
this.__m.set(key, value);
}++this.modCount;
return null;
case 3:
var v0 = null;
{
v0 = this.__m.get(key);
this.__m.set(key, value);
}++this.modCount;
return v0;
}
var tab = this.table;
var hash = key.hashCode();
var index = (hash & 0x7FFFFFFF) % tab.length;
var entry = tab[index];
for (; entry != null; entry = entry.next_) {
if ((entry.hash == hash) && entry.key.equals(key)) {
var old = entry.value;
entry.value = value;
return old;
}}
this.addEntry(hash, key, value, index);
return null;
}, "~O,~O");
Clazz_overrideMethod(c$, "remove", 
function(key){
if (key == null) throw  new NullPointerException("Hashtable key may not be null");
switch (java.util.Hashtable.__hasKey(this, key)) {
case 0:
break;
case 1:
java.util.Hashtable.__ensureJavaMap(this);
break;
case 2:
return null;
case 3:
var v0 = null;
{
v0 = this.__m.get(key); this.__m["delete"](key);
}++this.modCount;
return v0;
}
var tab = this.table;
var hash = key.hashCode();
var index = (hash & 0x7FFFFFFF) % tab.length;
var e = tab[index];
for (var prev = null; e != null; prev = e, e = e.next_) {
if ((e.hash == hash) && e.key.equals(key)) {
this.modCount++;
if (prev != null) {
prev.next_ = e.next_;
} else {
tab[index] = e.next_;
}this.count--;
var oldValue = e.value;
e.value = null;
return oldValue;
}}
return null;
}, "~O");
Clazz_overrideMethod(c$, "putAll", 
function(t){
var key = null;
var value = null;
if (java.util.Hashtable.__isSimple(t)) {
var me = this;
{
t.__m.forEach(function(value, key) { me.put(key, value); })
}return;
}for (var e, $e = t.entrySet().iterator (); $e.hasNext()&& ((e = $e.next ()) || true);) this.put(e.getKey(), e.getValue());

}, "java.util.Map");
Clazz_overrideMethod(c$, "clear", 
function(){
var tab = this.table;
this.modCount++;
if (java.util.Hashtable.__isSimple(this)) {
{
this.__m.clear();
}}this.__setJS();
for (var index = tab.length; --index >= 0; ) tab[index] = null;

this.count = 0;
});
Clazz_defineMethod(c$, "clone", 
function(){
try {
var t = Clazz_superCall(this, java.util.Hashtable, "clone", []);
t.table =  new Array(this.table.length);
for (var i = this.table.length; i-- > 0; ) {
t.table[i] = (this.table[i] != null) ? this.table[i].clone() : null;
}
t.$keySet = null;
t.$entrySet = null;
t.$values = null;
t.modCount = 0;
if (java.util.Hashtable.__isSimple(this)) {
t.__setJS();
var me = this;
{
me.__m.forEach(function(value, key) {
t.__m.set(key, value); t.modCount++;
});
}} else {
t.__m = null;
}return t;
} catch (e) {
if (Clazz_exceptionOf(e,"CloneNotSupportedException")){
throw  new InternalError(e);
} else {
throw e;
}
}
});
Clazz_overrideMethod(c$, "toString", 
function(){
var max = this.size() - 1;
if (max == -1) return "{}";
var it = this.entrySet().iterator();
var sb = "{";
for (var i = 0; ; i++) {
var e = it.next();
var key = e.getKey();
var value = e.getValue();
sb += (key === this ? "(this Map)" : key.toString());
sb += "=";
sb += (value === this ? "(this Map)" : value.toString());
if (i == max) return sb + '}';
sb += ", ";
}
});
Clazz_overrideMethod(c$, "equals", 
function(o){
if (o === this) return true;
if (!(Clazz_instanceOf(o,"java.util.Map"))) return false;
var t = o;
if (t.size() != this.size()) return false;
try {
var i = this.entrySet().iterator();
while (i.hasNext()) {
var e = i.next();
var key = e.getKey();
var value = e.getValue();
if (value == null) {
if (!(t.get(key) == null && t.containsKey(key))) return false;
} else {
if (!value.equals(t.get(key))) return false;
}}
} catch (e$$) {
if (Clazz_exceptionOf(e$$,"ClassCastException")){
var unused = e$$;
{
return false;
}
} else if (Clazz_exceptionOf(e$$, NullPointerException)){
var unused = e$$;
{
return false;
}
} else {
throw e$$;
}
}
return true;
}, "~O");
Clazz_overrideMethod(c$, "hashCode", 
function(){
var h = 0;
if (this.count == 0 || this.loadFactor < 0) return h;
this.loadFactor = -this.loadFactor;
var tab = this.table;
for (var entry, $entry = 0, $$entry = tab; $entry < $$entry.length && ((entry = $$entry[$entry]) || true); $entry++) {
while (entry != null) {
h += entry.hashCode();
entry = entry.next_;
}
}
this.loadFactor = -this.loadFactor;
return h;
});
Clazz_defineMethod(c$, "getEnumeration", 
function(type){
if (this.size() == 0) {
return java.util.Collections.emptyEnumeration();
} else {
return  new java.util.Hashtable.Enumerator(this, type, false);
}}, "~N");
Clazz_defineMethod(c$, "getIterator", 
function(type){
if (this.size() == 0) {
return java.util.Collections.emptyIterator();
} else {
return  new java.util.Hashtable.Enumerator(this, type, true);
}}, "~N");
Clazz_overrideMethod(c$, "keySet", 
function(){
if (this.$keySet == null) this.$keySet =  new java.util.Hashtable.KeySet(this);
return this.$keySet;
});
Clazz_overrideMethod(c$, "entrySet", 
function(){
if (this.$entrySet == null) this.$entrySet =  new java.util.Hashtable.EntrySet(this);
return this.$entrySet;
});
Clazz_overrideMethod(c$, "values", 
function(){
if (this.$values == null) this.$values =  new java.util.Hashtable.ValueCollection(this);
return this.$values;
});
Clazz_defineMethod(c$, "__setJS", 
function(){
if (this.__allowJS && java.util.Hashtable.USE_SIMPLE) {
var m = null;
{
m = new Map();
}this.__m = m;
} else {
this.__m = null;
}});
c$.__get = Clazz_defineMethod(c$, "__get", 
function(map, key){
{
return map.__m.get(key == null ? null : key + "")
}}, "~O,~O");
c$.__set = Clazz_defineMethod(c$, "__set", 
function(map, key, value){
{
map.__m.set(key == null ? null : key + "", value)
}}, "java.util.Map,~O,~O");
c$.__hasKey = Clazz_defineMethod(c$, "__hasKey", 
function(map, key){
{
return (!map.__m ? 0 : key != null && typeof key != "string"
? 1 : map.__m.has(key) ? 3 : 2);
}}, "java.util.Map,~O");
c$.__isSimple = Clazz_defineMethod(c$, "__isSimple", 
function(map){
{
return !!map.__m;
}}, "java.util.Map");
c$.__ensureJavaMap = Clazz_defineMethod(c$, "__ensureJavaMap", 
function(map){
{
if (map.__m) {
var m = map.__m;
map.__m = null;
m.forEach(function(value, key){map.put(key, value);});
m.clear();
}
}}, "java.util.Map");
/*if3*/;(function(){
var c$ = Clazz_decorateAsClass(function(){
this.hash = 0;
this.key = null;
this.value = null;
this.next_ = null;
Clazz_instantialize(this, arguments);}, java.util.Hashtable, "Entry", null, java.util.Map.Entry);
Clazz_makeConstructor(c$, 
function(hash, key, value, next){
this.hash = hash;
this.key = key;
this.value = value;
this.next_ = next;
}, "~N,~O,~O,java.util.Hashtable.Entry");
Clazz_overrideMethod(c$, "clone", 
function(){
return  new java.util.Hashtable.Entry(this.hash, this.key, this.value, (this.next_ == null ? null : this.next_.clone()));
});
Clazz_overrideMethod(c$, "getKey", 
function(){
return this.key;
});
Clazz_overrideMethod(c$, "getValue", 
function(){
return this.value;
});
Clazz_overrideMethod(c$, "setValue", 
function(value){
if (value == null) throw  new NullPointerException();
var oldValue = this.value;
this.value = value;
return oldValue;
}, "~O");
Clazz_overrideMethod(c$, "equals", 
function(o){
if (!(Clazz_instanceOf(o,"java.util.Map.Entry"))) return false;
var e = o;
return (this.key == null ? e.getKey() == null : this.key.equals(e.getKey())) && (this.value == null ? e.getValue() == null : this.value.equals(e.getValue()));
}, "~O");
Clazz_overrideMethod(c$, "hashCode", 
function(){
return this.hash ^ (this.value == null ? 0 : this.value.hashCode());
});
Clazz_defineMethod(c$, "toString", 
function(){
return this.key.toString() + "=" + this.value.toString();
});
/*eoif3*/})();
/*if3*/;(function(){
var c$ = Clazz_decorateAsClass(function(){
this.ht = null;
Clazz_instantialize(this, arguments);}, java.util.Hashtable, "KeySet", java.util.AbstractSet);
Clazz_makeConstructor(c$, 
function(ht){
Clazz_superConstructor (this, java.util.Hashtable.KeySet, []);
this.ht = ht;
}, "java.util.Hashtable");
Clazz_overrideMethod(c$, "iterator", 
function(){
return this.ht.getIterator(0);
});
Clazz_overrideMethod(c$, "size", 
function(){
return this.ht.size();
});
Clazz_overrideMethod(c$, "contains", 
function(o){
return this.ht.containsKey(o);
}, "~O");
Clazz_overrideMethod(c$, "remove", 
function(o){
return this.ht.remove(o) != null;
}, "~O");
Clazz_overrideMethod(c$, "clear", 
function(){
this.ht.clear();
});
/*eoif3*/})();
/*if3*/;(function(){
var c$ = Clazz_decorateAsClass(function(){
this.ht = null;
Clazz_instantialize(this, arguments);}, java.util.Hashtable, "EntrySet", java.util.AbstractSet);
Clazz_makeConstructor(c$, 
function(ht){
Clazz_superConstructor (this, java.util.Hashtable.EntrySet, []);
this.ht = ht;
}, "java.util.Hashtable");
Clazz_overrideMethod(c$, "iterator", 
function(){
return this.ht.getIterator(2);
});
Clazz_overrideMethod(c$, "contains", 
function(o){
if (!(Clazz_instanceOf(o,"java.util.Map.Entry"))) return false;
var entry = o;
var key = entry.getKey();
switch (java.util.Hashtable.__hasKey(this.ht, key)) {
case 0:
break;
case 1:
java.util.Hashtable.__ensureJavaMap(this.ht);
break;
case 3:
var value = entry.getValue();
var v = this.ht.get(key);
return (value === v || value != null && value.equals(key));
case 2:
return false;
}
var tab = this.ht.table;
var hash = key.hashCode();
var index = (hash & 0x7FFFFFFF) % tab.length;
for (var e = tab[index]; e != null; e = e.next_) if (e.hash == hash && e.equals(entry)) return true;

return false;
}, "~O");
Clazz_overrideMethod(c$, "remove", 
function(o){
if (!(Clazz_instanceOf(o,"java.util.Map.Entry"))) return false;
var entry = o;
var key = entry.getKey();
switch (java.util.Hashtable.__hasKey(this.ht, key)) {
case 0:
break;
case 1:
java.util.Hashtable.__ensureJavaMap(this.ht);
break;
case 3:
var value = entry.getValue();
if (value == null) return false;
var v = this.ht.get(key);
if (v === value || v.equals(value)) {
this.ht.remove(key);
return true;
}return false;
case 2:
return false;
}
var tab = this.ht.table;
var hash = key.hashCode();
var index = (hash & 0x7FFFFFFF) % tab.length;
var e = tab[index];
for (var prev = null; e != null; prev = e, e = e.next_) {
if (e.hash == hash && e.equals(entry)) {
this.ht.modCount++;
if (prev != null) prev.next_ = e.next_;
 else tab[index] = e.next_;
this.ht.count--;
e.value = null;
return true;
}}
return false;
}, "~O");
Clazz_overrideMethod(c$, "size", 
function(){
return this.ht.size();
});
Clazz_overrideMethod(c$, "clear", 
function(){
this.ht.clear();
});
/*eoif3*/})();
/*if3*/;(function(){
var c$ = Clazz_decorateAsClass(function(){
this.ht = null;
Clazz_instantialize(this, arguments);}, java.util.Hashtable, "ValueCollection", java.util.AbstractCollection);
Clazz_makeConstructor(c$, 
function(ht){
Clazz_superConstructor (this, java.util.Hashtable.ValueCollection, []);
this.ht = ht;
}, "java.util.Hashtable");
Clazz_overrideMethod(c$, "iterator", 
function(){
return this.ht.getIterator(1);
});
Clazz_overrideMethod(c$, "size", 
function(){
return this.ht.size();
});
Clazz_overrideMethod(c$, "contains", 
function(o){
return this.ht.containsValue(o);
}, "~O");
Clazz_overrideMethod(c$, "clear", 
function(){
this.ht.clear();
});
/*eoif3*/})();
/*if3*/;(function(){
var c$ = Clazz_decorateAsClass(function(){
this.table = null;
this.index = 0;
this.next_ = null;
this.current = null;
this.type = 0;
this.jsMapIterator = null;
this.ht = null;
this.isIterator = false;
this.expectedModCount = 0;
Clazz_instantialize(this, arguments);}, java.util.Hashtable, "Enumerator", null, [java.util.Enumeration, java.util.Iterator]);
Clazz_makeConstructor(c$, 
function(ht, type, iterator){
this.ht = ht;
this.table = ht.table;
this.index = ht.table.length;
this.type = type;
this.isIterator = iterator;
this.expectedModCount = ht.modCount;
if (java.util.Hashtable.__isSimple(ht)) {
var m = ht.__m;
{
this.jsMapIterator = m.entries();
this.next_ = this.jsMapIterator.next();
}}}, "java.util.Hashtable,~N,~B");
Clazz_overrideMethod(c$, "hasMoreElements", 
function(){
if (java.util.Hashtable.__isSimple(this.ht)) {
var b = false;
{
b = this.next_ && !this.next_.done
}return b;
} else {
var e = this.next_;
var i = this.index;
var t = this.table;
while (e == null && i > 0) {
e = t[--i];
}
this.next_ = e;
this.index = i;
return e != null;
}});
Clazz_overrideMethod(c$, "nextElement", 
function(){
var node = this.next_;
if (java.util.Hashtable.__isSimple(this.ht)) {
var t = this.type;
this.current = node;
var n = null;
{
n = this.jsMapIterator.next() || null;
}this.next_ = n;
if (node != null) {
var k = null;
var v = null;
var done = false;
{
done = node.done;
if (!done) {
if (t < 2) return node.value[t];
k = node.value[0];
v = node.value[1];
}
}if (!done) {
return ((Clazz_isClassDefined("java.util.Hashtable$Enumerator$1") ? 0 : java.util.Hashtable.Enumerator.$Hashtable$Enumerator$1$ ()), Clazz_innerTypeInstance(java.util.Hashtable$Enumerator$1, this, null, 0, k, v, null));
}}} else {
var i = this.index;
var t = this.table;
while (node == null && i > 0) {
node = t[--i];
}
this.next_ = node;
this.index = i;
if (node != null) {
var e = this.current = this.next_;
this.next_ = e.next_;
return this.type == 0 ? e.key : (this.type == 1 ? e.value : e);
}}throw  new java.util.NoSuchElementException("Hashtable Enumerator");
});
Clazz_overrideMethod(c$, "hasNext", 
function(){
return this.hasMoreElements();
});
Clazz_overrideMethod(c$, "next", 
function(){
if (this.ht.modCount != this.expectedModCount) throw  new java.util.ConcurrentModificationException();
return this.nextElement();
});
Clazz_overrideMethod(c$, "remove", 
function(){
if (!this.isIterator) throw  new UnsupportedOperationException();
var p = this.current;
if (p == null) throw  new IllegalStateException("Hashtable Enumerator");
if (this.ht.modCount != this.expectedModCount) throw  new java.util.ConcurrentModificationException();
if (java.util.Hashtable.__isSimple(this.ht)) {
var key = null;
{
key = p.value[0];
}this.ht.remove(key);
this.expectedModCount++;
} else {
{
var tab = this.ht.table;
var index = (this.current.hash & 0x7FFFFFFF) % tab.length;
var e = tab[index];
for (var prev = null; e != null; prev = e, e = e.next_) {
if (e === this.current) {
this.ht.modCount++;
this.expectedModCount++;
if (prev == null) tab[index] = e.next_;
 else prev.next_ = e.next_;
this.ht.count--;
this.current = null;
return;
}}
throw  new java.util.ConcurrentModificationException();
}}});
c$.$Hashtable$Enumerator$1$=function(){
/*if5*/;(function(){
var c$ = Clazz_declareAnonymous(java.util, "Hashtable$Enumerator$1", java.util.Hashtable.Entry);
Clazz_overrideMethod(c$, "setValue", 
function(value){
var m = this.b$["java.util.Hashtable.Enumerator"].ht.modCount;
var v = this.b$["java.util.Hashtable.Enumerator"].ht.put(this.getKey(), value);
this.b$["java.util.Hashtable.Enumerator"].ht.modCount = m;
return v;
}, "~O");
/*eoif5*/})();
};
/*eoif3*/})();
c$.USE_SIMPLE = true;
});
;//5.0.1-v7 Fri Nov 21 04:39:22 CST 2025
Clazz_load(["java.util.Map"], "java.util.MapEntry", null, function(){
var c$ = Clazz_decorateAsClass(function(){
this.key = null;
this.value = null;
Clazz_instantialize(this, arguments);}, java.util, "MapEntry", null, [java.util.Map.Entry, Cloneable]);
Clazz_makeConstructor(c$, 
function(theKey){
this.key = theKey;
}, "~O");
Clazz_makeConstructor(c$, 
function(theKey, theValue){
this.key = theKey;
this.value = theValue;
}, "~O,~O");
Clazz_defineMethod(c$, "clone", 
function(){
try {
return Clazz_superCall(this, java.util.MapEntry, "clone", []);
} catch (e) {
if (Clazz_exceptionOf(e,"CloneNotSupportedException")){
return null;
} else {
throw e;
}
}
});
Clazz_overrideMethod(c$, "equals", 
function(object){
if (this === object) {
return true;
}if (Clazz_instanceOf(object,"java.util.Map.Entry")) {
var entry = object;
return (this.key == null ? entry.getKey() == null : this.key.equals(entry.getKey())) && (this.value == null ? entry.getValue() == null : this.value.equals(entry.getValue()));
}return false;
}, "~O");
Clazz_overrideMethod(c$, "getKey", 
function(){
return this.key;
});
Clazz_overrideMethod(c$, "getValue", 
function(){
return this.value;
});
Clazz_overrideMethod(c$, "hashCode", 
function(){
return (this.key == null ? 0 : this.key.hashCode()) ^ (this.value == null ? 0 : this.value.hashCode());
});
Clazz_overrideMethod(c$, "setValue", 
function(object){
var result = this.value;
this.value = object;
return result;
}, "~O");
Clazz_overrideMethod(c$, "toString", 
function(){
return this.key + "=" + this.value;
});
Clazz_declareInterface(java.util.MapEntry, "Type");
});
;//5.0.1-v7 Fri Nov 21 04:39:22 CST 2025
Clazz_load(["java.util.Hashtable"], "java.util.Properties", null, function(){
var c$ = Clazz_decorateAsClass(function(){
this.builder = null;
this.defaults = null;
Clazz_instantialize(this, arguments);}, java.util, "Properties", java.util.Hashtable);
Clazz_makeConstructor(c$, 
function(){
Clazz_superConstructor (this, java.util.Properties, []);
});
Clazz_makeConstructor(c$, 
function(properties){
this.initHT();
this.defaults = (properties == null ? null : properties);
}, "java.util.Properties");
Clazz_defineMethod(c$, "dumpString", 
function(buffer, string, key){
var i = 0;
if (!key && i < string.length && string.charAt(i) == ' ') {
buffer += ("\\ ");
i++;
}for (; i < string.length; i++) {
var ch = string.charAt(i);
switch ((ch).charCodeAt(0)) {
case 9:
buffer += ("\\t");
break;
case 10:
buffer += ("\\n");
break;
case 12:
buffer += ("\\f");
break;
case 13:
buffer += ("\\r");
break;
default:
if ("\\#!=:".indexOf(ch) >= 0 || (key && ch == ' ')) {
buffer += ('\\');
}if (ch >= ' ' && ch <= '~') {
buffer += (ch);
} else {
var hex = Integer.toHexString(ch.charCodeAt(0));
buffer += ("\\u");
for (var j = 0; j < 4 - hex.length; j++) {
buffer += ("0");
}
buffer += (hex);
}}
}
return buffer;
}, "~S,~S,~B");
Clazz_defineMethod(c$, "getProperty", 
function(name){
var result = this.get(name);
var property = (typeof(result)=='string') ? result : null;
if (property == null && this.defaults != null) {
property = this.defaults.getProperty(name);
}return property;
}, "~S");
Clazz_defineMethod(c$, "getProperty", 
function(name, defaultValue){
var result = this.get(name);
var property = (typeof(result)=='string') ? result : null;
if (property == null && this.defaults != null) {
property = this.defaults.getProperty(name);
}if (property == null) {
return defaultValue;
}return property;
}, "~S,~S");
Clazz_defineMethod(c$, "list", 
function(out){
if (out == null) {
throw  new NullPointerException();
}var buffer = "";
var keys = this.propertyNames();
while (keys.hasMoreElements()) {
var key = keys.nextElement();
buffer += (key);
buffer += ('=');
var property = this.get(key);
var def = this.defaults;
while (property == null) {
property = def.get(key);
def = def.defaults;
}
if (property.length > 40) {
buffer += (property.substring(0, 37));
buffer += ("...");
} else {
buffer += (property);
}out.println(buffer.toString());
buffer = "";
}
}, "java.io.PrintStream");
Clazz_defineMethod(c$, "list", 
function(writer){
if (writer == null) {
throw  new NullPointerException();
}var buffer = "";
var keys = this.propertyNames();
while (keys.hasMoreElements()) {
var key = keys.nextElement();
buffer += (key);
buffer += ('=');
var property = this.get(key);
var def = this.defaults;
while (property == null) {
property = def.get(key);
def = def.defaults;
}
if (property.length > 40) {
buffer += (property.substring(0, 37));
buffer += ("...");
} else {
buffer += (property);
}writer.println(buffer.toString());
buffer = "";
}
}, "java.io.PrintWriter");
Clazz_defineMethod(c$, "load", 
function($in){

}, "java.io.InputStream");
Clazz_defineMethod(c$, "propertyNames", 
function(){
if (this.defaults == null) {
return this.keys();
}var set =  new java.util.Hashtable(this.defaults.size() + this.size());
var keys = this.defaults.propertyNames();
while (keys.hasMoreElements()) {
set.put(keys.nextElement(), set);
}
keys = this.keys();
while (keys.hasMoreElements()) {
set.put(keys.nextElement(), set);
}
return set.keys();
});
Clazz_defineMethod(c$, "save", 
function(out, comment){
try {
this.store(out, comment);
} catch (e) {
if (Clazz_exceptionOf(e,"java.io.IOException")){
} else {
throw e;
}
}
}, "java.io.OutputStream,~S");
Clazz_defineMethod(c$, "setProperty", 
function(name, value){
return this.put(name, value);
}, "~S,~S");
Clazz_defineMethod(c$, "store", 
function(out, comment){

}, "java.io.OutputStream,~S");
Clazz_defineMethod(c$, "loadFromXML", 
function($in){

}, "java.io.InputStream");
Clazz_defineMethod(c$, "storeToXML", 
function(os, comment){

}, "java.io.OutputStream,~S");
Clazz_defineMethod(c$, "storeToXML", 
function(os, comment, encoding){

}, "java.io.OutputStream,~S,~S");
Clazz_defineMethod(c$, "substitutePredefinedEntries", 
function(s){
return s.replaceAll("&", "&amp;").replaceAll("<", "&lt;").replaceAll(">", "&gt;").replaceAll("\u0027", "&apos;").replaceAll("\"", "&quot;");
}, "~S");
c$.lineSeparator = null;
});
;//5.0.1-v7 Fri Nov 21 04:39:22 CST 2025
Clazz_declareInterface(java.util, "SortedMap", java.util.Map);
;//5.0.1-v7 Fri Nov 21 04:39:22 CST 2025
Clazz_declareInterface(java.util, "SortedSet", java.util.Set);
;//5.0.1-v7 Fri Nov 21 04:39:22 CST 2025
Clazz_load(["java.util.Enumeration"], "java.util.StringTokenizer", null, function(){
var c$ = Clazz_decorateAsClass(function(){
this.string = null;
this.delimiters = null;
this.returnDelimiters = false;
this.position = 0;
Clazz_instantialize(this, arguments);}, java.util, "StringTokenizer", null, java.util.Enumeration);
Clazz_makeConstructor(c$, 
function(string, delimiters, returnDelimiters){
{
switch (arguments.length) {
case 1: delimiters = " \t\n\r\f";
case 2: returnDelimiters = false;
}
}if (string == null) throw  new NullPointerException();
this.string = string;
this.delimiters = delimiters;
this.returnDelimiters = returnDelimiters;
this.position = 0;
}, "~S,~S,~B");
Clazz_defineMethod(c$, "countTokens", 
function(){
var count = 0;
var inToken = false;
for (var i = this.position, length = this.string.length; i < length; i++) {
if (this.delimiters.indexOf(this.string.charAt(i), 0) >= 0) {
if (this.returnDelimiters) count++;
if (inToken) {
count++;
inToken = false;
}} else {
inToken = true;
}}
if (inToken) count++;
return count;
});
Clazz_overrideMethod(c$, "hasMoreElements", 
function(){
return this.hasMoreTokens();
});
Clazz_defineMethod(c$, "hasMoreTokens", 
function(){
var length = this.string.length;
if (this.position < length) {
if (this.returnDelimiters) return true;
for (var i = this.position; i < length; i++) if (this.delimiters.indexOf(this.string.charAt(i), 0) == -1) return true;

}return false;
});
Clazz_overrideMethod(c$, "nextElement", 
function(){
return this.nextToken();
});
Clazz_defineMethod(c$, "nextToken", 
function(){
{
(arguments.length == 1) && (this.delimiters = arguments[0]);
}var i = this.position;
var length = this.string.length;
if (i < length) {
if (this.returnDelimiters) {
if (this.delimiters.indexOf(this.string.charAt(this.position), 0) >= 0) return String.valueOf(this.string.charAt(this.position++));
for (this.position++; this.position < length; this.position++) if (this.delimiters.indexOf(this.string.charAt(this.position), 0) >= 0) return this.string.substring(i, this.position);

return this.string.substring(i);
}while (i < length && this.delimiters.indexOf(this.string.charAt(i), 0) >= 0) i++;

this.position = i;
if (i < length) {
for (this.position++; this.position < length; this.position++) if (this.delimiters.indexOf(this.string.charAt(this.position), 0) >= 0) return this.string.substring(i, this.position);

return this.string.substring(i);
}}throw  new java.util.NoSuchElementException();
});
});
;//5.0.1-v7 Fri Nov 21 04:39:22 CST 2025
Clazz_declarePackage("javajs.api");
Clazz_declareInterface(javajs.api, "BytePoster");
;//5.0.1-v7 Mon Aug 17 10:07:10 MDT 2026
Clazz_declarePackage("javajs.api");
Clazz_declareInterface(javajs.api, "GenericColor");
;//5.0.1-v7 Mon Aug 17 10:07:10 MDT 2026
Clazz_declarePackage("J.api");
Clazz_declareInterface(J.api, "GenericFileInterface");
;//5.0.1-v7 Mon Aug 17 10:07:10 MDT 2026
Clazz_declarePackage("javajs.api");
Clazz_declareInterface(javajs.api, "GenericOutputChannel");
;//5.0.1-v7 Mon Aug 17 10:07:10 MDT 2026
Clazz_declarePackage("javajs.api");
Clazz_declareInterface(javajs.api, "JSInterface");
;//5.0.1-v7 Mon Aug 17 10:07:10 MDT 2026
Clazz_declarePackage("javajs.api");
Clazz_declareInterface(javajs.api, "JSONEncodable");
;//5.0.1-v7 Mon Aug 17 10:07:10 MDT 2026
Clazz_declarePackage("javajs.api");
Clazz_declareInterface(javajs.api, "ZInputStream");
;//5.0.1-v7 Mon Aug 17 10:07:10 MDT 2026
Clazz_declarePackage("javajs.api.js");
Clazz_declareInterface(javajs.api.js, "J2SObjectInterface");
;//5.0.1-v7 Mon Aug 17 10:07:10 MDT 2026
Clazz_declarePackage("J.api");
Clazz_declareInterface(J.api, "GenericMouseInterface");
;//5.0.1-v7 Mon Aug 17 10:07:10 MDT 2026
Clazz_declarePackage("J.api");
Clazz_load(["J.api.FontManager"], "J.api.GenericPlatform", null, function(){
var c$ = Clazz_declareInterface(J.api, "GenericPlatform", J.api.FontManager);
});
;//5.0.1-v7 Mon Aug 17 10:07:10 MDT 2026
Clazz_declarePackage("J.api");
Clazz_declareInterface(J.api, "PlatformViewer");
;//5.0.1-v7 Mon Aug 17 10:07:10 MDT 2026
Clazz_declarePackage("J.api");
Clazz_declareInterface(J.api, "EventManager");
;//5.0.1-v7 Mon Aug 17 10:07:10 MDT 2026
Clazz_declarePackage("J.api");
Clazz_declareInterface(J.api, "FontManager");
;//5.0.1-v7 Mon Aug 17 10:07:10 MDT 2026
Clazz_declarePackage("JU");
Clazz_load(null, "JU.Font", ["JU.AU"], function(){
var c$ = Clazz_decorateAsClass(function(){
this.fid = 0;
this.fontFace = null;
this.fontStyle = null;
this.fontSizeNominal = 0;
this.idFontFace = 0;
this.idFontStyle = 0;
this.fontSize = 0;
this.font = null;
this.fontMetrics = null;
this.manager = null;
this.ascent = 0;
this.descent = 0;
this.isBold = false;
this.isItalic = false;
this.fontSizeAngstroms = 0;
Clazz_instantialize(this, arguments);}, JU, "Font", null);
Clazz_makeConstructor(c$, 
function(manager, fid, idFontFace, idFontStyle, fontSize, fontSizeNominal, fontSizeAngstroms, graphics){
this.manager = manager;
this.fid = fid;
this.fontFace = JU.Font.fontFaces[idFontFace];
this.fontStyle = JU.Font.fontStyles[idFontStyle];
this.idFontFace = idFontFace;
this.idFontStyle = idFontStyle;
this.fontSize = fontSize;
this.fontSizeAngstroms = fontSizeAngstroms;
this.isBold = (idFontStyle & 1) == 1;
this.isItalic = (idFontStyle & 2) == 2;
this.fontSizeNominal = fontSizeNominal;
this.font = manager.newFont(JU.Font.fontFaces[idFontFace], this.isBold, this.isItalic, fontSize);
this.fontMetrics = manager.getFontMetrics(this, graphics);
this.descent = manager.getFontDescent(this.fontMetrics);
this.ascent = manager.getFontAscent(this.fontMetrics);
}, "J.api.FontManager,~N,~N,~N,~N,~N,~N,~O");
c$.getFont3D = Clazz_defineMethod(c$, "getFont3D", 
function(fontID){
return JU.Font.font3ds[fontID];
}, "~N");
c$.createFont3D = Clazz_defineMethod(c$, "createFont3D", 
function(fontface, fontstyle, fontsize, fontsizeNominal, fontSizeAngstroms, manager, graphicsForMetrics){
if (fontsize > 0xFF) fontsize = 0xFF;
if (fontsize < 0) {
fontSizeAngstroms = -fontsize;
fontsizeNominal = fontsize = 10;
}var fontsizeX16 = (Clazz_floatToInt(fontsize)) << 4;
var fontkey = ((fontface & 3) | ((fontstyle & 3) << 2) | (fontsizeX16 << 4));
for (var i = JU.Font.fontkeyCount; --i > 0; ) if (fontkey == JU.Font.fontkeys[i] && JU.Font.font3ds[i].fontSizeNominal == fontsizeNominal) return JU.Font.font3ds[i];

var fontIndexNext = JU.Font.fontkeyCount++;
if (fontIndexNext == JU.Font.fontkeys.length) {
JU.Font.fontkeys = JU.AU.arrayCopyI(JU.Font.fontkeys, fontIndexNext + 8);
JU.Font.font3ds = JU.AU.arrayCopyObject(JU.Font.font3ds, fontIndexNext + 8);
}var font3d =  new JU.Font(manager, fontIndexNext, fontface, fontstyle, fontsize, fontsizeNominal, fontSizeAngstroms, graphicsForMetrics);
JU.Font.font3ds[fontIndexNext] = font3d;
JU.Font.fontkeys[fontIndexNext] = fontkey;
return font3d;
}, "~N,~N,~N,~N,~N,J.api.FontManager,~O");
c$.getFontFaceID = Clazz_defineMethod(c$, "getFontFaceID", 
function(fontface){
return ("Monospaced".equalsIgnoreCase(fontface) ? 2 : "Serif".equalsIgnoreCase(fontface) ? 1 : 0);
}, "~S");
c$.getFontStyleID = Clazz_defineMethod(c$, "getFontStyleID", 
function(fontstyle){
for (var i = 4; --i >= 0; ) if (JU.Font.fontStyles[i].equalsIgnoreCase(fontstyle)) return i;

return -1;
}, "~S");
Clazz_defineMethod(c$, "getAscent", 
function(){
return this.ascent;
});
Clazz_defineMethod(c$, "getDescent", 
function(){
return this.descent;
});
Clazz_defineMethod(c$, "getHeight", 
function(){
return this.getAscent() + this.getDescent();
});
Clazz_defineMethod(c$, "getFontMetrics", 
function(){
return this.fontMetrics;
});
Clazz_defineMethod(c$, "stringWidth", 
function(text){
return this.manager.fontStringWidth(this, text);
}, "~S");
Clazz_defineMethod(c$, "getInfo", 
function(){
return (this.fontSizeAngstroms > 0 ? -this.fontSizeAngstroms : this.fontSizeNominal) + " " + this.fontFace + " " + this.fontStyle;
});
Clazz_overrideMethod(c$, "toString", 
function(){
return "[" + this.getInfo() + "]";
});
c$.fontkeyCount = 1;
c$.fontkeys =  Clazz_newIntArray (8, 0);
c$.font3ds =  new Array(8);
c$.fontFaces =  Clazz_newArray(-1, ["SansSerif", "Serif", "Monospaced", ""]);
c$.fontStyles =  Clazz_newArray(-1, ["Plain", "Bold", "Italic", "BoldItalic"]);
});
;//5.0.1-v7 Mon Aug 17 10:07:10 MDT 2026
Clazz_declarePackage("JS");
Clazz_load(["javajs.api.GenericColor"], "JS.Color", null, function(){
var c$ = Clazz_decorateAsClass(function(){
this.argb = 0;
Clazz_instantialize(this, arguments);}, JS, "Color", null, javajs.api.GenericColor);
Clazz_overrideMethod(c$, "addAlpha", 
function(a){
if (this.getOpacity255() != 0xFF) return this;
var c =  new JS.Color();
c.argb = (this.argb & 0xFFFFFF) | (a << 24);
return c;
}, "~N");
Clazz_overrideMethod(c$, "getRGB", 
function(){
return this.argb & 0x00FFFFFF;
});
Clazz_overrideMethod(c$, "getOpacity255", 
function(){
return ((this.argb >> 24) & 0xFF);
});
c$.get1 = Clazz_defineMethod(c$, "get1", 
function(rgb){
var c =  new JS.Color();
c.argb = rgb | 0xFF000000;
return c;
}, "~N");
c$.get3 = Clazz_defineMethod(c$, "get3", 
function(r, g, b){
return  new JS.Color().set4(r, g, b, 0xFF);
}, "~N,~N,~N");
c$.get4 = Clazz_defineMethod(c$, "get4", 
function(r, g, b, a){
return  new JS.Color().set4(r, g, b, a);
}, "~N,~N,~N,~N");
Clazz_defineMethod(c$, "set4", 
function(r, g, b, a){
this.argb = ((a << 24) | (r << 16) | (g << 8) | b) & 0xFFFFFFFF;
return this;
}, "~N,~N,~N,~N");
Clazz_overrideMethod(c$, "toString", 
function(){
var s = ("00000000" + Integer.toHexString(this.argb));
return "[0x" + s.substring(s.length - 8, s.length) + "]";
});
});
;//5.0.1-v7 Mon Aug 17 10:07:10 MDT 2026
Clazz_declarePackage("JS");
(function(){
var c$ = Clazz_decorateAsClass(function(){
this.width = 0;
this.height = 0;
Clazz_instantialize(this, arguments);}, JS, "Dimension", null);
Clazz_makeConstructor(c$, 
function(w, h){
this.set(w, h);
}, "~N,~N");
Clazz_defineMethod(c$, "set", 
function(w, h){
this.width = w;
this.height = h;
return this;
}, "~N,~N");
})();
;//5.0.1-v7 Mon Aug 17 10:07:10 MDT 2026
Clazz_declarePackage("J.awtjs");
(function(){
var c$ = Clazz_declareType(J.awtjs, "Event", null);
})();
;//5.0.1-v7 Mon Aug 17 10:07:10 MDT 2026
Clazz_declarePackage("J.api");
Clazz_declareInterface(J.api, "GenericMenuInterface");
;//5.0.1-v7 Mon Aug 17 10:07:10 MDT 2026
Clazz_declarePackage("JU");
Clazz_load(["JU.P3"], "JU.A4", ["JU.T3"], function(){
var c$ = Clazz_decorateAsClass(function(){
this.angle = 0;
Clazz_instantialize(this, arguments);}, JU, "A4", JU.P3);
Clazz_makeConstructor(c$, 
function(){
Clazz_superConstructor (this, JU.A4, []);
this.z = 1.0;
});
c$.new4 = Clazz_defineMethod(c$, "new4", 
function(x, y, z, angle){
var a =  new JU.A4();
a.set4(x, y, z, angle);
return a;
}, "~N,~N,~N,~N");
c$.newAA = Clazz_defineMethod(c$, "newAA", 
function(a1){
var a =  new JU.A4();
a.set4(a1.x, a1.y, a1.z, a1.angle);
return a;
}, "JU.A4");
c$.newVA = Clazz_defineMethod(c$, "newVA", 
function(axis, angle){
var a =  new JU.A4();
a.setVA(axis, angle);
return a;
}, "JU.V3,~N");
Clazz_defineMethod(c$, "setVA", 
function(axis, angle){
this.x = axis.x;
this.y = axis.y;
this.z = axis.z;
this.angle = angle;
}, "JU.V3,~N");
Clazz_defineMethod(c$, "set4", 
function(x, y, z, angle){
this.x = x;
this.y = y;
this.z = z;
this.angle = angle;
}, "~N,~N,~N,~N");
Clazz_defineMethod(c$, "setAA", 
function(a){
this.x = a.x;
this.y = a.y;
this.z = a.z;
this.angle = a.angle;
}, "JU.A4");
Clazz_defineMethod(c$, "setM", 
function(m1){
this.setFromMat(m1.m00, m1.m01, m1.m02, m1.m10, m1.m11, m1.m12, m1.m20, m1.m21, m1.m22);
}, "JU.M3");
Clazz_defineMethod(c$, "setFromMat", 
function(m00, m01, m02, m10, m11, m12, m20, m21, m22){
var cos = (m00 + m11 + m22 - 1.0) * 0.5;
this.x = (m21 - m12);
this.y = (m02 - m20);
this.z = (m10 - m01);
var sin = 0.5 * Math.sqrt(this.x * this.x + this.y * this.y + this.z * this.z);
if (sin == 0 && cos == 1) {
this.x = this.y = 0;
this.z = 1;
this.angle = 0;
} else {
this.angle = Math.atan2(sin, cos);
}}, "~N,~N,~N,~N,~N,~N,~N,~N,~N");
Clazz_overrideMethod(c$, "hashCode", 
function(){
return JU.T3.floatToIntBits(this.x) ^ JU.T3.floatToIntBits(this.y) ^ JU.T3.floatToIntBits(this.z) ^ JU.T3.floatToIntBits(this.angle);
});
Clazz_overrideMethod(c$, "equals", 
function(o){
if (!(Clazz_instanceOf(o,"JU.A4"))) return false;
var a1 = o;
return this.x == a1.x && this.y == a1.y && this.z == a1.z && this.angle == a1.angle;
}, "~O");
Clazz_overrideMethod(c$, "toString", 
function(){
return "(" + this.x + ", " + this.y + ", " + this.z + ", " + this.angle + ")";
});
Clazz_overrideMethod(c$, "toJSON", 
function(){
return "[" + this.x + "," + this.y + "," + this.z + "," + (this.angle * 180.0 / 3.141592653589793) + "]";
});
});
;//5.0.1-v7 Mon Aug 17 10:07:10 MDT 2026
Clazz_declarePackage("JU");
Clazz_load(["java.net.URLConnection"], "JU.AjaxURLConnection", ["JU.AU", "$.Rdr"], function(){
var c$ = Clazz_decorateAsClass(function(){
this.bytesOut = null;
this.postOut = "";
Clazz_instantialize(this, arguments);}, JU, "AjaxURLConnection", java.net.URLConnection);
Clazz_defineMethod(c$, "doAjax", 
function(){
var jmol = null;
{
jmol = Jmol;
}return jmol.doAjax(this.url, this.postOut, this.bytesOut, false);
});
Clazz_overrideMethod(c$, "connect", 
function(){
});
Clazz_defineMethod(c$, "outputBytes", 
function(bytes){
this.bytesOut = bytes;
}, "~A");
Clazz_defineMethod(c$, "outputString", 
function(post){
this.postOut = post;
}, "~S");
Clazz_overrideMethod(c$, "getInputStream", 
function(){
var is = null;
var o = this.doAjax();
if (JU.AU.isAB(o)) is = JU.Rdr.getBIS(o);
 else if (Clazz_instanceOf(o,"JU.SB")) is = JU.Rdr.getBIS(JU.Rdr.getBytesFromSB(o));
 else if ((typeof(o)=='string')) is = JU.Rdr.getBIS((o).getBytes());
return is;
});
Clazz_defineMethod(c$, "getContents", 
function(){
return this.doAjax();
});
});
;//5.0.1-v7 Mon Aug 17 10:07:10 MDT 2026
Clazz_declarePackage("JU");
Clazz_load(["java.net.URLStreamHandler"], "JU.AjaxURLStreamHandler", ["JU.AjaxURLConnection", "$.SB"], function(){
var c$ = Clazz_decorateAsClass(function(){
this.protocol = null;
Clazz_instantialize(this, arguments);}, JU, "AjaxURLStreamHandler", java.net.URLStreamHandler);
Clazz_makeConstructor(c$, 
function(protocol){
Clazz_superConstructor (this, JU.AjaxURLStreamHandler, []);
this.protocol = protocol;
}, "~S");
Clazz_defineMethod(c$, "openConnection", 
function(url){
return  new JU.AjaxURLConnection(url);
}, "java.net.URL");
Clazz_overrideMethod(c$, "toExternalForm", 
function(u){
var result =  new JU.SB();
result.append(u.getProtocol());
result.append(":");
if (u.getAuthority() != null && u.getAuthority().length > 0) {
result.append("//");
result.append(u.getAuthority());
}if (u.getPath() != null) {
result.append(u.getPath());
}if (u.getQuery() != null) {
result.append("?");
result.append(u.getQuery());
}if (u.getRef() != null) {
result.append("#");
result.append(u.getRef());
}return result.toString();
}, "java.net.URL");
});
;//5.0.1-v7 Mon Aug 17 10:07:10 MDT 2026
Clazz_declarePackage("JU");
Clazz_load(["java.net.URLStreamHandlerFactory", "java.util.Hashtable"], "JU.AjaxURLStreamHandlerFactory", ["JU.AjaxURLStreamHandler"], function(){
var c$ = Clazz_decorateAsClass(function(){
this.htFactories = null;
Clazz_instantialize(this, arguments);}, JU, "AjaxURLStreamHandlerFactory", null, java.net.URLStreamHandlerFactory);
Clazz_prepareFields (c$, function(){
this.htFactories =  new java.util.Hashtable();
});
Clazz_overrideMethod(c$, "createURLStreamHandler", 
function(protocol){
var fac = this.htFactories.get(protocol);
if (fac == null) this.htFactories.put(protocol, fac =  new JU.AjaxURLStreamHandler(protocol));
return (fac.protocol == null ? null : fac);
}, "~S");
});
;//5.0.1-v7 Mon Aug 17 10:07:10 MDT 2026
Clazz_declarePackage("JU");
Clazz_load(null, "JU.AU", ["java.lang.reflect.Array", "java.util.Arrays", "JU.Lst"], function(){
var c$ = Clazz_declareType(JU, "AU", null);
c$.ensureLength = Clazz_defineMethod(c$, "ensureLength", 
function(array, minimumLength){
return (array != null && JU.AU.getLength(array) >= minimumLength ? array : JU.AU.arrayCopyObject(array, minimumLength));
}, "~O,~N");
c$.ensureLengthS = Clazz_defineMethod(c$, "ensureLengthS", 
function(array, minimumLength){
return (array != null && array.length >= minimumLength ? array : JU.AU.arrayCopyS(array, minimumLength));
}, "~A,~N");
c$.ensureLengthA = Clazz_defineMethod(c$, "ensureLengthA", 
function(array, minimumLength){
return (array != null && array.length >= minimumLength ? array : JU.AU.arrayCopyF(array, minimumLength));
}, "~A,~N");
c$.ensureLengthI = Clazz_defineMethod(c$, "ensureLengthI", 
function(array, minimumLength){
return (array != null && array.length >= minimumLength ? array : JU.AU.arrayCopyI(array, minimumLength));
}, "~A,~N");
c$.ensureLengthShort = Clazz_defineMethod(c$, "ensureLengthShort", 
function(array, minimumLength){
return (array != null && array.length >= minimumLength ? array : JU.AU.arrayCopyShort(array, minimumLength));
}, "~A,~N");
c$.ensureLengthByte = Clazz_defineMethod(c$, "ensureLengthByte", 
function(array, minimumLength){
return (array != null && array.length >= minimumLength ? array : JU.AU.arrayCopyByte(array, minimumLength));
}, "~A,~N");
c$.doubleLength = Clazz_defineMethod(c$, "doubleLength", 
function(array){
return JU.AU.arrayCopyObject(array, (array == null ? 16 : 2 * JU.AU.getLength(array)));
}, "~O");
c$.doubleLengthS = Clazz_defineMethod(c$, "doubleLengthS", 
function(array){
return JU.AU.arrayCopyS(array, (array == null ? 16 : 2 * array.length));
}, "~A");
c$.doubleLengthF = Clazz_defineMethod(c$, "doubleLengthF", 
function(array){
return JU.AU.arrayCopyF(array, (array == null ? 16 : 2 * array.length));
}, "~A");
c$.doubleLengthI = Clazz_defineMethod(c$, "doubleLengthI", 
function(array){
return JU.AU.arrayCopyI(array, (array == null ? 16 : 2 * array.length));
}, "~A");
c$.doubleLengthShort = Clazz_defineMethod(c$, "doubleLengthShort", 
function(array){
return JU.AU.arrayCopyShort(array, (array == null ? 16 : 2 * array.length));
}, "~A");
c$.doubleLengthByte = Clazz_defineMethod(c$, "doubleLengthByte", 
function(array){
return JU.AU.arrayCopyByte(array, (array == null ? 16 : 2 * array.length));
}, "~A");
c$.doubleLengthBool = Clazz_defineMethod(c$, "doubleLengthBool", 
function(array){
return JU.AU.arrayCopyBool(array, (array == null ? 16 : 2 * array.length));
}, "~A");
c$.deleteElements = Clazz_defineMethod(c$, "deleteElements", 
function(array, firstElement, nElements){
if (nElements == 0 || array == null) return array;
var oldLength = JU.AU.getLength(array);
if (firstElement >= oldLength) return array;
var n = oldLength - (firstElement + nElements);
if (n < 0) n = 0;
var t = JU.AU.newInstanceO(array, firstElement + n);
if (firstElement > 0) System.arraycopy(array, 0, t, 0, firstElement);
if (n > 0) System.arraycopy(array, firstElement + nElements, t, firstElement, n);
return t;
}, "~O,~N,~N");
c$.arrayCopyObject = Clazz_defineMethod(c$, "arrayCopyObject", 
function(array, newLength){
var oldLength = (array == null ? -1 : JU.AU.getLength(array));
if (newLength < 0) newLength = oldLength;
if (newLength == oldLength) return array;
{
if (newLength < oldLength) return Clazz_newArray(-1, array, 0, newLength);
}var t = JU.AU.newInstanceO(array, newLength);
if (oldLength > 0) System.arraycopy(array, 0, t, 0, oldLength < newLength ? oldLength : newLength);
return t;
}, "~O,~N");
c$.newInstanceO = Clazz_defineMethod(c$, "newInstanceO", 
function(array, n){
if (JU.AU.isAI(array)) return  Clazz_newIntArray (n, 0);
{
if (!array.getClass || !array.getClass().getComponentType)
return new Array(n);
}return java.lang.reflect.Array.newInstance(array.getClass().getComponentType(), n);
}, "~O,~N");
c$.getLength = Clazz_defineMethod(c$, "getLength", 
function(array){
{
return array.length
}}, "~O");
c$.arrayCopyS = Clazz_defineMethod(c$, "arrayCopyS", 
function(array, newLength){
var oldLength = (array == null ? -1 : array.length);
if (newLength < 0) newLength = oldLength;
{
if (newLength < oldLength) return Clazz_newArray(-1, array, 0, newLength);
}var t =  new Array(newLength);
if (array != null) {
System.arraycopy(array, 0, t, 0, oldLength < newLength ? oldLength : newLength);
}return t;
}, "~A,~N");
c$.arrayCopyII = Clazz_defineMethod(c$, "arrayCopyII", 
function(array, newLength){
var t = JU.AU.newInt2(newLength);
if (array != null) {
var oldLength = array.length;
System.arraycopy(array, 0, t, 0, oldLength < newLength ? oldLength : newLength);
}return t;
}, "~A,~N");
c$.arrayCopyPt = Clazz_defineMethod(c$, "arrayCopyPt", 
function(array, newLength){
if (newLength < 0) newLength = array.length;
var t =  new Array(newLength);
if (array != null) {
var oldLength = array.length;
System.arraycopy(array, 0, t, 0, oldLength < newLength ? oldLength : newLength);
}return t;
}, "~A,~N");
c$.arrayCopyF = Clazz_defineMethod(c$, "arrayCopyF", 
function(array, newLength){
var oldLength = (array == null ? -1 : array.length);
if (newLength < 0) newLength = oldLength;
{
if (newLength < oldLength) return Clazz_newArray(-1, array, 0, newLength);
}var t =  Clazz_newFloatArray (newLength, 0);
if (array != null) {
System.arraycopy(array, 0, t, 0, oldLength < newLength ? oldLength : newLength);
}return t;
}, "~A,~N");
c$.arrayCopyI = Clazz_defineMethod(c$, "arrayCopyI", 
function(array, newLength){
var oldLength = (array == null ? -1 : array.length);
if (newLength < 0) newLength = oldLength;
{
if (newLength < oldLength) return Clazz_newArray(-1, array, 0, newLength);
}var t =  Clazz_newIntArray (newLength, 0);
if (array != null) {
System.arraycopy(array, 0, t, 0, oldLength < newLength ? oldLength : newLength);
}return t;
}, "~A,~N");
c$.arrayCopyRangeI = Clazz_defineMethod(c$, "arrayCopyRangeI", 
function(array, i0, n){
if (array == null) return null;
var oldLength = array.length;
if (n == -1) n = oldLength;
if (n == -2) n = Clazz_doubleToInt(oldLength / 2);
{
return Clazz_newArray(-1, array, i0, n);
}}, "~A,~N,~N");
c$.arrayCopyRangeRevI = Clazz_defineMethod(c$, "arrayCopyRangeRevI", 
function(array, i0, n){
if (array == null) return null;
{
return Clazz_newArray(-1, array, i0, n).reverse();
}}, "~A,~N,~N");
c$.arrayCopyShort = Clazz_defineMethod(c$, "arrayCopyShort", 
function(array, newLength){
var oldLength = (array == null ? -1 : array.length);
if (newLength < 0) newLength = oldLength;
{
if (newLength < oldLength) return Clazz_newArray(-1, array, 0, newLength);
}var t =  Clazz_newShortArray (newLength, 0);
if (array != null) {
System.arraycopy(array, 0, t, 0, oldLength < newLength ? oldLength : newLength);
}return t;
}, "~A,~N");
c$.arrayCopyByte = Clazz_defineMethod(c$, "arrayCopyByte", 
function(array, newLength){
var oldLength = (array == null ? -1 : array.length);
if (newLength < 0) newLength = oldLength;
{
if (newLength < oldLength) return Clazz_newArray(-1, array, 0, newLength);
}var t =  Clazz_newByteArray (newLength, 0);
if (array != null) {
System.arraycopy(array, 0, t, 0, oldLength < newLength ? oldLength : newLength);
}return t;
}, "~A,~N");
c$.arrayCopyBool = Clazz_defineMethod(c$, "arrayCopyBool", 
function(array, newLength){
var oldLength = (array == null ? -1 : array.length);
if (newLength < 0) newLength = oldLength;
{
if (newLength < oldLength) return Clazz_newArray(-1, array, 0, newLength);
}var t =  Clazz_newBooleanArray(newLength, false);
if (array != null) {
System.arraycopy(array, 0, t, 0, oldLength < newLength ? oldLength : newLength);
}return t;
}, "~A,~N");
c$.swapInt = Clazz_defineMethod(c$, "swapInt", 
function(array, indexA, indexB){
var t = array[indexA];
array[indexA] = array[indexB];
array[indexB] = t;
}, "~A,~N,~N");
c$.dumpArray = Clazz_defineMethod(c$, "dumpArray", 
function(msg, A, x1, x2, y1, y2){
var s = "dumpArray: " + msg + "\n";
for (var x = x1; x <= x2; x++) s += "\t*" + x + "*";

for (var y = y2; y >= y1; y--) {
s += "\n*" + y + "*";
for (var x = x1; x <= x2; x++) s += "\t" + (x < A.length && y < A[x].length ? A[x][y] : NaN);

}
return s;
}, "~S,~A,~N,~N,~N,~N");
c$.dumpIntArray = Clazz_defineMethod(c$, "dumpIntArray", 
function(A, n){
var str = "";
for (var i = 0; i < n; i++) str += " " + A[i];

return str;
}, "~A,~N");
c$.sortedItem = Clazz_defineMethod(c$, "sortedItem", 
function(v, n){
if (v.size() == 0) return null;
if (v.size() == 1) return v.get(0);
var keys = v.toArray( new Array(v.size()));
java.util.Arrays.sort(keys);
return keys[n % keys.length];
}, "JU.Lst,~N");
c$.createArrayOfArrayList = Clazz_defineMethod(c$, "createArrayOfArrayList", 
function(size){
return  new Array(size);
}, "~N");
c$.createArrayOfHashtable = Clazz_defineMethod(c$, "createArrayOfHashtable", 
function(size){
return  new Array(size);
}, "~N");
c$.swap = Clazz_defineMethod(c$, "swap", 
function(o, i, j){
var oi = o[i];
o[i] = o[j];
o[j] = oi;
}, "~A,~N,~N");
c$.newFloat2 = Clazz_defineMethod(c$, "newFloat2", 
function(n){
{
return Clazz_newArray(n, null);
}}, "~N");
c$.newInt2 = Clazz_defineMethod(c$, "newInt2", 
function(n){
{
return Clazz_newArray(n, null);
}}, "~N");
c$.newInt3 = Clazz_defineMethod(c$, "newInt3", 
function(nx, ny){
{
return Clazz_newArray(nx, null);
}}, "~N,~N");
c$.newFloat3 = Clazz_defineMethod(c$, "newFloat3", 
function(nx, ny){
{
return Clazz_newArray(nx, null);
}}, "~N,~N");
c$.newInt4 = Clazz_defineMethod(c$, "newInt4", 
function(n){
{
return Clazz_newArray(n, null);
}}, "~N");
c$.newShort2 = Clazz_defineMethod(c$, "newShort2", 
function(n){
{
return Clazz_newArray(n, null);
}}, "~N");
c$.newByte2 = Clazz_defineMethod(c$, "newByte2", 
function(n){
{
return Clazz_newArray(n, null);
}}, "~N");
c$.newDouble2 = Clazz_defineMethod(c$, "newDouble2", 
function(n){
{
return Clazz_newArray(n, null);
}}, "~N");
c$.newDouble3n = Clazz_defineMethod(c$, "newDouble3n", 
function(n){
return  Clazz_newDoubleArray (n, 0);
}, "~N");
c$.removeMapKeys = Clazz_defineMethod(c$, "removeMapKeys", 
function(map, root){
var list =  new JU.Lst();
for (var key, $key = map.keySet().iterator (); $key.hasNext()&& ((key = $key.next ()) || true);) if (key.startsWith(root)) list.addLast(key);

for (var i = list.size(); --i >= 0; ) map.remove(list.get(i));

return list.size();
}, "java.util.Map,~S");
c$.isAS = Clazz_defineMethod(c$, "isAS", 
function(x){
{
return Clazz_isAS(x);
}}, "~O");
c$.isASS = Clazz_defineMethod(c$, "isASS", 
function(x){
{
return Clazz_isASS(x);
}}, "~O");
c$.isAP = Clazz_defineMethod(c$, "isAP", 
function(x){
{
return Clazz_isAP(x);
}}, "~O");
c$.isAF = Clazz_defineMethod(c$, "isAF", 
function(x){
{
return Clazz_isAF(x);
}}, "~O");
c$.isAFloat = Clazz_defineMethod(c$, "isAFloat", 
function(x){
{
return Clazz_isAFloat(x);
}}, "~O");
c$.isAD = Clazz_defineMethod(c$, "isAD", 
function(x){
{
return Clazz_isAF(x);
}}, "~O");
c$.isADD = Clazz_defineMethod(c$, "isADD", 
function(x){
{
return Clazz_isAFF(x);
}}, "~O");
c$.isADDD = Clazz_defineMethod(c$, "isADDD", 
function(x){
{
return Clazz_isAFFF(x);
}}, "~O");
c$.isAB = Clazz_defineMethod(c$, "isAB", 
function(x){
{
return Clazz_isAB(x);
}}, "~O");
c$.isAI = Clazz_defineMethod(c$, "isAI", 
function(x){
{
return Clazz_isAI(x);
}}, "~O");
c$.isAII = Clazz_defineMethod(c$, "isAII", 
function(x){
{
return Clazz_isAII(x);
}}, "~O");
c$.isAFF = Clazz_defineMethod(c$, "isAFF", 
function(x){
{
return Clazz_isAFF(x);
}}, "~O");
c$.isAFFF = Clazz_defineMethod(c$, "isAFFF", 
function(x){
{
return Clazz_isAFFF(x);
}}, "~O");
c$.ensureSignedBytes = Clazz_defineMethod(c$, "ensureSignedBytes", 
function(b){
if (b != null) {
{
for (var i = b.length; --i >= 0;) { var j = b[i] & 0xFF; if
(j >= 0x80) j -= 0x100; b[i] = j; }
}}return b;
}, "~A");
});
;//5.0.1-v7 Mon Aug 17 10:07:10 MDT 2026
Clazz_declarePackage("JU");
Clazz_load(null, "JU.Base64", ["JU.SB"], function(){
var c$ = Clazz_declareType(JU, "Base64", null);
c$.getBytes64 = Clazz_defineMethod(c$, "getBytes64", 
function(bytes){
return JU.Base64.getBase64(bytes).toBytes(0, -1);
}, "~A");
c$.getBase64 = Clazz_defineMethod(c$, "getBase64", 
function(bytes){
var nBytes = bytes.length;
var sout =  new JU.SB();
if (nBytes == 0) return sout;
for (var i = 0, nPad = 0; i < nBytes && nPad == 0; ) {
if (i % 75 == 0 && i != 0) sout.append("\r\n");
nPad = (i + 2 == nBytes ? 1 : i + 1 == nBytes ? 2 : 0);
var outbytes = ((bytes[i++] << 16) & 0xFF0000) | ((nPad == 2 ? 0 : bytes[i++] << 8) & 0x00FF00) | ((nPad >= 1 ? 0 : bytes[i++]) & 0x0000FF);
sout.appendC(JU.Base64.base64.charAt((outbytes >> 18) & 0x3F));
sout.appendC(JU.Base64.base64.charAt((outbytes >> 12) & 0x3F));
sout.appendC(nPad == 2 ? '=' : JU.Base64.base64.charAt((outbytes >> 6) & 0x3F));
sout.appendC(nPad >= 1 ? '=' : JU.Base64.base64.charAt(outbytes & 0x3F));
}
return sout;
}, "~A");
c$.decodeBase64 = Clazz_defineMethod(c$, "decodeBase64", 
function(strBase64){
var nBytes = 0;
var ch;
var pt0 = strBase64.indexOf(";base64,") + 1;
if (pt0 > 0) pt0 += 7;
var chars64 = strBase64.toCharArray();
var len64 = chars64.length;
if (len64 == 0) return  Clazz_newByteArray (0, 0);
for (var i = len64; --i >= pt0; ) nBytes += ((ch = (chars64[i]).charCodeAt(0) & 0x7F) == 65 || JU.Base64.decode64[ch] > 0 ? 3 : 0);

nBytes = nBytes >> 2;
var bytes =  Clazz_newByteArray (nBytes, 0);
var offset = 18;
for (var i = pt0, pt = 0, b = 0; i < len64; i++) {
if (JU.Base64.decode64[ch = (chars64[i]).charCodeAt(0) & 0x7F] > 0 || ch == 65 || ch == 61) {
b |= JU.Base64.decode64[ch] << offset;
offset -= 6;
if (offset < 0) {
bytes[pt++] = ((b & 0xFF0000) >> 16);
if (pt < nBytes) bytes[pt++] = ((b & 0xFF00) >> 8);
if (pt < nBytes) bytes[pt++] = (b & 0xFF);
offset = 18;
b = 0;
}}}
return bytes;
}, "~S");
c$.base64 = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
c$.decode64 =  Clazz_newIntArray(-1, [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 62, 0, 62, 0, 63, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 0, 0, 0, 0, 63, 0, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 0, 0, 0, 0, 0]);
});
;//5.0.1-v7 Mon Aug 17 10:07:10 MDT 2026
Clazz_declarePackage("JU");
Clazz_load(["javajs.api.JSONEncodable"], "JU.BS", ["JU.PT", "$.SB"], function(){
var c$ = Clazz_decorateAsClass(function(){
this.words = null;
this.wordsInUse = 0;
this.sizeIsSticky = false;
Clazz_instantialize(this, arguments);}, JU, "BS", null, [Cloneable, javajs.api.JSONEncodable]);
Clazz_makeConstructor(c$, 
function(){
this.initWords(32);
this.sizeIsSticky = false;
});
c$.wordIndex = Clazz_defineMethod(c$, "wordIndex", 
function(bitIndex){
return bitIndex >> 5;
}, "~N");
Clazz_defineMethod(c$, "recalculateWordsInUse", 
function(){
var i;
for (i = this.wordsInUse - 1; i >= 0; i--) if (this.words[i] != 0) break;

this.wordsInUse = i + 1;
});
c$.newN = Clazz_defineMethod(c$, "newN", 
function(nbits){
var bs =  new JU.BS();
bs.init(nbits);
return bs;
}, "~N");
Clazz_defineMethod(c$, "init", 
function(nbits){
if (nbits < 0) throw  new NegativeArraySizeException("nbits < 0: " + nbits);
this.initWords(nbits);
this.sizeIsSticky = true;
}, "~N");
Clazz_defineMethod(c$, "initWords", 
function(nbits){
this.words =  Clazz_newIntArray (JU.BS.wordIndex(nbits - 1) + 1, 0);
}, "~N");
Clazz_defineMethod(c$, "ensureCapacity", 
function(wordsRequired){
if (this.words.length < wordsRequired) {
var request = Math.max(2 * this.words.length, wordsRequired);
this.setLength(request);
this.sizeIsSticky = false;
}}, "~N");
Clazz_defineMethod(c$, "expandTo", 
function(wordIndex){
var wordsRequired = wordIndex + 1;
if (this.wordsInUse < wordsRequired) {
this.ensureCapacity(wordsRequired);
this.wordsInUse = wordsRequired;
}}, "~N");
Clazz_defineMethod(c$, "set", 
function(bitIndex){
if (bitIndex < 0) throw  new IndexOutOfBoundsException("bitIndex < 0: " + bitIndex);
var wordIndex = JU.BS.wordIndex(bitIndex);
this.expandTo(wordIndex);
this.words[wordIndex] |= (1 << bitIndex);
}, "~N");
Clazz_defineMethod(c$, "setBitTo", 
function(bitIndex, value){
if (value) this.set(bitIndex);
 else this.clear(bitIndex);
}, "~N,~B");
Clazz_defineMethod(c$, "setBits", 
function(fromIndex, toIndex){
if (fromIndex == toIndex) return;
var startWordIndex = JU.BS.wordIndex(fromIndex);
var endWordIndex = JU.BS.wordIndex(toIndex - 1);
this.expandTo(endWordIndex);
var firstWordMask = -1 << fromIndex;
var lastWordMask = -1 >>> -toIndex;
if (startWordIndex == endWordIndex) {
this.words[startWordIndex] |= (firstWordMask & lastWordMask);
} else {
this.words[startWordIndex] |= firstWordMask;
for (var i = startWordIndex + 1; i < endWordIndex; i++) this.words[i] = -1;

this.words[endWordIndex] |= lastWordMask;
}}, "~N,~N");
Clazz_defineMethod(c$, "clear", 
function(bitIndex){
if (bitIndex < 0) throw  new IndexOutOfBoundsException("bitIndex < 0: " + bitIndex);
var wordIndex = JU.BS.wordIndex(bitIndex);
if (wordIndex >= this.wordsInUse) return;
this.words[wordIndex] &= ~(1 << bitIndex);
this.recalculateWordsInUse();
}, "~N");
Clazz_defineMethod(c$, "clearBits", 
function(fromIndex, toIndex){
if (fromIndex == toIndex) return;
var startWordIndex = JU.BS.wordIndex(fromIndex);
if (startWordIndex >= this.wordsInUse) return;
var endWordIndex = JU.BS.wordIndex(toIndex - 1);
if (endWordIndex >= this.wordsInUse) {
toIndex = this.length();
endWordIndex = this.wordsInUse - 1;
}var firstWordMask = -1 << fromIndex;
var lastWordMask = -1 >>> -toIndex;
if (startWordIndex == endWordIndex) {
this.words[startWordIndex] &= ~(firstWordMask & lastWordMask);
} else {
this.words[startWordIndex] &= ~firstWordMask;
for (var i = startWordIndex + 1; i < endWordIndex; i++) this.words[i] = 0;

this.words[endWordIndex] &= ~lastWordMask;
}this.recalculateWordsInUse();
}, "~N,~N");
Clazz_defineMethod(c$, "clearAll", 
function(){
while (this.wordsInUse > 0) this.words[--this.wordsInUse] = 0;

});
Clazz_defineMethod(c$, "get", 
function(bitIndex){
if (bitIndex < 0) throw  new IndexOutOfBoundsException("bitIndex < 0: " + bitIndex);
var wordIndex = JU.BS.wordIndex(bitIndex);
return (wordIndex < this.wordsInUse) && ((this.words[wordIndex] & (1 << bitIndex)) != 0);
}, "~N");
Clazz_defineMethod(c$, "nextSetBit", 
function(fromIndex){
if (fromIndex < 0) throw  new IndexOutOfBoundsException("fromIndex < 0: " + fromIndex);
var u = JU.BS.wordIndex(fromIndex);
if (u >= this.wordsInUse) return -1;
var word = this.words[u] & (-1 << fromIndex);
while (true) {
if (word != 0) return (u * 32) + Integer.numberOfTrailingZeros(word);
if (++u == this.wordsInUse) return -1;
word = this.words[u];
}
}, "~N");
Clazz_defineMethod(c$, "nextClearBit", 
function(fromIndex){
if (fromIndex < 0) throw  new IndexOutOfBoundsException("fromIndex < 0: " + fromIndex);
var u = JU.BS.wordIndex(fromIndex);
if (u >= this.wordsInUse) return fromIndex;
var word = ~this.words[u] & (-1 << fromIndex);
while (true) {
if (word != 0) return (u * 32) + Integer.numberOfTrailingZeros(word);
if (++u == this.wordsInUse) return this.wordsInUse * 32;
word = ~this.words[u];
}
}, "~N");
Clazz_defineMethod(c$, "length", 
function(){
if (this.wordsInUse == 0) return 0;
return 32 * (this.wordsInUse - 1) + (32 - Integer.numberOfLeadingZeros(this.words[this.wordsInUse - 1]));
});
Clazz_defineMethod(c$, "isEmpty", 
function(){
return this.wordsInUse == 0;
});
Clazz_defineMethod(c$, "intersects", 
function(set){
for (var i = Math.min(this.wordsInUse, set.wordsInUse) - 1; i >= 0; i--) if ((this.words[i] & set.words[i]) != 0) return true;

return false;
}, "JU.BS");
Clazz_defineMethod(c$, "cardinality", 
function(){
var sum = 0;
for (var i = 0; i < this.wordsInUse; i++) sum += Integer.bitCount(this.words[i]);

return sum;
});
Clazz_defineMethod(c$, "and", 
function(set){
if (this === set) return;
while (this.wordsInUse > set.wordsInUse) this.words[--this.wordsInUse] = 0;

for (var i = 0; i < this.wordsInUse; i++) this.words[i] &= set.words[i];

this.recalculateWordsInUse();
}, "JU.BS");
Clazz_defineMethod(c$, "or", 
function(set){
if (this === set) return;
var wordsInCommon = Math.min(this.wordsInUse, set.wordsInUse);
if (this.wordsInUse < set.wordsInUse) {
this.ensureCapacity(set.wordsInUse);
this.wordsInUse = set.wordsInUse;
}for (var i = 0; i < wordsInCommon; i++) this.words[i] |= set.words[i];

if (wordsInCommon < set.wordsInUse) System.arraycopy(set.words, wordsInCommon, this.words, wordsInCommon, this.wordsInUse - wordsInCommon);
}, "JU.BS");
Clazz_defineMethod(c$, "xor", 
function(set){
var wordsInCommon = Math.min(this.wordsInUse, set.wordsInUse);
if (this.wordsInUse < set.wordsInUse) {
this.ensureCapacity(set.wordsInUse);
this.wordsInUse = set.wordsInUse;
}for (var i = 0; i < wordsInCommon; i++) this.words[i] ^= set.words[i];

if (wordsInCommon < set.wordsInUse) System.arraycopy(set.words, wordsInCommon, this.words, wordsInCommon, set.wordsInUse - wordsInCommon);
this.recalculateWordsInUse();
}, "JU.BS");
Clazz_defineMethod(c$, "andNot", 
function(set){
for (var i = Math.min(this.wordsInUse, set.wordsInUse) - 1; i >= 0; i--) this.words[i] &= ~set.words[i];

this.recalculateWordsInUse();
}, "JU.BS");
Clazz_overrideMethod(c$, "hashCode", 
function(){
var h = 1234;
for (var i = this.wordsInUse; --i >= 0; ) h ^= this.words[i] * (i + 1);

return ((h >> 32) ^ h);
});
Clazz_defineMethod(c$, "size", 
function(){
return this.words.length * 32;
});
Clazz_overrideMethod(c$, "equals", 
function(obj){
if (!(Clazz_instanceOf(obj,"JU.BS"))) return false;
if (this === obj) return true;
var set = obj;
if (this.wordsInUse != set.wordsInUse) return false;
for (var i = 0; i < this.wordsInUse; i++) if (this.words[i] != set.words[i]) return false;

return true;
}, "~O");
Clazz_overrideMethod(c$, "clone", 
function(){
if (!this.sizeIsSticky && this.wordsInUse != this.words.length) this.setLength(this.wordsInUse);
return JU.BS.copy(this);
});
Clazz_defineMethod(c$, "setLength", 
function(n){
{
if (n == this.words.length) return;
if (n == this.wordsInUse) {
this.words = Clazz_newArray(-1, this.words, 0, n);
return;
}
}var a =  Clazz_newIntArray (n, 0);
System.arraycopy(this.words, 0, a, 0, this.wordsInUse);
this.words = a;
}, "~N");
Clazz_overrideMethod(c$, "toString", 
function(){
return JU.BS.escape(this, '(', ')');
});
c$.copy = Clazz_defineMethod(c$, "copy", 
function(bitsetToCopy){
var bs;
{
bs = Clazz_clone(bitsetToCopy);
}var wordCount = bitsetToCopy.wordsInUse;
if (wordCount == 0) {
bs.words = JU.BS.emptyBitmap;
} else {
{
bs.words = Clazz_newArray(-1, bitsetToCopy.words, 0, bs.wordsInUse = wordCount);
}}return bs;
}, "JU.BS");
Clazz_defineMethod(c$, "cardinalityN", 
function(max){
var n = this.cardinality();
for (var i = this.length(); --i >= max; ) if (this.get(i)) n--;

return n;
}, "~N");
Clazz_overrideMethod(c$, "toJSON", 
function(){
var numBits = (this.wordsInUse > 128 ? this.cardinality() : this.wordsInUse * 32);
var b = JU.SB.newN(6 * numBits + 2);
b.appendC('[');
var i = this.nextSetBit(0);
if (i != -1) {
b.appendI(i);
for (i = this.nextSetBit(i + 1); i >= 0; i = this.nextSetBit(i + 1)) {
var endOfRun = this.nextClearBit(i);
do {
b.append(", ").appendI(i);
} while (++i < endOfRun);
}
}b.appendC(']');
return b.toString();
});
c$.escape = Clazz_defineMethod(c$, "escape", 
function(bs, chOpen, chClose){
if (bs == null) return chOpen + "{}" + chClose;
var s =  new JU.SB();
s.append(chOpen + "{");
var imax = bs.length();
var iLast = -1;
var iFirst = -2;
var i = -1;
while (++i <= imax) {
var isSet = bs.get(i);
if (i == imax || iLast >= 0 && !isSet) {
if (iLast >= 0 && iFirst != iLast) s.append((iFirst == iLast - 1 ? " " : ":") + iLast);
if (i == imax) break;
iLast = -1;
}if (bs.get(i)) {
if (iLast < 0) {
s.append((iFirst == -2 ? "" : " ") + i);
iFirst = i;
}iLast = i;
}}
s.append("}").appendC(chClose);
return s.toString();
}, "JU.BS,~S,~S");
c$.unescape = Clazz_defineMethod(c$, "unescape", 
function(str){
var ch;
var len;
if (str == null || (len = (str = str.trim()).length) < 4 || str.equalsIgnoreCase("({null})") || (ch = str.charAt(0)) != '(' && ch != '[' || str.charAt(len - 1) != (ch == '(' ? ')' : ']') || str.charAt(1) != '{' || str.indexOf('}') != len - 2) return null;
len -= 2;
for (var i = len; --i >= 2; ) if (!JU.PT.isDigit(ch = str.charAt(i)) && ch != ' ' && ch != '\t' && ch != ':') return null;

var lastN = len;
while (JU.PT.isDigit(str.charAt(--lastN))) {
}
if (++lastN == len) lastN = 0;
 else try {
lastN = Integer.parseInt(str.substring(lastN, len));
} catch (e) {
if (Clazz_exceptionOf(e,"NumberFormatException")){
return null;
} else {
throw e;
}
}
var bs = JU.BS.newN(lastN);
lastN = -1;
var iPrev = -1;
var iThis = -2;
for (var i = 2; i <= len; i++) {
switch ((ch = str.charAt(i)).charCodeAt(0)) {
case 9:
case 32:
case 125:
if (iThis < 0) break;
if (iThis < lastN) return null;
lastN = iThis;
if (iPrev < 0) iPrev = iThis;
bs.setBits(iPrev, iThis + 1);
iPrev = -1;
iThis = -2;
break;
case 58:
iPrev = lastN = iThis;
iThis = -2;
break;
default:
if (JU.PT.isDigit(ch)) {
if (iThis < 0) iThis = 0;
iThis = (iThis * 10) + (ch.charCodeAt(0) - 48);
}}
}
return (iPrev >= 0 ? null : bs);
}, "~S");
c$.emptyBitmap =  Clazz_newIntArray (0, 0);
});
;//5.0.1-v7 Mon Aug 17 10:07:10 MDT 2026
Clazz_declarePackage("JU");
Clazz_load(["java.util.Hashtable"], "JU.CU", ["JU.P3", "$.PT"], function(){
var c$ = Clazz_declareType(JU, "CU", null);
c$.toRGBHexString = Clazz_defineMethod(c$, "toRGBHexString", 
function(c){
var rgb = c.getRGB();
if (rgb == 0) return "000000";
var r = "00" + Integer.toHexString((rgb >> 16) & 0xFF);
r = r.substring(r.length - 2);
var g = "00" + Integer.toHexString((rgb >> 8) & 0xFF);
g = g.substring(g.length - 2);
var b = "00" + Integer.toHexString(rgb & 0xFF);
b = b.substring(b.length - 2);
return r + g + b;
}, "javajs.api.GenericColor");
c$.toCSSString = Clazz_defineMethod(c$, "toCSSString", 
function(c){
var opacity = c.getOpacity255();
if (opacity == 255) return "#" + JU.CU.toRGBHexString(c);
var rgb = c.getRGB();
return "rgba(" + ((rgb >> 16) & 0xFF) + "," + ((rgb >> 8) & 0xff) + "," + (rgb & 0xff) + "," + opacity / 255 + ")";
}, "javajs.api.GenericColor");
c$.getArgbFromString = Clazz_defineMethod(c$, "getArgbFromString", 
function(strColor){
var len = 0;
if (strColor == null || (len = strColor.length) == 0) return 0;
strColor = strColor.toLowerCase();
if (strColor.charAt(0) == '[' && strColor.charAt(len - 1) == ']') {
var check;
if (strColor.indexOf(",") >= 0) {
var tokens = JU.PT.split(strColor.substring(1, strColor.length - 1), ",");
if (tokens.length != 3) return 0;
var red = JU.PT.parseFloat(tokens[0]);
var grn = JU.PT.parseFloat(tokens[1]);
var blu = JU.PT.parseFloat(tokens[2]);
return JU.CU.colorTriadToFFRGB(red, grn, blu);
}switch (len) {
case 9:
check = "x";
break;
case 10:
check = "0x";
break;
default:
return 0;
}
if (strColor.indexOf(check) != 1) return 0;
strColor = "#" + strColor.substring(len - 7, len - 1);
len = 7;
}if (len == 7 && strColor.charAt(0) == '#') {
try {
return JU.PT.parseIntRadix(strColor.substring(1, 7), 16) | 0xFF000000;
} catch (e) {
if (Clazz_exceptionOf(e, Exception)){
return 0;
} else {
throw e;
}
}
}var boxedArgb = JU.CU.mapJavaScriptColors.get(strColor);
return (boxedArgb == null ? 0 : boxedArgb.intValue());
}, "~S");
c$.colorTriadToFFRGB = Clazz_defineMethod(c$, "colorTriadToFFRGB", 
function(x, y, z){
if (x <= 1 && y <= 1 && z <= 1) {
if (x > 0) x = x * 256 - 1;
if (y > 0) y = y * 256 - 1;
if (z > 0) z = z * 256 - 1;
}return JU.CU.rgb(Clazz_floatToInt(x), Clazz_floatToInt(y), Clazz_floatToInt(z));
}, "~N,~N,~N");
c$.rgb = Clazz_defineMethod(c$, "rgb", 
function(red, grn, blu){
return 0xFF000000 | (red << 16) | (grn << 8) | blu;
}, "~N,~N,~N");
c$.colorPtFromString = Clazz_defineMethod(c$, "colorPtFromString", 
function(colorName){
return JU.CU.colorPtFromInt(JU.CU.getArgbFromString(colorName), null);
}, "~S");
c$.colorPtFromInt = Clazz_defineMethod(c$, "colorPtFromInt", 
function(color, pt){
if (pt == null) pt =  new JU.P3();
pt.set((color >> 16) & 0xFF, (color >> 8) & 0xFF, color & 0xFF);
return pt;
}, "~N,JU.P3");
c$.colorPtToFFRGB = Clazz_defineMethod(c$, "colorPtToFFRGB", 
function(pt){
return JU.CU.colorTriadToFFRGB(pt.x, pt.y, pt.z);
}, "JU.T3");
c$.toRGB3f = Clazz_defineMethod(c$, "toRGB3f", 
function(c, f){
f[0] = ((c >> 16) & 0xFF) / 255;
f[1] = ((c >> 8) & 0xFF) / 255;
f[2] = (c & 0xFF) / 255;
}, "~N,~A");
c$.toFFGGGfromRGB = Clazz_defineMethod(c$, "toFFGGGfromRGB", 
function(rgb){
var grey = (Clazz_doubleToInt(((2989 * ((rgb >> 16) & 0xFF)) + (5870 * ((rgb >> 8) & 0xFF)) + (1140 * (rgb & 0xFF)) + 5000) / 10000)) & 0xFFFFFF;
return JU.CU.rgb(grey, grey, grey);
}, "~N");
c$.rgbToHSL = Clazz_defineMethod(c$, "rgbToHSL", 
function(rgb, doRound){
var r = rgb.x / 255;
var g = rgb.y / 255;
var b = rgb.z / 255;
var min = Math.min(r, Math.min(g, b));
var max = Math.max(r, Math.max(g, b));
var p = (max + min);
var q = (max - min);
var h = (60 * ((q == 0 ? 0 : max == r ? ((g - b) / q + 6) : max == g ? (b - r) / q + 2 : (r - g) / q + 4))) % 360;
var s = q / (q == 0 ? 1 : p <= 1 ? p : 2 - p);
return (doRound ? JU.P3.new3(Math.round(h * 10) / 10, Math.round(s * 1000) / 10, Math.round(p * 500) / 10) : JU.P3.new3(h, s * 100, p * 50));
}, "JU.P3,~B");
c$.hslToRGB = Clazz_defineMethod(c$, "hslToRGB", 
function(hsl){
var h = Math.max(0, Math.min(360, hsl.x)) / 60;
var s = Math.max(0, Math.min(100, hsl.y)) / 100;
var l = Math.max(0, Math.min(100, hsl.z)) / 100;
var p = l - (l < 0.5 ? l : 1 - l) * s;
var q = 2 * (l - p);
var r = JU.CU.toRGB(p, q, h + 2);
var g = JU.CU.toRGB(p, q, h);
var b = JU.CU.toRGB(p, q, h - 2);
return JU.P3.new3(Math.round(r * 255), Math.round(g * 255), Math.round(b * 255));
}, "JU.P3");
c$.toRGB = Clazz_defineMethod(c$, "toRGB", 
function(p, q, h){
return ((h = (h + (h < 0 ? 6 : h > 6 ? -6 : 0))) < 1 ? p + q * h : h < 3 ? p + q : h < 4 ? p + q * (4 - h) : p);
}, "~N,~N,~N");
c$.colorNames =  Clazz_newArray(-1, ["contrast", "black", "pewhite", "pecyan", "pepurple", "pegreen", "peblue", "peviolet", "pebrown", "pepink", "peyellow", "pedarkgreen", "peorange", "pelightblue", "pedarkcyan", "pedarkgray", "aliceblue", "antiquewhite", "aqua", "aquamarine", "azure", "beige", "bisque", "blanchedalmond", "blue", "blueviolet", "brown", "burlywood", "cadetblue", "chartreuse", "chocolate", "coral", "cornflowerblue", "cornsilk", "crimson", "cyan", "darkblue", "darkcyan", "darkgoldenrod", "darkgray", "darkgreen", "darkkhaki", "darkmagenta", "darkolivegreen", "darkorange", "darkorchid", "darkred", "darksalmon", "darkseagreen", "darkslateblue", "darkslategray", "darkturquoise", "darkviolet", "deeppink", "deepskyblue", "dimgray", "dodgerblue", "firebrick", "floralwhite", "forestgreen", "fuchsia", "gainsboro", "ghostwhite", "gold", "goldenrod", "gray", "green", "greenyellow", "honeydew", "hotpink", "indianred", "indigo", "ivory", "khaki", "lavender", "lavenderblush", "lawngreen", "lemonchiffon", "lightblue", "lightcoral", "lightcyan", "lightgoldenrodyellow", "lightgreen", "lightgrey", "lightgray", "lightpink", "lightsalmon", "lightseagreen", "lightskyblue", "lightslategray", "lightsteelblue", "lightyellow", "lime", "limegreen", "linen", "magenta", "maroon", "mediumaquamarine", "mediumblue", "mediumorchid", "mediumpurple", "mediumseagreen", "mediumslateblue", "mediumspringgreen", "mediumturquoise", "mediumvioletred", "midnightblue", "mintcream", "mistyrose", "moccasin", "navajowhite", "navy", "oldlace", "olive", "olivedrab", "orange", "orangered", "orchid", "palegoldenrod", "palegreen", "paleturquoise", "palevioletred", "papayawhip", "peachpuff", "peru", "pink", "plum", "powderblue", "purple", "red", "rosybrown", "royalblue", "saddlebrown", "salmon", "sandybrown", "seagreen", "seashell", "sienna", "silver", "skyblue", "slateblue", "slategray", "snow", "springgreen", "steelblue", "tan", "teal", "thistle", "tomato", "turquoise", "violet", "wheat", "white", "whitesmoke", "yellow", "yellowgreen", "bluetint", "greenblue", "greentint", "grey", "gray", "pinktint", "redorange", "yellowtint"]);
c$.colorArgbs =  Clazz_newIntArray(-1, [0xFFfedcba, 0xFF000000, 0xFFffffff, 0xFF00ffff, 0xFFd020ff, 0xFF00ff00, 0xFF6060ff, 0xFFff80c0, 0xFFa42028, 0xFFffd8d8, 0xFFffff00, 0xFF00c000, 0xFFffb000, 0xFFb0b0ff, 0xFF00a0a0, 0xFF606060, 0xFFF0F8FF, 0xFFFAEBD7, 0xFF00FFFF, 0xFF7FFFD4, 0xFFF0FFFF, 0xFFF5F5DC, 0xFFFFE4C4, 0xFFFFEBCD, 0xFF0000FF, 0xFF8A2BE2, 0xFFA52A2A, 0xFFDEB887, 0xFF5F9EA0, 0xFF7FFF00, 0xFFD2691E, 0xFFFF7F50, 0xFF6495ED, 0xFFFFF8DC, 0xFFDC143C, 0xFF00FFFF, 0xFF00008B, 0xFF008B8B, 0xFFB8860B, 0xFFA9A9A9, 0xFF006400, 0xFFBDB76B, 0xFF8B008B, 0xFF556B2F, 0xFFFF8C00, 0xFF9932CC, 0xFF8B0000, 0xFFE9967A, 0xFF8FBC8F, 0xFF483D8B, 0xFF2F4F4F, 0xFF00CED1, 0xFF9400D3, 0xFFFF1493, 0xFF00BFFF, 0xFF696969, 0xFF1E90FF, 0xFFB22222, 0xFFFFFAF0, 0xFF228B22, 0xFFFF00FF, 0xFFDCDCDC, 0xFFF8F8FF, 0xFFFFD700, 0xFFDAA520, 0xFF808080, 0xFF008000, 0xFFADFF2F, 0xFFF0FFF0, 0xFFFF69B4, 0xFFCD5C5C, 0xFF4B0082, 0xFFFFFFF0, 0xFFF0E68C, 0xFFE6E6FA, 0xFFFFF0F5, 0xFF7CFC00, 0xFFFFFACD, 0xFFADD8E6, 0xFFF08080, 0xFFE0FFFF, 0xFFFAFAD2, 0xFF90EE90, 0xFFD3D3D3, 0xFFD3D3D3, 0xFFFFB6C1, 0xFFFFA07A, 0xFF20B2AA, 0xFF87CEFA, 0xFF778899, 0xFFB0C4DE, 0xFFFFFFE0, 0xFF00FF00, 0xFF32CD32, 0xFFFAF0E6, 0xFFFF00FF, 0xFF800000, 0xFF66CDAA, 0xFF0000CD, 0xFFBA55D3, 0xFF9370DB, 0xFF3CB371, 0xFF7B68EE, 0xFF00FA9A, 0xFF48D1CC, 0xFFC71585, 0xFF191970, 0xFFF5FFFA, 0xFFFFE4E1, 0xFFFFE4B5, 0xFFFFDEAD, 0xFF000080, 0xFFFDF5E6, 0xFF808000, 0xFF6B8E23, 0xFFFFA500, 0xFFFF4500, 0xFFDA70D6, 0xFFEEE8AA, 0xFF98FB98, 0xFFAFEEEE, 0xFFDB7093, 0xFFFFEFD5, 0xFFFFDAB9, 0xFFCD853F, 0xFFFFC0CB, 0xFFDDA0DD, 0xFFB0E0E6, 0xFF800080, 0xFFFF0000, 0xFFBC8F8F, 0xFF4169E1, 0xFF8B4513, 0xFFFA8072, 0xFFF4A460, 0xFF2E8B57, 0xFFFFF5EE, 0xFFA0522D, 0xFFC0C0C0, 0xFF87CEEB, 0xFF6A5ACD, 0xFF708090, 0xFFFFFAFA, 0xFF00FF7F, 0xFF4682B4, 0xFFD2B48C, 0xFF008080, 0xFFD8BFD8, 0xFFFF6347, 0xFF40E0D0, 0xFFEE82EE, 0xFFF5DEB3, 0xFFFFFFFF, 0xFFF5F5F5, 0xFFFFFF00, 0xFF9ACD32, 0xFFAFD7FF, 0xFF2E8B57, 0xFF98FFB3, 0xFF808080, 0xFF808080, 0xFFFFABBB, 0xFFFF4500, 0xFFF6F675]);
c$.mapJavaScriptColors =  new java.util.Hashtable();
{
for (var i = JU.CU.colorNames.length; --i >= 0; ) JU.CU.mapJavaScriptColors.put(JU.CU.colorNames[i], Integer.$valueOf(JU.CU.colorArgbs[i]));

}});
;//5.0.1-v7 Mon Aug 17 10:07:10 MDT 2026
Clazz_declarePackage("JU");
Clazz_load(null, "JU.DF", ["JU.PT", "$.SB"], function(){
var c$ = Clazz_declareType(JU, "DF", null);
c$.setUseNumberLocalization = Clazz_defineMethod(c$, "setUseNumberLocalization", 
function(TF){
JU.DF.useNumberLocalization[0] = (TF ? Boolean.TRUE : Boolean.FALSE);
}, "~B");
c$.formatDecimalDbl = Clazz_defineMethod(c$, "formatDecimalDbl", 
function(value, decimalDigits){
if (decimalDigits == 2147483647 || value == -Infinity || value == Infinity || Double.isNaN(value)) return "" + value;
return JU.DF.formatDecimal(value, decimalDigits);
}, "~N,~N");
c$.formatDecimal = Clazz_defineMethod(c$, "formatDecimal", 
function(value, decimalDigits){
if (value == -Infinity || value == Infinity || Double.isNaN(value)) return "" + value;
if (decimalDigits == 2147483647) return "" + value;
var isNeg = (value < 0);
if (isNeg) value = -value;
var n;
if (decimalDigits < 0) {
decimalDigits = -decimalDigits;
if (decimalDigits > JU.DF.formattingStrings.length) decimalDigits = JU.DF.formattingStrings.length;
if (value == 0) return JU.DF.formattingStrings[decimalDigits - 1] + "E+0";
n = 0;
var d;
if (Math.abs(value) < 1) {
n = 100;
d = value * 1e-100;
} else {
n = -100;
d = value * 1e100;
}var s = ("" + d).toUpperCase();
var i1 = s.indexOf("E");
var sf;
if (i1 < 0) {
sf = "" + value;
} else {
n = JU.PT.parseInt(s.substring(i1 + (s.indexOf("E+") == i1 ? 2 : 1))) + n;
var f = JU.PT.parseFloat(s.substring(0, i1));
sf = JU.DF.formatDecimal(f, decimalDigits - 1);
if (sf.startsWith("10.")) {
sf = JU.DF.formatDecimal(1, decimalDigits - 1);
n++;
}}return (isNeg ? "-" : "") + sf + "E" + (n >= 0 ? "+" : "") + n;
}if (decimalDigits >= JU.DF.formattingStrings.length) decimalDigits = JU.DF.formattingStrings.length - 1;
var s1 = ("" + value).toUpperCase();
var pt = s1.indexOf(".");
if (pt < 0) return (isNeg ? "-" : "") + s1 + JU.DF.formattingStrings[decimalDigits].substring(1);
var pt1 = s1.indexOf("E-");
if (pt1 > 0) {
n = JU.PT.parseInt(s1.substring(pt1 + 1));
s1 = "0." + "0000000000000000000000000000000000000000".substring(0, -n - 1) + s1.substring(0, 1) + s1.substring(2, pt1);
pt = 1;
}pt1 = s1.indexOf("E");
if (pt1 > 0) {
n = JU.PT.parseInt(s1.substring(pt1 + 1));
s1 = s1.substring(0, 1) + s1.substring(2, pt1) + "0000000000000000000000000000000000000000";
s1 = s1.substring(0, n + 1) + "." + s1.substring(n + 1);
pt = s1.indexOf(".");
}var len = s1.length;
var pt2 = decimalDigits + pt + 1;
if (pt2 < len && s1.charAt(pt2) >= '5') {
return JU.DF.formatDecimal((isNeg ? -1 : 1) * (value + JU.DF.formatAdds[decimalDigits]), decimalDigits);
}var s0 = s1.substring(0, (decimalDigits == 0 ? pt : ++pt));
var sb = JU.SB.newS(s0);
if (isNeg && s0.equals("0.") && decimalDigits + 2 <= len && s1.substring(2, 2 + decimalDigits).equals("0000000000000000000000000000000000000000".substring(0, decimalDigits))) isNeg = false;
for (var i = 0; i < decimalDigits; i++, pt++) {
if (pt < len) sb.appendC(s1.charAt(pt));
 else sb.appendC('0');
}
s1 = (isNeg ? "-" : "") + sb;
return (Boolean.TRUE.equals(JU.DF.useNumberLocalization[0]) ? s1 : s1.$replace(',', '.'));
}, "~N,~N");
c$.formatDecimalTrimmed = Clazz_defineMethod(c$, "formatDecimalTrimmed", 
function(x, precision){
var str = JU.DF.formatDecimalDbl(x, precision);
var m = str.length - 1;
var zero = '0';
while (m >= 0 && str.charAt(m) == zero) m--;

return str.substring(0, m + 1);
}, "~N,~N");
c$.formatDecimalTrimmed0 = Clazz_defineMethod(c$, "formatDecimalTrimmed0", 
function(x, precision){
var str = JU.DF.formatDecimalDbl(x, precision);
var m = str.length - 1;
var pt = str.indexOf(".") + 1;
while (m > pt && str.charAt(m) == '0') m--;

return str.substring(0, m + 1);
}, "~N,~N");
c$.formattingStrings =  Clazz_newArray(-1, ["0", "0.0", "0.00", "0.000", "0.0000", "0.00000", "0.000000", "0.0000000", "0.00000000", "0.000000000", "0.0000000000", "0.00000000000", "0.000000000000"]);
c$.formatAdds =  Clazz_newDoubleArray(-1, [0.5, 0.05, 0.005, 0.0005, 0.00005, 0.000005, 0.0000005, 0.00000005, 0.000000005, 0.0000000005, 0.00000000005, 0.000000000005, 0.0000000000005]);
c$.useNumberLocalization =  Clazz_newArray(-1, [Boolean.TRUE]);
});
;//5.0.1-v7 Mon Aug 17 10:07:10 MDT 2026
Clazz_declarePackage("JU");
Clazz_load(["java.lang.Enum"], "JU.Encoding", null, function(){
var c$ = Clazz_declareType(JU, "Encoding", Enum);
Clazz_defineEnumConstant(c$, "NONE", 0, []);
Clazz_defineEnumConstant(c$, "UTF8", 1, []);
Clazz_defineEnumConstant(c$, "UTF_16BE", 2, []);
Clazz_defineEnumConstant(c$, "UTF_16LE", 3, []);
Clazz_defineEnumConstant(c$, "UTF_32BE", 4, []);
Clazz_defineEnumConstant(c$, "UTF_32LE", 5, []);
});
;//5.0.1-v7 Mon Aug 17 10:07:10 MDT 2026
Clazz_declarePackage("JU");
Clazz_load(["java.util.ArrayList"], "JU.Lst", null, function(){
var c$ = Clazz_declareType(JU, "Lst", java.util.ArrayList);
Clazz_defineMethod(c$, "addLast", 
function(v){
{
return this.add1(v);
}}, "~O");
Clazz_overrideMethod(c$, "add", 
function(pos, v){
{
return this.add2(pos, v);
}}, "~N,~O");
Clazz_defineMethod(c$, "removeItemAt", 
function(location){
{
return this._removeItemAt(location);
}}, "~N");
Clazz_defineMethod(c$, "removeObj", 
function(v){
{
return this._removeObject(v);
}}, "~O");
});
;//5.0.1-v7 Mon Aug 17 10:07:10 MDT 2026
Clazz_declarePackage("JU");
(function(){
var c$ = Clazz_decorateAsClass(function(){
this.m00 = 0;
this.m01 = 0;
this.m02 = 0;
this.m10 = 0;
this.m11 = 0;
this.m12 = 0;
this.m20 = 0;
this.m21 = 0;
this.m22 = 0;
Clazz_instantialize(this, arguments);}, JU, "M34", null);
Clazz_defineMethod(c$, "setAA33", 
function(a){
var x = a.x;
var y = a.y;
var z = a.z;
var angle = a.angle;
var n = Math.sqrt(x * x + y * y + z * z);
n = 1 / n;
x *= n;
y *= n;
z *= n;
var c = Math.cos(angle);
var s = Math.sin(angle);
var omc = 1.0 - c;
this.m00 = (c + x * x * omc);
this.m11 = (c + y * y * omc);
this.m22 = (c + z * z * omc);
var tmp1 = x * y * omc;
var tmp2 = z * s;
this.m01 = (tmp1 - tmp2);
this.m10 = (tmp1 + tmp2);
tmp1 = x * z * omc;
tmp2 = y * s;
this.m02 = (tmp1 + tmp2);
this.m20 = (tmp1 - tmp2);
tmp1 = y * z * omc;
tmp2 = x * s;
this.m12 = (tmp1 - tmp2);
this.m21 = (tmp1 + tmp2);
}, "JU.A4");
Clazz_defineMethod(c$, "rotate", 
function(t){
this.rotate2(t, t);
}, "JU.T3");
Clazz_defineMethod(c$, "rotate2", 
function(t, result){
result.set(this.m00 * t.x + this.m01 * t.y + this.m02 * t.z, this.m10 * t.x + this.m11 * t.y + this.m12 * t.z, this.m20 * t.x + this.m21 * t.y + this.m22 * t.z);
}, "JU.T3,JU.T3");
Clazz_defineMethod(c$, "setM33", 
function(m1){
this.m00 = m1.m00;
this.m01 = m1.m01;
this.m02 = m1.m02;
this.m10 = m1.m10;
this.m11 = m1.m11;
this.m12 = m1.m12;
this.m20 = m1.m20;
this.m21 = m1.m21;
this.m22 = m1.m22;
}, "JU.M34");
Clazz_defineMethod(c$, "clear33", 
function(){
this.m00 = this.m01 = this.m02 = this.m10 = this.m11 = this.m12 = this.m20 = this.m21 = this.m22 = 0.0;
});
Clazz_defineMethod(c$, "set33", 
function(row, col, v){
switch (row) {
case 0:
switch (col) {
case 0:
this.m00 = v;
return;
case 1:
this.m01 = v;
return;
case 2:
this.m02 = v;
return;
}
break;
case 1:
switch (col) {
case 0:
this.m10 = v;
return;
case 1:
this.m11 = v;
return;
case 2:
this.m12 = v;
return;
}
break;
case 2:
switch (col) {
case 0:
this.m20 = v;
return;
case 1:
this.m21 = v;
return;
case 2:
this.m22 = v;
return;
}
break;
}
this.err();
}, "~N,~N,~N");
Clazz_defineMethod(c$, "get33", 
function(row, col){
switch (row) {
case 0:
switch (col) {
case 0:
return this.m00;
case 1:
return this.m01;
case 2:
return this.m02;
}
break;
case 1:
switch (col) {
case 0:
return this.m10;
case 1:
return this.m11;
case 2:
return this.m12;
}
break;
case 2:
switch (col) {
case 0:
return this.m20;
case 1:
return this.m21;
case 2:
return this.m22;
}
break;
}
this.err();
return 0;
}, "~N,~N");
Clazz_defineMethod(c$, "setRow33", 
function(row, v){
switch (row) {
case 0:
this.m00 = v[0];
this.m01 = v[1];
this.m02 = v[2];
return;
case 1:
this.m10 = v[0];
this.m11 = v[1];
this.m12 = v[2];
return;
case 2:
this.m20 = v[0];
this.m21 = v[1];
this.m22 = v[2];
return;
default:
this.err();
}
}, "~N,~A");
Clazz_defineMethod(c$, "getRow33", 
function(row, v){
switch (row) {
case 0:
v[0] = this.m00;
v[1] = this.m01;
v[2] = this.m02;
return;
case 1:
v[0] = this.m10;
v[1] = this.m11;
v[2] = this.m12;
return;
case 2:
v[0] = this.m20;
v[1] = this.m21;
v[2] = this.m22;
return;
}
this.err();
}, "~N,~A");
Clazz_defineMethod(c$, "setColumn33", 
function(column, v){
switch (column) {
case 0:
this.m00 = v[0];
this.m10 = v[1];
this.m20 = v[2];
break;
case 1:
this.m01 = v[0];
this.m11 = v[1];
this.m21 = v[2];
break;
case 2:
this.m02 = v[0];
this.m12 = v[1];
this.m22 = v[2];
break;
default:
this.err();
}
}, "~N,~A");
Clazz_defineMethod(c$, "getColumn33", 
function(column, v){
switch (column) {
case 0:
v[0] = this.m00;
v[1] = this.m10;
v[2] = this.m20;
break;
case 1:
v[0] = this.m01;
v[1] = this.m11;
v[2] = this.m21;
break;
case 2:
v[0] = this.m02;
v[1] = this.m12;
v[2] = this.m22;
break;
default:
this.err();
}
}, "~N,~A");
Clazz_defineMethod(c$, "add33", 
function(m1){
this.m00 += m1.m00;
this.m01 += m1.m01;
this.m02 += m1.m02;
this.m10 += m1.m10;
this.m11 += m1.m11;
this.m12 += m1.m12;
this.m20 += m1.m20;
this.m21 += m1.m21;
this.m22 += m1.m22;
}, "JU.M34");
Clazz_defineMethod(c$, "sub33", 
function(m1){
this.m00 -= m1.m00;
this.m01 -= m1.m01;
this.m02 -= m1.m02;
this.m10 -= m1.m10;
this.m11 -= m1.m11;
this.m12 -= m1.m12;
this.m20 -= m1.m20;
this.m21 -= m1.m21;
this.m22 -= m1.m22;
}, "JU.M34");
Clazz_defineMethod(c$, "mul33", 
function(x){
this.m00 *= x;
this.m01 *= x;
this.m02 *= x;
this.m10 *= x;
this.m11 *= x;
this.m12 *= x;
this.m20 *= x;
this.m21 *= x;
this.m22 *= x;
}, "~N");
Clazz_defineMethod(c$, "transpose33", 
function(){
var tmp = this.m01;
this.m01 = this.m10;
this.m10 = tmp;
tmp = this.m02;
this.m02 = this.m20;
this.m20 = tmp;
tmp = this.m12;
this.m12 = this.m21;
this.m21 = tmp;
});
Clazz_defineMethod(c$, "setXRot", 
function(angle){
var c = Math.cos(angle);
var s = Math.sin(angle);
this.m00 = 1.0;
this.m01 = 0.0;
this.m02 = 0.0;
this.m10 = 0.0;
this.m11 = c;
this.m12 = -s;
this.m20 = 0.0;
this.m21 = s;
this.m22 = c;
}, "~N");
Clazz_defineMethod(c$, "setYRot", 
function(angle){
var c = Math.cos(angle);
var s = Math.sin(angle);
this.m00 = c;
this.m01 = 0.0;
this.m02 = s;
this.m10 = 0.0;
this.m11 = 1.0;
this.m12 = 0.0;
this.m20 = -s;
this.m21 = 0.0;
this.m22 = c;
}, "~N");
Clazz_defineMethod(c$, "setZRot", 
function(angle){
var c = Math.cos(angle);
var s = Math.sin(angle);
this.m00 = c;
this.m01 = -s;
this.m02 = 0.0;
this.m10 = s;
this.m11 = c;
this.m12 = 0.0;
this.m20 = 0.0;
this.m21 = 0.0;
this.m22 = 1.0;
}, "~N");
Clazz_defineMethod(c$, "determinant3", 
function(){
return this.m00 * (this.m11 * this.m22 - this.m21 * this.m12) - this.m01 * (this.m10 * this.m22 - this.m20 * this.m12) + this.m02 * (this.m10 * this.m21 - this.m20 * this.m11);
});
Clazz_defineMethod(c$, "err", 
function(){
throw  new ArrayIndexOutOfBoundsException("matrix column/row out of bounds");
});
})();
;//5.0.1-v7 Mon Aug 17 10:07:10 MDT 2026
Clazz_declarePackage("JU");
Clazz_load(["JU.M34"], "JU.M3", ["JU.T3"], function(){
var c$ = Clazz_declareType(JU, "M3", JU.M34, java.io.Serializable);
c$.newA9 = Clazz_defineMethod(c$, "newA9", 
function(v){
var m =  new JU.M3();
m.setA(v);
return m;
}, "~A");
c$.newM3 = Clazz_defineMethod(c$, "newM3", 
function(m1){
var m =  new JU.M3();
if (m1 == null) {
m.setScale(1);
return m;
}m.m00 = m1.m00;
m.m01 = m1.m01;
m.m02 = m1.m02;
m.m10 = m1.m10;
m.m11 = m1.m11;
m.m12 = m1.m12;
m.m20 = m1.m20;
m.m21 = m1.m21;
m.m22 = m1.m22;
return m;
}, "JU.M3");
Clazz_defineMethod(c$, "setScale", 
function(scale){
this.clear33();
this.m00 = this.m11 = this.m22 = scale;
}, "~N");
Clazz_defineMethod(c$, "setM3", 
function(m1){
this.setM33(m1);
}, "JU.M34");
Clazz_defineMethod(c$, "setA", 
function(m){
this.m00 = m[0];
this.m01 = m[1];
this.m02 = m[2];
this.m10 = m[3];
this.m11 = m[4];
this.m12 = m[5];
this.m20 = m[6];
this.m21 = m[7];
this.m22 = m[8];
}, "~A");
Clazz_defineMethod(c$, "setElement", 
function(row, col, v){
this.set33(row, col, v);
}, "~N,~N,~N");
Clazz_defineMethod(c$, "getElement", 
function(row, col){
return this.get33(row, col);
}, "~N,~N");
Clazz_defineMethod(c$, "setRow", 
function(row, x, y, z){
switch (row) {
case 0:
this.m00 = x;
this.m01 = y;
this.m02 = z;
return;
case 1:
this.m10 = x;
this.m11 = y;
this.m12 = z;
return;
case 2:
this.m20 = x;
this.m21 = y;
this.m22 = z;
return;
default:
this.err();
}
}, "~N,~N,~N,~N");
Clazz_defineMethod(c$, "setRowV", 
function(row, v){
switch (row) {
case 0:
this.m00 = v.x;
this.m01 = v.y;
this.m02 = v.z;
return;
case 1:
this.m10 = v.x;
this.m11 = v.y;
this.m12 = v.z;
return;
case 2:
this.m20 = v.x;
this.m21 = v.y;
this.m22 = v.z;
return;
default:
this.err();
}
}, "~N,JU.T3");
Clazz_defineMethod(c$, "setRowA", 
function(row, v){
this.setRow33(row, v);
}, "~N,~A");
Clazz_overrideMethod(c$, "getRow", 
function(row, v){
this.getRow33(row, v);
}, "~N,~A");
Clazz_defineMethod(c$, "setColumn3", 
function(column, x, y, z){
switch (column) {
case 0:
this.m00 = x;
this.m10 = y;
this.m20 = z;
break;
case 1:
this.m01 = x;
this.m11 = y;
this.m21 = z;
break;
case 2:
this.m02 = x;
this.m12 = y;
this.m22 = z;
break;
default:
this.err();
}
}, "~N,~N,~N,~N");
Clazz_defineMethod(c$, "setColumnV", 
function(column, v){
switch (column) {
case 0:
this.m00 = v.x;
this.m10 = v.y;
this.m20 = v.z;
break;
case 1:
this.m01 = v.x;
this.m11 = v.y;
this.m21 = v.z;
break;
case 2:
this.m02 = v.x;
this.m12 = v.y;
this.m22 = v.z;
break;
default:
this.err();
}
}, "~N,JU.T3");
Clazz_defineMethod(c$, "getColumnV", 
function(column, v){
switch (column) {
case 0:
v.x = this.m00;
v.y = this.m10;
v.z = this.m20;
break;
case 1:
v.x = this.m01;
v.y = this.m11;
v.z = this.m21;
break;
case 2:
v.x = this.m02;
v.y = this.m12;
v.z = this.m22;
break;
default:
this.err();
}
}, "~N,JU.T3");
Clazz_defineMethod(c$, "setColumnA", 
function(column, v){
this.setColumn33(column, v);
}, "~N,~A");
Clazz_defineMethod(c$, "getColumn", 
function(column, v){
this.getColumn33(column, v);
}, "~N,~A");
Clazz_defineMethod(c$, "add", 
function(m1){
this.add33(m1);
}, "JU.M3");
Clazz_defineMethod(c$, "sub", 
function(m1){
this.sub33(m1);
}, "JU.M3");
Clazz_defineMethod(c$, "transpose", 
function(){
this.transpose33();
});
Clazz_defineMethod(c$, "transposeM", 
function(m1){
this.setM33(m1);
this.transpose33();
}, "JU.M3");
Clazz_defineMethod(c$, "invertM", 
function(m1){
this.setM33(m1);
this.invert();
}, "JU.M3");
Clazz_defineMethod(c$, "invert", 
function(){
var s = this.determinant3();
if (s == 0.0) return;
s = 1 / s;
this.set9(this.m11 * this.m22 - this.m12 * this.m21, this.m02 * this.m21 - this.m01 * this.m22, this.m01 * this.m12 - this.m02 * this.m11, this.m12 * this.m20 - this.m10 * this.m22, this.m00 * this.m22 - this.m02 * this.m20, this.m02 * this.m10 - this.m00 * this.m12, this.m10 * this.m21 - this.m11 * this.m20, this.m01 * this.m20 - this.m00 * this.m21, this.m00 * this.m11 - this.m01 * this.m10);
this.scale(s);
});
Clazz_defineMethod(c$, "setAsXRotation", 
function(angle){
this.setXRot(angle);
return this;
}, "~N");
Clazz_defineMethod(c$, "setAsYRotation", 
function(angle){
this.setYRot(angle);
return this;
}, "~N");
Clazz_defineMethod(c$, "setAsZRotation", 
function(angle){
this.setZRot(angle);
return this;
}, "~N");
Clazz_defineMethod(c$, "scale", 
function(scalar){
this.mul33(scalar);
}, "~N");
Clazz_defineMethod(c$, "mul", 
function(m1){
this.mul2(this, m1);
}, "JU.M3");
Clazz_defineMethod(c$, "mul2", 
function(m1, m2){
this.set9(m1.m00 * m2.m00 + m1.m01 * m2.m10 + m1.m02 * m2.m20, m1.m00 * m2.m01 + m1.m01 * m2.m11 + m1.m02 * m2.m21, m1.m00 * m2.m02 + m1.m01 * m2.m12 + m1.m02 * m2.m22, m1.m10 * m2.m00 + m1.m11 * m2.m10 + m1.m12 * m2.m20, m1.m10 * m2.m01 + m1.m11 * m2.m11 + m1.m12 * m2.m21, m1.m10 * m2.m02 + m1.m11 * m2.m12 + m1.m12 * m2.m22, m1.m20 * m2.m00 + m1.m21 * m2.m10 + m1.m22 * m2.m20, m1.m20 * m2.m01 + m1.m21 * m2.m11 + m1.m22 * m2.m21, m1.m20 * m2.m02 + m1.m21 * m2.m12 + m1.m22 * m2.m22);
}, "JU.M3,JU.M3");
Clazz_overrideMethod(c$, "equals", 
function(o){
if (!(Clazz_instanceOf(o,"JU.M3"))) return false;
var m = o;
return this.m00 == m.m00 && this.m01 == m.m01 && this.m02 == m.m02 && this.m10 == m.m10 && this.m11 == m.m11 && this.m12 == m.m12 && this.m20 == m.m20 && this.m21 == m.m21 && this.m22 == m.m22;
}, "~O");
Clazz_overrideMethod(c$, "hashCode", 
function(){
return JU.T3.floatToIntBits(this.m00) ^ JU.T3.floatToIntBits(this.m01) ^ JU.T3.floatToIntBits(this.m02) ^ JU.T3.floatToIntBits(this.m10) ^ JU.T3.floatToIntBits(this.m11) ^ JU.T3.floatToIntBits(this.m12) ^ JU.T3.floatToIntBits(this.m20) ^ JU.T3.floatToIntBits(this.m21) ^ JU.T3.floatToIntBits(this.m22);
});
Clazz_defineMethod(c$, "setZero", 
function(){
this.clear33();
});
Clazz_defineMethod(c$, "set9", 
function(m00, m01, m02, m10, m11, m12, m20, m21, m22){
this.m00 = m00;
this.m01 = m01;
this.m02 = m02;
this.m10 = m10;
this.m11 = m11;
this.m12 = m12;
this.m20 = m20;
this.m21 = m21;
this.m22 = m22;
}, "~N,~N,~N,~N,~N,~N,~N,~N,~N");
Clazz_overrideMethod(c$, "toString", 
function(){
return "[[" + this.m00 + "\t" + this.m01 + "\t" + this.m02 + "]" + "\n  [" + this.m10 + "\t" + this.m11 + "\t" + this.m12 + "]" + "\n  [" + this.m20 + "\t" + this.m21 + "\t" + this.m22 + "]]";
});
Clazz_defineMethod(c$, "setAA", 
function(a){
this.setAA33(a);
return this;
}, "JU.A4");
Clazz_defineMethod(c$, "setAsBallRotation", 
function(responseFactor, dx, dy){
var r = Math.sqrt(dx * dx + dy * dy);
var th = r * responseFactor;
if (th == 0) {
this.setScale(1);
return false;
}var c = Math.cos(th);
var s = Math.sin(th);
var nx = -dy / r;
var ny = dx / r;
var c1 = c - 1;
this.m00 = 1 + c1 * nx * nx;
this.m01 = this.m10 = c1 * nx * ny;
this.m20 = -(this.m02 = s * nx);
this.m11 = 1 + c1 * ny * ny;
this.m21 = -(this.m12 = s * ny);
this.m22 = c;
return true;
}, "~N,~N,~N");
Clazz_defineMethod(c$, "isRotation", 
function(){
return (Math.abs(this.determinant3() - 1) < 0.001);
});
});
;//5.0.1-v7 Mon Aug 17 10:07:10 MDT 2026
Clazz_declarePackage("JU");
Clazz_load(["JU.M34"], "JU.M4", ["JU.T3"], function(){
var c$ = Clazz_decorateAsClass(function(){
this.m03 = 0;
this.m13 = 0;
this.m23 = 0;
this.m30 = 0;
this.m31 = 0;
this.m32 = 0;
this.m33 = 0;
Clazz_instantialize(this, arguments);}, JU, "M4", JU.M34);
c$.newA16 = Clazz_defineMethod(c$, "newA16", 
function(v){
var m =  new JU.M4();
m.m00 = v[0];
m.m01 = v[1];
m.m02 = v[2];
m.m03 = v[3];
m.m10 = v[4];
m.m11 = v[5];
m.m12 = v[6];
m.m13 = v[7];
m.m20 = v[8];
m.m21 = v[9];
m.m22 = v[10];
m.m23 = v[11];
m.m30 = v[12];
m.m31 = v[13];
m.m32 = v[14];
m.m33 = v[15];
return m;
}, "~A");
c$.newM4 = Clazz_defineMethod(c$, "newM4", 
function(m1){
var m =  new JU.M4();
if (m1 == null) {
m.setIdentity();
return m;
}m.setToM3(m1);
m.m03 = m1.m03;
m.m13 = m1.m13;
m.m23 = m1.m23;
m.m30 = m1.m30;
m.m31 = m1.m31;
m.m32 = m1.m32;
m.m33 = m1.m33;
return m;
}, "JU.M4");
c$.newMV = Clazz_defineMethod(c$, "newMV", 
function(m1, t){
var m =  new JU.M4();
m.setMV(m1, t);
return m;
}, "JU.M3,JU.T3");
Clazz_defineMethod(c$, "setZero", 
function(){
this.clear33();
this.m03 = this.m13 = this.m23 = this.m30 = this.m31 = this.m32 = this.m33 = 0.0;
});
Clazz_defineMethod(c$, "setIdentity", 
function(){
this.setZero();
this.m00 = this.m11 = this.m22 = this.m33 = 1.0;
});
Clazz_defineMethod(c$, "setM4", 
function(m1){
this.setM33(m1);
this.m03 = m1.m03;
this.m13 = m1.m13;
this.m23 = m1.m23;
this.m30 = m1.m30;
this.m31 = m1.m31;
this.m32 = m1.m32;
this.m33 = m1.m33;
return this;
}, "JU.M4");
Clazz_defineMethod(c$, "setMV", 
function(m1, t){
this.setM33(m1);
this.setTranslation(t);
this.m33 = 1;
}, "JU.M3,JU.T3");
Clazz_defineMethod(c$, "setToM3", 
function(m1){
this.setM33(m1);
this.m03 = this.m13 = this.m23 = this.m30 = this.m31 = this.m32 = 0.0;
this.m33 = 1.0;
}, "JU.M34");
Clazz_defineMethod(c$, "setToAA", 
function(a){
this.setIdentity();
this.setAA33(a);
}, "JU.A4");
Clazz_defineMethod(c$, "setA", 
function(m){
this.m00 = m[0];
this.m01 = m[1];
this.m02 = m[2];
this.m03 = m[3];
this.m10 = m[4];
this.m11 = m[5];
this.m12 = m[6];
this.m13 = m[7];
this.m20 = m[8];
this.m21 = m[9];
this.m22 = m[10];
this.m23 = m[11];
this.m30 = m[12];
this.m31 = m[13];
this.m32 = m[14];
this.m33 = m[15];
}, "~A");
Clazz_defineMethod(c$, "setTranslation", 
function(trans){
this.m03 = trans.x;
this.m13 = trans.y;
this.m23 = trans.z;
}, "JU.T3");
Clazz_defineMethod(c$, "setElement", 
function(row, col, v){
if (row < 3 && col < 3) {
this.set33(row, col, v);
return;
}if (row > 3 || col > 3) this.err();
switch (row) {
case 0:
this.m03 = v;
return;
case 1:
this.m13 = v;
return;
case 2:
this.m23 = v;
return;
}
switch (col) {
case 0:
this.m30 = v;
return;
case 1:
this.m31 = v;
return;
case 2:
this.m32 = v;
return;
case 3:
this.m33 = v;
return;
}
}, "~N,~N,~N");
Clazz_defineMethod(c$, "getElement", 
function(row, col){
if (row < 3 && col < 3) return this.get33(row, col);
if (row > 3 || col > 3) {
this.err();
return 0;
}switch (row) {
case 0:
return this.m03;
case 1:
return this.m13;
case 2:
return this.m23;
default:
switch (col) {
case 0:
return this.m30;
case 1:
return this.m31;
case 2:
return this.m32;
default:
return this.m33;
}
}
}, "~N,~N");
Clazz_defineMethod(c$, "getTranslation", 
function(trans){
trans.x = this.m03;
trans.y = this.m13;
trans.z = this.m23;
}, "JU.T3");
Clazz_defineMethod(c$, "getRotationScale", 
function(m1){
m1.m00 = this.m00;
m1.m01 = this.m01;
m1.m02 = this.m02;
m1.m10 = this.m10;
m1.m11 = this.m11;
m1.m12 = this.m12;
m1.m20 = this.m20;
m1.m21 = this.m21;
m1.m22 = this.m22;
}, "JU.M3");
Clazz_defineMethod(c$, "setRotationScale", 
function(m1){
this.m00 = m1.m00;
this.m01 = m1.m01;
this.m02 = m1.m02;
this.m10 = m1.m10;
this.m11 = m1.m11;
this.m12 = m1.m12;
this.m20 = m1.m20;
this.m21 = m1.m21;
this.m22 = m1.m22;
}, "JU.M3");
Clazz_defineMethod(c$, "setRowA", 
function(row, v){
if (row < 3) this.setRow33(row, v);
switch (row) {
case 0:
this.m03 = v[3];
return;
case 1:
this.m13 = v[3];
return;
case 2:
this.m23 = v[3];
return;
case 3:
this.m30 = v[0];
this.m31 = v[1];
this.m32 = v[2];
this.m33 = v[3];
return;
}
this.err();
}, "~N,~A");
Clazz_overrideMethod(c$, "getRow", 
function(row, v){
if (row < 3) this.getRow33(row, v);
switch (row) {
case 0:
v[3] = this.m03;
return;
case 1:
v[3] = this.m13;
return;
case 2:
v[3] = this.m23;
return;
case 3:
v[0] = this.m30;
v[1] = this.m31;
v[2] = this.m32;
v[3] = this.m33;
return;
}
this.err();
}, "~N,~A");
Clazz_defineMethod(c$, "setColumn4", 
function(column, x, y, z, w){
if (column == 0) {
this.m00 = x;
this.m10 = y;
this.m20 = z;
this.m30 = w;
} else if (column == 1) {
this.m01 = x;
this.m11 = y;
this.m21 = z;
this.m31 = w;
} else if (column == 2) {
this.m02 = x;
this.m12 = y;
this.m22 = z;
this.m32 = w;
} else if (column == 3) {
this.m03 = x;
this.m13 = y;
this.m23 = z;
this.m33 = w;
} else {
this.err();
}}, "~N,~N,~N,~N,~N");
Clazz_defineMethod(c$, "setColumnA", 
function(column, v){
if (column < 3) this.setColumn33(column, v);
switch (column) {
case 0:
this.m30 = v[3];
return;
case 1:
this.m31 = v[3];
return;
case 2:
this.m32 = v[3];
return;
case 3:
this.m03 = v[0];
this.m13 = v[1];
this.m23 = v[2];
this.m33 = v[3];
return;
default:
this.err();
}
}, "~N,~A");
Clazz_defineMethod(c$, "getColumn", 
function(column, v){
if (column < 3) this.getColumn33(column, v);
switch (column) {
case 0:
v[3] = this.m30;
return;
case 1:
v[3] = this.m31;
return;
case 2:
v[3] = this.m32;
return;
case 3:
v[0] = this.m03;
v[1] = this.m13;
v[2] = this.m23;
v[3] = this.m33;
return;
default:
this.err();
}
}, "~N,~A");
Clazz_defineMethod(c$, "sub", 
function(m1){
this.sub33(m1);
this.m03 -= m1.m03;
this.m13 -= m1.m13;
this.m23 -= m1.m23;
this.m30 -= m1.m30;
this.m31 -= m1.m31;
this.m32 -= m1.m32;
this.m33 -= m1.m33;
}, "JU.M4");
Clazz_defineMethod(c$, "add", 
function(pt){
this.m03 += pt.x;
this.m13 += pt.y;
this.m23 += pt.z;
}, "JU.T3");
Clazz_defineMethod(c$, "transpose", 
function(){
this.transpose33();
var tmp = this.m03;
this.m03 = this.m30;
this.m30 = tmp;
tmp = this.m13;
this.m13 = this.m31;
this.m31 = tmp;
tmp = this.m23;
this.m23 = this.m32;
this.m32 = tmp;
});
Clazz_defineMethod(c$, "invert", 
function(){
var s = this.determinant4();
if (s == 0.0) return this;
s = 1 / s;
this.set(this.m11 * (this.m22 * this.m33 - this.m23 * this.m32) + this.m12 * (this.m23 * this.m31 - this.m21 * this.m33) + this.m13 * (this.m21 * this.m32 - this.m22 * this.m31), this.m21 * (this.m02 * this.m33 - this.m03 * this.m32) + this.m22 * (this.m03 * this.m31 - this.m01 * this.m33) + this.m23 * (this.m01 * this.m32 - this.m02 * this.m31), this.m31 * (this.m02 * this.m13 - this.m03 * this.m12) + this.m32 * (this.m03 * this.m11 - this.m01 * this.m13) + this.m33 * (this.m01 * this.m12 - this.m02 * this.m11), this.m01 * (this.m13 * this.m22 - this.m12 * this.m23) + this.m02 * (this.m11 * this.m23 - this.m13 * this.m21) + this.m03 * (this.m12 * this.m21 - this.m11 * this.m22), this.m12 * (this.m20 * this.m33 - this.m23 * this.m30) + this.m13 * (this.m22 * this.m30 - this.m20 * this.m32) + this.m10 * (this.m23 * this.m32 - this.m22 * this.m33), this.m22 * (this.m00 * this.m33 - this.m03 * this.m30) + this.m23 * (this.m02 * this.m30 - this.m00 * this.m32) + this.m20 * (this.m03 * this.m32 - this.m02 * this.m33), this.m32 * (this.m00 * this.m13 - this.m03 * this.m10) + this.m33 * (this.m02 * this.m10 - this.m00 * this.m12) + this.m30 * (this.m03 * this.m12 - this.m02 * this.m13), this.m02 * (this.m13 * this.m20 - this.m10 * this.m23) + this.m03 * (this.m10 * this.m22 - this.m12 * this.m20) + this.m00 * (this.m12 * this.m23 - this.m13 * this.m22), this.m13 * (this.m20 * this.m31 - this.m21 * this.m30) + this.m10 * (this.m21 * this.m33 - this.m23 * this.m31) + this.m11 * (this.m23 * this.m30 - this.m20 * this.m33), this.m23 * (this.m00 * this.m31 - this.m01 * this.m30) + this.m20 * (this.m01 * this.m33 - this.m03 * this.m31) + this.m21 * (this.m03 * this.m30 - this.m00 * this.m33), this.m33 * (this.m00 * this.m11 - this.m01 * this.m10) + this.m30 * (this.m01 * this.m13 - this.m03 * this.m11) + this.m31 * (this.m03 * this.m10 - this.m00 * this.m13), this.m03 * (this.m11 * this.m20 - this.m10 * this.m21) + this.m00 * (this.m13 * this.m21 - this.m11 * this.m23) + this.m01 * (this.m10 * this.m23 - this.m13 * this.m20), this.m10 * (this.m22 * this.m31 - this.m21 * this.m32) + this.m11 * (this.m20 * this.m32 - this.m22 * this.m30) + this.m12 * (this.m21 * this.m30 - this.m20 * this.m31), this.m20 * (this.m02 * this.m31 - this.m01 * this.m32) + this.m21 * (this.m00 * this.m32 - this.m02 * this.m30) + this.m22 * (this.m01 * this.m30 - this.m00 * this.m31), this.m30 * (this.m02 * this.m11 - this.m01 * this.m12) + this.m31 * (this.m00 * this.m12 - this.m02 * this.m10) + this.m32 * (this.m01 * this.m10 - this.m00 * this.m11), this.m00 * (this.m11 * this.m22 - this.m12 * this.m21) + this.m01 * (this.m12 * this.m20 - this.m10 * this.m22) + this.m02 * (this.m10 * this.m21 - this.m11 * this.m20));
this.scale(s);
return this;
});
Clazz_defineMethod(c$, "set", 
function(m00, m01, m02, m03, m10, m11, m12, m13, m20, m21, m22, m23, m30, m31, m32, m33){
this.m00 = m00;
this.m01 = m01;
this.m02 = m02;
this.m03 = m03;
this.m10 = m10;
this.m11 = m11;
this.m12 = m12;
this.m13 = m13;
this.m20 = m20;
this.m21 = m21;
this.m22 = m22;
this.m23 = m23;
this.m30 = m30;
this.m31 = m31;
this.m32 = m32;
this.m33 = m33;
}, "~N,~N,~N,~N,~N,~N,~N,~N,~N,~N,~N,~N,~N,~N,~N,~N");
Clazz_defineMethod(c$, "determinant4", 
function(){
return (this.m00 * this.m11 - this.m01 * this.m10) * (this.m22 * this.m33 - this.m23 * this.m32) - (this.m00 * this.m12 - this.m02 * this.m10) * (this.m21 * this.m33 - this.m23 * this.m31) + (this.m00 * this.m13 - this.m03 * this.m10) * (this.m21 * this.m32 - this.m22 * this.m31) + (this.m01 * this.m12 - this.m02 * this.m11) * (this.m20 * this.m33 - this.m23 * this.m30) - (this.m01 * this.m13 - this.m03 * this.m11) * (this.m20 * this.m32 - this.m22 * this.m30) + (this.m02 * this.m13 - this.m03 * this.m12) * (this.m20 * this.m31 - this.m21 * this.m30);
});
Clazz_defineMethod(c$, "scale", 
function(scalar){
this.mul33(scalar);
this.m03 *= scalar;
this.m13 *= scalar;
this.m23 *= scalar;
this.m30 *= scalar;
this.m31 *= scalar;
this.m32 *= scalar;
this.m33 *= scalar;
}, "~N");
Clazz_defineMethod(c$, "mul", 
function(m1){
this.mul2(this, m1);
}, "JU.M4");
Clazz_defineMethod(c$, "mul2", 
function(m1, m2){
this.set(m1.m00 * m2.m00 + m1.m01 * m2.m10 + m1.m02 * m2.m20 + m1.m03 * m2.m30, m1.m00 * m2.m01 + m1.m01 * m2.m11 + m1.m02 * m2.m21 + m1.m03 * m2.m31, m1.m00 * m2.m02 + m1.m01 * m2.m12 + m1.m02 * m2.m22 + m1.m03 * m2.m32, m1.m00 * m2.m03 + m1.m01 * m2.m13 + m1.m02 * m2.m23 + m1.m03 * m2.m33, m1.m10 * m2.m00 + m1.m11 * m2.m10 + m1.m12 * m2.m20 + m1.m13 * m2.m30, m1.m10 * m2.m01 + m1.m11 * m2.m11 + m1.m12 * m2.m21 + m1.m13 * m2.m31, m1.m10 * m2.m02 + m1.m11 * m2.m12 + m1.m12 * m2.m22 + m1.m13 * m2.m32, m1.m10 * m2.m03 + m1.m11 * m2.m13 + m1.m12 * m2.m23 + m1.m13 * m2.m33, m1.m20 * m2.m00 + m1.m21 * m2.m10 + m1.m22 * m2.m20 + m1.m23 * m2.m30, m1.m20 * m2.m01 + m1.m21 * m2.m11 + m1.m22 * m2.m21 + m1.m23 * m2.m31, m1.m20 * m2.m02 + m1.m21 * m2.m12 + m1.m22 * m2.m22 + m1.m23 * m2.m32, m1.m20 * m2.m03 + m1.m21 * m2.m13 + m1.m22 * m2.m23 + m1.m23 * m2.m33, m1.m30 * m2.m00 + m1.m31 * m2.m10 + m1.m32 * m2.m20 + m1.m33 * m2.m30, m1.m30 * m2.m01 + m1.m31 * m2.m11 + m1.m32 * m2.m21 + m1.m33 * m2.m31, m1.m30 * m2.m02 + m1.m31 * m2.m12 + m1.m32 * m2.m22 + m1.m33 * m2.m32, m1.m30 * m2.m03 + m1.m31 * m2.m13 + m1.m32 * m2.m23 + m1.m33 * m2.m33);
}, "JU.M4,JU.M4");
Clazz_defineMethod(c$, "transform", 
function(vec){
this.transform2(vec, vec);
}, "JU.T4");
Clazz_defineMethod(c$, "transform2", 
function(vec, vecOut){
vecOut.set4(this.m00 * vec.x + this.m01 * vec.y + this.m02 * vec.z + this.m03 * vec.w, this.m10 * vec.x + this.m11 * vec.y + this.m12 * vec.z + this.m13 * vec.w, this.m20 * vec.x + this.m21 * vec.y + this.m22 * vec.z + this.m23 * vec.w, this.m30 * vec.x + this.m31 * vec.y + this.m32 * vec.z + this.m33 * vec.w);
}, "JU.T4,JU.T4");
Clazz_defineMethod(c$, "rotTrans", 
function(point){
this.rotTrans2(point, point);
}, "JU.T3");
Clazz_defineMethod(c$, "rotTrans2", 
function(point, pointOut){
pointOut.set(this.m00 * point.x + this.m01 * point.y + this.m02 * point.z + this.m03, this.m10 * point.x + this.m11 * point.y + this.m12 * point.z + this.m13, this.m20 * point.x + this.m21 * point.y + this.m22 * point.z + this.m23);
return pointOut;
}, "JU.T3,JU.T3");
Clazz_defineMethod(c$, "setAsXYRotation", 
function(angle){
this.setIdentity();
var c = Math.cos(angle);
var s = Math.sin(angle);
this.m22 = c;
this.m23 = -s;
this.m32 = s;
this.m33 = c;
return this;
}, "~N");
Clazz_defineMethod(c$, "setAsYZRotation", 
function(angle){
this.setIdentity();
var c = Math.cos(angle);
var s = Math.sin(angle);
this.m00 = c;
this.m03 = -s;
this.m30 = s;
this.m33 = c;
return this;
}, "~N");
Clazz_defineMethod(c$, "setAsXZRotation", 
function(angle){
this.setIdentity();
var c = Math.cos(angle);
var s = Math.sin(angle);
this.m11 = c;
this.m13 = -s;
this.m31 = s;
this.m33 = c;
return this;
}, "~N");
Clazz_overrideMethod(c$, "equals", 
function(o){
if (!(Clazz_instanceOf(o,"JU.M4"))) return false;
var m = o;
return (this.m00 == m.m00 && this.m01 == m.m01 && this.m02 == m.m02 && this.m03 == m.m03 && this.m10 == m.m10 && this.m11 == m.m11 && this.m12 == m.m12 && this.m13 == m.m13 && this.m20 == m.m20 && this.m21 == m.m21 && this.m22 == m.m22 && this.m23 == m.m23 && this.m30 == m.m30 && this.m31 == m.m31 && this.m32 == m.m32 && this.m33 == m.m33);
}, "~O");
Clazz_overrideMethod(c$, "hashCode", 
function(){
return JU.T3.floatToIntBits(this.m00) ^ JU.T3.floatToIntBits(this.m01) ^ JU.T3.floatToIntBits(this.m02) ^ JU.T3.floatToIntBits(this.m03) ^ JU.T3.floatToIntBits(this.m10) ^ JU.T3.floatToIntBits(this.m11) ^ JU.T3.floatToIntBits(this.m12) ^ JU.T3.floatToIntBits(this.m13) ^ JU.T3.floatToIntBits(this.m20) ^ JU.T3.floatToIntBits(this.m21) ^ JU.T3.floatToIntBits(this.m22) ^ JU.T3.floatToIntBits(this.m23) ^ JU.T3.floatToIntBits(this.m30) ^ JU.T3.floatToIntBits(this.m31) ^ JU.T3.floatToIntBits(this.m32) ^ JU.T3.floatToIntBits(this.m33);
});
Clazz_overrideMethod(c$, "toString", 
function(){
return "[[" + this.m00 + "\t" + this.m01 + "\t" + this.m02 + "\t" + this.m03 + "]" + "\n  [" + this.m10 + "\t" + this.m11 + "\t" + this.m12 + "\t" + this.m13 + "]" + "\n  [" + this.m20 + "\t" + this.m21 + "\t" + this.m22 + "\t" + this.m23 + "]" + "\n  [" + this.m30 + "\t" + this.m31 + "\t" + this.m32 + "\t" + this.m33 + "]]";
});
Clazz_defineMethod(c$, "round", 
function(f){
this.m00 = this.rnd(this.m00, f);
this.m01 = this.rnd(this.m01, f);
this.m02 = this.rnd(this.m02, f);
this.m03 = this.rnd(this.m03, f);
this.m10 = this.rnd(this.m10, f);
this.m11 = this.rnd(this.m11, f);
this.m12 = this.rnd(this.m12, f);
this.m13 = this.rnd(this.m13, f);
this.m20 = this.rnd(this.m20, f);
this.m21 = this.rnd(this.m21, f);
this.m22 = this.rnd(this.m22, f);
this.m23 = this.rnd(this.m23, f);
this.m30 = this.rnd(this.m30, f);
this.m31 = this.rnd(this.m31, f);
this.m32 = this.rnd(this.m32, f);
this.m33 = this.rnd(this.m33, f);
return this;
}, "~N");
Clazz_defineMethod(c$, "rnd", 
function(n, f){
return (Math.abs(n) < f ? 0 : n);
}, "~N,~N");
});
;//5.0.1-v7 Mon Aug 17 10:07:10 MDT 2026
Clazz_declarePackage("JU");
Clazz_load(["java.io.OutputStream", "javajs.api.GenericOutputChannel"], "JU.OC", ["java.io.BufferedWriter", "$.ByteArrayOutputStream", "$.OutputStreamWriter", "JU.Base64", "$.SB"], function(){
var c$ = Clazz_decorateAsClass(function(){
this.bytePoster = null;
this.fileName = null;
this.bw = null;
this.isLocalFile = false;
this.byteCount = 0;
this.isCanceled = false;
this.closed = false;
this.os = null;
this.sb = null;
this.type = null;
this.$isBase64 = false;
this.os0 = null;
this.bytes = null;
this.bigEndian = true;
Clazz_instantialize(this, arguments);}, JU, "OC", java.io.OutputStream, javajs.api.GenericOutputChannel);
Clazz_makeConstructor(c$, 
function(){
Clazz_superConstructor (this, JU.OC, []);
});
Clazz_makeConstructor(c$, 
function(fileName){
Clazz_superConstructor (this, JU.OC, []);
this.setParams(null, fileName, false, null);
}, "~S");
Clazz_defineMethod(c$, "setParams", 
function(bytePoster, fileName, asWriter, os){
this.bytePoster = bytePoster;
this.$isBase64 = ";base64,".equals(fileName);
if (this.$isBase64) {
fileName = null;
this.os0 = os;
os = null;
}this.fileName = fileName;
this.os = os;
this.isLocalFile = (fileName != null && !JU.OC.isRemote(fileName));
if (asWriter && !this.$isBase64 && os != null) this.bw =  new java.io.BufferedWriter( new java.io.OutputStreamWriter(os));
return this;
}, "javajs.api.BytePoster,~S,~B,java.io.OutputStream");
Clazz_overrideMethod(c$, "isBigEndian", 
function(){
return this.bigEndian;
});
Clazz_defineMethod(c$, "setBigEndian", 
function(TF){
this.bigEndian = TF;
}, "~B");
Clazz_defineMethod(c$, "setBytes", 
function(b){
this.bytes = b;
return this;
}, "~A");
Clazz_defineMethod(c$, "getFileName", 
function(){
return this.fileName;
});
Clazz_defineMethod(c$, "getName", 
function(){
return (this.fileName == null ? null : this.fileName.substring(this.fileName.lastIndexOf("/") + 1));
});
Clazz_defineMethod(c$, "getByteCount", 
function(){
return this.byteCount;
});
Clazz_defineMethod(c$, "setType", 
function(type){
this.type = type;
}, "~S");
Clazz_defineMethod(c$, "getType", 
function(){
return this.type;
});
Clazz_defineMethod(c$, "append", 
function(s){
try {
if (this.bw != null) {
this.bw.write(s);
} else if (this.os == null) {
if (this.sb == null) this.sb =  new JU.SB();
this.sb.append(s);
} else {
var b = s.getBytes();
this.os.write(b, 0, b.length);
this.byteCount += b.length;
return this;
}} catch (e) {
if (Clazz_exceptionOf(e,"java.io.IOException")){
} else {
throw e;
}
}
this.byteCount += s.length;
return this;
}, "~S");
Clazz_overrideMethod(c$, "reset", 
function(){
this.sb = null;
this.initOS();
});
Clazz_defineMethod(c$, "initOS", 
function(){
if (this.sb != null) {
var s = this.sb.toString();
this.reset();
this.append(s);
return;
}try {
{
this.os = null;
}if (this.os == null) this.os =  new java.io.ByteArrayOutputStream();
if (this.bw != null) {
this.bw.close();
this.bw =  new java.io.BufferedWriter( new java.io.OutputStreamWriter(this.os));
}} catch (e) {
if (Clazz_exceptionOf(e, Exception)){
System.out.println(e.toString());
} else {
throw e;
}
}
this.byteCount = 0;
});
Clazz_overrideMethod(c$, "writeByteAsInt", 
function(b){
if (this.os == null) this.initOS();
{
this.os.writeByteAsInt(b);
}this.byteCount++;
}, "~N");
Clazz_overrideMethod(c$, "write", 
function(buf, i, len){
if (this.os == null) this.initOS();
if (len < 0) len = buf.length - i;
try {
this.os.write(buf, i, len);
} catch (e) {
if (Clazz_exceptionOf(e,"java.io.IOException")){
} else {
throw e;
}
}
this.byteCount += len;
}, "~A,~N,~N");
Clazz_overrideMethod(c$, "writeShort", 
function(i){
if (this.isBigEndian()) {
this.writeByteAsInt(i >> 8);
this.writeByteAsInt(i);
} else {
this.writeByteAsInt(i);
this.writeByteAsInt(i >> 8);
}}, "~N");
Clazz_overrideMethod(c$, "writeLong", 
function(b){
if (this.isBigEndian()) {
this.writeInt(((b >> 32) & 0xFFFFFFFF));
this.writeInt((b & 0xFFFFFFFF));
} else {
this.writeByteAsInt((b >> 56));
this.writeByteAsInt((b >> 48));
this.writeByteAsInt((b >> 40));
this.writeByteAsInt((b >> 32));
this.writeByteAsInt((b >> 24));
this.writeByteAsInt((b >> 16));
this.writeByteAsInt((b >> 8));
this.writeByteAsInt(b);
}}, "~N");
Clazz_defineMethod(c$, "write", 
function(b){
this.write(b, 0, b.length);
}, "~A");
Clazz_defineMethod(c$, "cancel", 
function(){
this.isCanceled = true;
this.closeChannel();
});
Clazz_overrideMethod(c$, "closeChannel", 
function(){
if (this.closed) return null;
try {
if (this.bw != null) {
this.bw.flush();
this.bw.close();
} else if (this.os != null) {
this.os.flush();
this.os.close();
}if (this.os0 != null && this.isCanceled) {
this.os0.flush();
this.os0.close();
}} catch (e) {
if (Clazz_exceptionOf(e, Exception)){
} else {
throw e;
}
}
if (this.isCanceled) {
this.closed = true;
return null;
}if (this.fileName == null) {
if (this.$isBase64) {
var s = this.getBase64();
if (this.os0 != null) {
this.os = this.os0;
this.append(s);
}this.sb =  new JU.SB();
this.sb.append(s);
this.$isBase64 = false;
return this.closeChannel();
}return (this.sb == null ? null : this.sb.toString());
}this.closed = true;
if (!this.isLocalFile) {
var ret = this.postByteArray();
if (ret == null || ret.startsWith("java.net")) this.byteCount = -1;
return ret;
}var jmol = null;
var _function = null;
{
jmol = self.J2S || Jmol; _function = (typeof this.fileName ==
"function" ? this.fileName : null);
}if (jmol != null) {
var data = (this.sb == null ? this.toByteArray() : this.sb.toString());
if (_function == null) jmol.doAjax(this.fileName, null, data, this.sb == null);
 else jmol.applyFunc(this.fileName, data);
}return null;
});
Clazz_defineMethod(c$, "isBase64", 
function(){
return this.$isBase64;
});
Clazz_defineMethod(c$, "getBase64", 
function(){
return JU.Base64.getBase64(this.toByteArray()).toString();
});
Clazz_defineMethod(c$, "toByteArray", 
function(){
return (this.bytes != null ? this.bytes : Clazz_instanceOf(this.os,"java.io.ByteArrayOutputStream") ? (this.os).toByteArray() : null);
});
Clazz_defineMethod(c$, "close", 
function(){
this.closeChannel();
});
Clazz_overrideMethod(c$, "toString", 
function(){
if (this.bw != null) try {
this.bw.flush();
} catch (e) {
if (Clazz_exceptionOf(e,"java.io.IOException")){
} else {
throw e;
}
}
if (this.sb != null) return this.closeChannel();
return this.byteCount + " bytes";
});
Clazz_defineMethod(c$, "postByteArray", 
function(){
var bytes = (this.sb == null ? this.toByteArray() : this.sb.toString().getBytes());
return this.bytePoster.postByteArray(this.fileName, bytes);
});
c$.isRemote = Clazz_defineMethod(c$, "isRemote", 
function(fileName){
if (fileName == null) return false;
var itype = JU.OC.urlTypeIndex(fileName);
return (itype >= 0 && itype < 4);
}, "~S");
c$.isLocal = Clazz_defineMethod(c$, "isLocal", 
function(fileName){
return (fileName != null && !JU.OC.isRemote(fileName));
}, "~S");
c$.urlTypeIndex = Clazz_defineMethod(c$, "urlTypeIndex", 
function(name){
if (name == null) return -2;
for (var i = 0; i < JU.OC.urlPrefixes.length; ++i) {
if (name.startsWith(JU.OC.urlPrefixes[i])) {
return i;
}}
return -1;
}, "~S");
Clazz_overrideMethod(c$, "writeInt", 
function(i){
if (this.bigEndian) {
this.writeByteAsInt(i >> 24);
this.writeByteAsInt(i >> 16);
this.writeByteAsInt(i >> 8);
this.writeByteAsInt(i);
} else {
this.writeByteAsInt(i);
this.writeByteAsInt(i >> 8);
this.writeByteAsInt(i >> 16);
this.writeByteAsInt(i >> 24);
}}, "~N");
Clazz_defineMethod(c$, "writeFloat", 
function(x){
this.writeInt(x == 0 ? 0 : Float.floatToIntBits(x));
}, "~N");
c$.urlPrefixes =  Clazz_newArray(-1, ["http:", "https:", "sftp:", "ftp:", "file:", "cache:"]);
});
;//5.0.1-v7 Mon Aug 17 10:07:10 MDT 2026
Clazz_declarePackage("JU");
Clazz_load(["JU.T3"], "JU.P3", null, function(){
var c$ = Clazz_declareType(JU, "P3", JU.T3);
c$.newP = Clazz_defineMethod(c$, "newP", 
function(t){
var p =  new JU.P3();
p.x = t.x;
p.y = t.y;
p.z = t.z;
return p;
}, "JU.T3");
c$.getUnlikely = Clazz_defineMethod(c$, "getUnlikely", 
function(){
return (JU.P3.unlikely == null ? JU.P3.unlikely = JU.P3.new3(3.141592653589793, 2.718281828459045, (8.539734222673566)) : JU.P3.unlikely);
});
c$.new3 = Clazz_defineMethod(c$, "new3", 
function(x, y, z){
var p =  new JU.P3();
p.x = x;
p.y = y;
p.z = z;
return p;
}, "~N,~N,~N");
c$.newA = Clazz_defineMethod(c$, "newA", 
function(a){
return JU.P3.new3(a[0], a[1], a[2]);
}, "~A");
c$.unlikely = null;
});
;//5.0.1-v7 Mon Aug 17 10:07:10 MDT 2026
Clazz_declarePackage("JU");
Clazz_load(["JU.T3i"], "JU.P3i", null, function(){
var c$ = Clazz_declareType(JU, "P3i", JU.T3i);
c$.new3 = Clazz_defineMethod(c$, "new3", 
function(x, y, z){
var pt =  new JU.P3i();
pt.x = x;
pt.y = y;
pt.z = z;
return pt;
}, "~N,~N,~N");
});
;//5.0.1-v7 Mon Aug 17 10:07:10 MDT 2026
Clazz_declarePackage("JU");
Clazz_load(["JU.T4"], "JU.P4", null, function(){
var c$ = Clazz_declareType(JU, "P4", JU.T4);
c$.new4 = Clazz_defineMethod(c$, "new4", 
function(x, y, z, w){
var pt =  new JU.P4();
pt.set4(x, y, z, w);
return pt;
}, "~N,~N,~N,~N");
c$.newPt = Clazz_defineMethod(c$, "newPt", 
function(value){
var pt =  new JU.P4();
pt.set4(value.x, value.y, value.z, value.w);
return pt;
}, "JU.P4");
Clazz_defineMethod(c$, "distance4", 
function(p1){
var dx = this.x - p1.x;
var dy = this.y - p1.y;
var dz = this.z - p1.z;
var dw = this.w - p1.w;
return Math.sqrt(dx * dx + dy * dy + dz * dz + dw * dw);
}, "JU.P4");
});
;//5.0.1-v7 Mon Aug 17 10:07:10 MDT 2026
Clazz_declarePackage("JU");
Clazz_load(null, "JU.PT", ["java.util.Arrays", "JU.AU", "$.DF", "$.SB"], function(){
var c$ = Clazz_declareType(JU, "PT", null);
c$.parseInt = Clazz_defineMethod(c$, "parseInt", 
function(str){
return JU.PT.parseIntNext(str,  Clazz_newIntArray(-1, [0]));
}, "~S");
c$.parseIntNext = Clazz_defineMethod(c$, "parseIntNext", 
function(str, next){
var cch = str.length;
if (next[0] < 0 || next[0] >= cch) return -2147483648;
return JU.PT.parseIntChecked(str, cch, next);
}, "~S,~A");
c$.parseIntChecked = Clazz_defineMethod(c$, "parseIntChecked", 
function(str, ichMax, next){
var digitSeen = false;
var value = 0;
var ich = next[0];
if (ich < 0) return -2147483648;
var ch;
while (ich < ichMax && JU.PT.isWhiteSpace(str, ich)) ++ich;

var negative = false;
if (ich < ichMax && (str.charAt(ich)).charCodeAt(0) == 45) {
negative = true;
++ich;
}while (ich < ichMax && (ch = (str.charAt(ich)).charCodeAt(0)) >= 48 && ch <= 57) {
value = value * 10 + (ch - 48);
digitSeen = true;
++ich;
}
if (!digitSeen) value = -2147483648;
 else if (negative) value = -value;
next[0] = ich;
return value;
}, "~S,~N,~A");
c$.isWhiteSpace = Clazz_defineMethod(c$, "isWhiteSpace", 
function(str, ich){
var ch;
return (ich >= 0 && ((ch = str.charAt(ich)) == ' ' || ch == '\t' || ch == '\n'));
}, "~S,~N");
c$.parseFloatChecked = Clazz_defineMethod(c$, "parseFloatChecked", 
function(str, ichMax, next, isStrict){
var digitSeen = false;
var ich = next[0];
if (isStrict && str.indexOf('\n') != str.lastIndexOf('\n')) return NaN;
while (ich < ichMax && JU.PT.isWhiteSpace(str, ich)) ++ich;

var negative = false;
if (ich < ichMax && str.charAt(ich) == '-') {
++ich;
negative = true;
}var ch = 0;
var ival = 0;
var ival2 = 0;
while (ich < ichMax && (ch = (str.charAt(ich)).charCodeAt(0)) >= 48 && ch <= 57) {
ival = (ival * 10) + (ch - 48) * 1;
++ich;
digitSeen = true;
}
var isDecimal = false;
var iscale = 0;
var nzero = (ival == 0 ? -1 : 0);
if (ch == 46) {
isDecimal = true;
while (++ich < ichMax && (ch = (str.charAt(ich)).charCodeAt(0)) >= 48 && ch <= 57) {
digitSeen = true;
if (nzero < 0) {
if (ch == 48) {
nzero--;
continue;
}nzero = -nzero;
}if (iscale < JU.PT.decimalScale.length) {
ival2 = (ival2 * 10) + (ch - 48) * 1;
iscale++;
}}
}var value;
if (!digitSeen) {
value = NaN;
} else if (ival2 > 0) {
value = ival2 * JU.PT.decimalScale[iscale - 1];
if (nzero > 1) {
if (nzero - 2 < JU.PT.decimalScale.length) {
value *= JU.PT.decimalScale[nzero - 2];
} else {
value *= Math.pow(10, 1 - nzero);
}} else {
value += ival;
}} else {
value = ival;
}var isExponent = false;
if (ich < ichMax && (ch == 69 || ch == 101 || ch == 68)) {
isExponent = true;
if (++ich >= ichMax) return NaN;
ch = (str.charAt(ich)).charCodeAt(0);
if ((ch == 43) && (++ich >= ichMax)) return NaN;
next[0] = ich;
var exponent = JU.PT.parseIntChecked(str, ichMax, next);
if (exponent == -2147483648) return NaN;
if (exponent > 0 && exponent <= JU.PT.tensScale.length) value *= JU.PT.tensScale[exponent - 1];
 else if (exponent < 0 && -exponent <= JU.PT.decimalScale.length) value *= JU.PT.decimalScale[-exponent - 1];
 else if (exponent != 0) value *= Math.pow(10, exponent);
} else {
next[0] = ich;
}if (negative) value = -value;
if (value == Infinity) value = 3.4028235E38;
return (!isStrict || (!isExponent || isDecimal) && JU.PT.checkTrailingText(str, next[0], ichMax) ? value : NaN);
}, "~S,~N,~A,~B");
c$.checkTrailingText = Clazz_defineMethod(c$, "checkTrailingText", 
function(str, ich, ichMax){
var ch;
while (ich < ichMax && (JU.PT.isWhitespace(ch = str.charAt(ich)) || ch == ';')) ++ich;

return (ich == ichMax);
}, "~S,~N,~N");
c$.parseFloatArray = Clazz_defineMethod(c$, "parseFloatArray", 
function(str){
return JU.PT.parseFloatArrayNext(str,  Clazz_newIntArray (1, 0), null, null, null);
}, "~S");
c$.parseFloatArrayInfested = Clazz_defineMethod(c$, "parseFloatArrayInfested", 
function(tokens, data){
var len = data.length;
var nTokens = tokens.length;
var n = 0;
var max = 0;
for (var i = 0; i >= 0 && i < len && n < nTokens; i++) {
var f;
while (Float.isNaN(f = JU.PT.parseFloat(tokens[n++])) && n < nTokens) {
}
if (!Float.isNaN(f)) data[(max = i)] = f;
if (n == nTokens) break;
}
return max + 1;
}, "~A,~A");
c$.parseFloatArrayNext = Clazz_defineMethod(c$, "parseFloatArrayNext", 
function(str, next, f, strStart, strEnd){
var n = 0;
var pt = next[0];
if (pt >= 0) {
if (strStart != null) {
var p = str.indexOf(strStart, pt);
if (p >= 0) next[0] = p + strStart.length;
}str = str.substring(next[0]);
pt = (strEnd == null ? -1 : str.indexOf(strEnd));
if (pt < 0) pt = str.length;
 else str = str.substring(0, pt);
next[0] += pt + 1;
var tokens = JU.PT.getTokens(str);
if (f == null) f =  Clazz_newFloatArray (tokens.length, 0);
n = JU.PT.parseFloatArrayInfested(tokens, f);
}if (f == null) return  Clazz_newFloatArray (0, 0);
for (var i = n; i < f.length; i++) f[i] = NaN;

return f;
}, "~S,~A,~A,~S,~S");
c$.parseFloatRange = Clazz_defineMethod(c$, "parseFloatRange", 
function(str, ichMax, next){
var cch = str.length;
if (ichMax > cch) ichMax = cch;
if (next[0] < 0 || next[0] >= ichMax) return NaN;
return JU.PT.parseFloatChecked(str, ichMax, next, false);
}, "~S,~N,~A");
c$.parseFloatNext = Clazz_defineMethod(c$, "parseFloatNext", 
function(str, next){
var cch = (str == null ? -1 : str.length);
return (next[0] < 0 || next[0] >= cch ? NaN : JU.PT.parseFloatChecked(str, cch, next, false));
}, "~S,~A");
c$.parseFloatStrict = Clazz_defineMethod(c$, "parseFloatStrict", 
function(str){
var cch = str.length;
if (cch == 0) return NaN;
return JU.PT.parseFloatChecked(str, cch,  Clazz_newIntArray(-1, [0]), true);
}, "~S");
c$.parseFloat = Clazz_defineMethod(c$, "parseFloat", 
function(str){
return JU.PT.parseFloatNext(str,  Clazz_newIntArray(-1, [0]));
}, "~S");
c$.parseIntRadix = Clazz_defineMethod(c$, "parseIntRadix", 
function(s, i){
{
return Integer.parseIntRadix(s, i);
}}, "~S,~N");
c$.getTokens = Clazz_defineMethod(c$, "getTokens", 
function(line){
return JU.PT.getTokensAt(line, 0);
}, "~S");
c$.parseToken = Clazz_defineMethod(c$, "parseToken", 
function(str){
return JU.PT.parseTokenNext(str,  Clazz_newIntArray(-1, [0]));
}, "~S");
c$.parseTrimmed = Clazz_defineMethod(c$, "parseTrimmed", 
function(str){
return JU.PT.parseTrimmedRange(str, 0, str.length);
}, "~S");
c$.parseTrimmedAt = Clazz_defineMethod(c$, "parseTrimmedAt", 
function(str, ichStart){
return JU.PT.parseTrimmedRange(str, ichStart, str.length);
}, "~S,~N");
c$.parseTrimmedRange = Clazz_defineMethod(c$, "parseTrimmedRange", 
function(str, ichStart, ichMax){
var cch = str.length;
if (ichMax < cch) cch = ichMax;
if (cch < ichStart) return "";
return JU.PT.parseTrimmedChecked(str, ichStart, cch);
}, "~S,~N,~N");
c$.getTokensAt = Clazz_defineMethod(c$, "getTokensAt", 
function(line, ich){
if (line == null) return null;
var cchLine = line.length;
if (ich < 0 || ich > cchLine) return null;
var tokenCount = JU.PT.countTokens(line, ich);
var tokens =  new Array(tokenCount);
var next =  Clazz_newIntArray (1, 0);
next[0] = ich;
for (var i = 0; i < tokenCount; ++i) tokens[i] = JU.PT.parseTokenChecked(line, cchLine, next);

return tokens;
}, "~S,~N");
c$.countChar = Clazz_defineMethod(c$, "countChar", 
function(line, c){
var n = 0;
for (var i = line.lastIndexOf(c) + 1; --i >= 0; ) if (line.charAt(i) == c) n++;

return n;
}, "~S,~S");
c$.countTokens = Clazz_defineMethod(c$, "countTokens", 
function(line, ich){
var tokenCount = 0;
if (line != null) {
var ichMax = line.length;
while (true) {
while (ich < ichMax && JU.PT.isWhiteSpace(line, ich)) ++ich;

if (ich == ichMax) break;
++tokenCount;
do {
++ich;
} while (ich < ichMax && !JU.PT.isWhiteSpace(line, ich));
}
}return tokenCount;
}, "~S,~N");
c$.parseTokenNext = Clazz_defineMethod(c$, "parseTokenNext", 
function(str, next){
var cch = str.length;
return (next[0] < 0 || next[0] >= cch ? null : JU.PT.parseTokenChecked(str, cch, next));
}, "~S,~A");
c$.parseTokenRange = Clazz_defineMethod(c$, "parseTokenRange", 
function(str, ichMax, next){
var cch = str.length;
if (ichMax > cch) ichMax = cch;
return (next[0] < 0 || next[0] >= ichMax ? null : JU.PT.parseTokenChecked(str, ichMax, next));
}, "~S,~N,~A");
c$.parseTokenChecked = Clazz_defineMethod(c$, "parseTokenChecked", 
function(str, ichMax, next){
var ich = next[0];
while (ich < ichMax && JU.PT.isWhiteSpace(str, ich)) ++ich;

var ichNonWhite = ich;
while (ich < ichMax && !JU.PT.isWhiteSpace(str, ich)) ++ich;

next[0] = ich;
return (ichNonWhite == ich ? null : str.substring(ichNonWhite, ich));
}, "~S,~N,~A");
c$.parseTrimmedChecked = Clazz_defineMethod(c$, "parseTrimmedChecked", 
function(str, ich, ichMax){
while (ich < ichMax && JU.PT.isWhiteSpace(str, ich)) ++ich;

var ichLast = ichMax - 1;
while (ichLast >= ich && JU.PT.isWhiteSpace(str, ichLast)) --ichLast;

return (ichLast < ich ? "" : str.substring(ich, ichLast + 1));
}, "~S,~N,~N");
c$.dVal = Clazz_defineMethod(c$, "dVal", 
function(s){
{
if(s==null)
throw new NumberFormatException("null");
var d=parseFloat(s);
if(isNaN(d))
throw new NumberFormatException("Not a Number : "+s);
return d
}}, "~S");
c$.fVal = Clazz_defineMethod(c$, "fVal", 
function(s){
{
return this.dVal(s);
}}, "~S");
c$.parseIntRange = Clazz_defineMethod(c$, "parseIntRange", 
function(str, ichMax, next){
var cch = str.length;
if (ichMax > cch) ichMax = cch;
return (next[0] < 0 || next[0] >= ichMax ? -2147483648 : JU.PT.parseIntChecked(str, ichMax, next));
}, "~S,~N,~A");
c$.parseFloatArrayData = Clazz_defineMethod(c$, "parseFloatArrayData", 
function(tokens, data){
JU.PT.parseFloatArrayDataN(tokens, data, data.length);
}, "~A,~A");
c$.parseFloatArrayDataN = Clazz_defineMethod(c$, "parseFloatArrayDataN", 
function(tokens, data, nData){
for (var i = nData; --i >= 0; ) data[i] = (i >= tokens.length ? NaN : JU.PT.parseFloat(tokens[i]));

}, "~A,~A,~N");
c$.split = Clazz_defineMethod(c$, "split", 
function(text, run){
if (text.length == 0) return  new Array(0);
var n = 1;
var i = text.indexOf(run);
var lines;
var runLen = run.length;
if (i < 0 || runLen == 0) {
lines =  new Array(1);
lines[0] = text;
return lines;
}var len = text.length - runLen;
for (; i >= 0 && i < len; n++) i = text.indexOf(run, i + runLen);

lines =  new Array(n);
i = 0;
var ipt = 0;
var pt = 0;
for (; (ipt = text.indexOf(run, i)) >= 0 && pt + 1 < n; ) {
lines[pt++] = text.substring(i, ipt);
i = ipt + runLen;
}
if (text.indexOf(run, len) != len) len += runLen;
lines[pt] = text.substring(i, len);
return lines;
}, "~S,~S");
c$.getQuotedStringAt = Clazz_defineMethod(c$, "getQuotedStringAt", 
function(line, ipt0){
var next =  Clazz_newIntArray(-1, [ipt0]);
return JU.PT.getQuotedStringNext(line, next);
}, "~S,~N");
c$.getQuotedStringNext = Clazz_defineMethod(c$, "getQuotedStringNext", 
function(line, next){
var i = next[0];
if (i < 0 || (i = line.indexOf("\"", i)) < 0) return "";
var pt = i + 1;
var len = line.length;
while (++i < len && line.charAt(i) != '"') if (line.charAt(i) == '\\') i++;

next[0] = i + 1;
return line.substring(pt, i);
}, "~S,~A");
c$.getQuotedOrUnquotedAttribute = Clazz_defineMethod(c$, "getQuotedOrUnquotedAttribute", 
function(line, key){
if (line == null || key == null) return null;
var pt = line.toLowerCase().indexOf(key.toLowerCase() + "=");
if (pt < 0 || (pt = pt + key.length + 1) >= line.length) return "";
var c = line.charAt(pt);
switch ((c).charCodeAt(0)) {
case 39:
case 34:
pt++;
break;
default:
c = ' ';
line += " ";
}
var pt1 = line.indexOf(c, pt);
return (pt1 < 0 ? null : line.substring(pt, pt1));
}, "~S,~S");
c$.getCSVString = Clazz_defineMethod(c$, "getCSVString", 
function(line, next){
var i = next[1];
if (i < 0 || (i = line.indexOf("\"", i)) < 0) return null;
var pt = next[0] = i;
var len = line.length;
var escaped = false;
var haveEscape = false;
while (++i < len && (line.charAt(i) != '"' || (escaped = (i + 1 < len && line.charAt(i + 1) == '"')))) if (escaped) {
escaped = false;
haveEscape = true;
i++;
}
if (i >= len) {
next[1] = -1;
return null;
}next[1] = i + 1;
var s = line.substring(pt + 1, i);
return (haveEscape ? JU.PT.rep(JU.PT.rep(s, "\"\"", "\0"), "\0", "\"") : s);
}, "~S,~A");
c$.isOneOf = Clazz_defineMethod(c$, "isOneOf", 
function(key, semiList){
if (semiList.length == 0 || key.indexOf(";") >= 0) return false;
if (semiList.charAt(0) != ';') semiList = ";" + semiList + ";";
return semiList.indexOf(';' + key + ';') >= 0;
}, "~S,~S");
c$.getQuotedAttribute = Clazz_defineMethod(c$, "getQuotedAttribute", 
function(info, name){
var i = info.indexOf(name + "=");
return (i < 0 ? null : JU.PT.getQuotedStringAt(info, i));
}, "~S,~S");
c$.approx = Clazz_defineMethod(c$, "approx", 
function(f, n){
return Math.round(f * n) / n;
}, "~N,~N");
c$.rep = Clazz_defineMethod(c$, "rep", 
function(str, strFrom, strTo){
if (str == null || strFrom.length == 0 || str.indexOf(strFrom) < 0) return str;
var isOnce = (strTo.indexOf(strFrom) >= 0);
do {
str = str.$replace(strFrom, strTo);
} while (!isOnce && str.indexOf(strFrom) >= 0);
return str;
}, "~S,~S,~S");
c$.formatF = Clazz_defineMethod(c$, "formatF", 
function(value, width, precision, alignLeft, zeroPad){
return JU.PT.formatS(JU.DF.formatDecimal(value, precision), width, 0, alignLeft, zeroPad);
}, "~N,~N,~N,~B,~B");
c$.formatD = Clazz_defineMethod(c$, "formatD", 
function(value, width, precision, alignLeft, zeroPad){
return JU.PT.formatS(JU.DF.formatDecimal(value, -1 - precision), width, 0, alignLeft, zeroPad);
}, "~N,~N,~N,~B,~B");
c$.formatS = Clazz_defineMethod(c$, "formatS", 
function(value, width, precision, alignLeft, zeroPad){
if (value == null) return "";
var len = value.length;
if (precision != 2147483647 && precision > 0 && precision < len) value = value.substring(0, precision);
 else if (precision < 0 && len + precision >= 0) value = value.substring(len + precision + 1);
var padLength = width - value.length;
if (padLength <= 0) return value;
var isNeg = (zeroPad && !alignLeft && value.charAt(0) == '-');
var padChar = (zeroPad ? '0' : ' ');
var padChar0 = (isNeg ? '-' : padChar);
var sb =  new JU.SB();
if (alignLeft) sb.append(value);
sb.appendC(padChar0);
for (var i = padLength; --i > 0; ) sb.appendC(padChar);

if (!alignLeft) sb.append(isNeg ? padChar + value.substring(1) : value);
return sb.toString();
}, "~S,~N,~N,~B,~B");
c$.replaceWithCharacter = Clazz_defineMethod(c$, "replaceWithCharacter", 
function(str, strFrom, chTo){
if (str == null) return null;
for (var i = strFrom.length; --i >= 0; ) str = str.$replace(strFrom.charAt(i), chTo);

return str;
}, "~S,~S,~S");
c$.replaceAllCharacters = Clazz_defineMethod(c$, "replaceAllCharacters", 
function(str, strFrom, strTo){
for (var i = strFrom.length; --i >= 0; ) {
var chFrom = strFrom.substring(i, i + 1);
str = JU.PT.rep(str, chFrom, strTo);
}
return str;
}, "~S,~S,~S");
c$.trim = Clazz_defineMethod(c$, "trim", 
function(str, chars){
if (str == null || str.length == 0) return str;
if (chars.length == 0) return str.trim();
var len = str.length;
var k = 0;
while (k < len && chars.indexOf(str.charAt(k)) >= 0) k++;

var m = str.length - 1;
while (m > k && chars.indexOf(str.charAt(m)) >= 0) m--;

return str.substring(k, m + 1);
}, "~S,~S");
c$.trimQuotes = Clazz_defineMethod(c$, "trimQuotes", 
function(value){
return (value != null && value.length > 1 && value.startsWith("\"") && value.endsWith("\"") ? value.substring(1, value.length - 1) : value);
}, "~S");
c$.isNonStringPrimitive = Clazz_defineMethod(c$, "isNonStringPrimitive", 
function(info){
{
if(typeof info == "number" || typeof info == "boolean") {
return true;
}
}return Clazz_instanceOf(info, Number) || Clazz_instanceOf(info, Boolean);
}, "~O");
c$.toJSON = Clazz_defineMethod(c$, "toJSON", 
function(infoType, info){
if (info == null) return JU.PT.packageJSON(infoType, null);
if (JU.PT.isNonStringPrimitive(info)) return JU.PT.packageJSON(infoType, info.toString());
var s = null;
var sb = null;
while (true) {
if ((typeof(info)=='string')) {
s = info;
{
if (typeof s == "undefined") s = "null"
}if (s.indexOf("{\"") != 0) {
s = JU.PT.esc(s);
}break;
}if (Clazz_instanceOf(info,"javajs.api.JSONEncodable")) {
if ((s = (info).toJSON()) == null) s = "null";
break;
}sb =  new JU.SB();
if (Clazz_instanceOf(info,"java.util.Map")) {
sb.append("{ ");
var sep = "";
var keys = (info).keySet();
var skeys = keys.toArray( new Array(keys.size()));
java.util.Arrays.sort(skeys);
for (var i = 0, n = skeys.length; i < n; i++) {
var key = skeys[i];
if (key == null) key = "null";
sb.append(sep).append(JU.PT.packageJSON(key, JU.PT.toJSON(null, (info).get(key))));
sep = ",";
}
sb.append(" }");
break;
}if (Clazz_instanceOf(info,"JU.Lst")) {
sb.append("[ ");
var n = (info).size();
for (var i = 0; i < n; i++) {
if (i > 0) sb.appendC(',');
sb.append(JU.PT.toJSON(null, (info).get(i)));
}
sb.append(" ]");
break;
}if (Clazz_instanceOf(info,"JU.M34")) {
var len = (Clazz_instanceOf(info,"JU.M4") ? 4 : 3);
var x =  Clazz_newFloatArray (len, 0);
var m = info;
sb.appendC('[');
for (var i = 0; i < len; i++) {
if (i > 0) sb.appendC(',');
m.getRow(i, x);
sb.append(JU.PT.toJSON(null, x));
}
sb.appendC(']');
break;
}s = JU.PT.nonArrayString(info);
if (s == null) {
sb.append("[");
var n = JU.AU.getLength(info);
var o = null;
{
o = info[0];
typeof o != "number" && typeof 0 != "boolean" && (o = null);
}if (o != null) {
sb.appendO(info);
} else {
for (var i = 0; i < n; i++) {
if (i > 0) sb.appendC(',');
sb.append(JU.PT.toJSON(null, JU.PT.arrayGet(info, i)));
}
}sb.append("]");
break;
}info = info.toString();
}
return JU.PT.packageJSON(infoType, (s == null ? sb.toString() : s));
}, "~S,~O");
c$.arrayGet = Clazz_defineMethod(c$, "arrayGet", 
function(info, i){
{
return info[i];
}}, "~O,~N");
c$.nonArrayString = Clazz_defineMethod(c$, "nonArrayString", 
function(x){
{
return (x.constructor == Array || x.BYTES_PER_ELEMENT ? null : x.toString());
}}, "~O");
c$.byteArrayToJSON = Clazz_defineMethod(c$, "byteArrayToJSON", 
function(data){
var sb =  new JU.SB();
sb.append("[");
var n = data.length;
for (var i = 0; i < n; i++) {
if (i > 0) sb.appendC(',');
sb.appendI(data[i] & 0xFF);
}
sb.append("]");
return sb.toString();
}, "~A");
c$.packageJSON = Clazz_defineMethod(c$, "packageJSON", 
function(infoType, info){
return (infoType == null ? info : "\"" + infoType + "\": " + info);
}, "~S,~S");
c$.escapeUrl = Clazz_defineMethod(c$, "escapeUrl", 
function(url){
url = JU.PT.rep(url, "\n", "");
url = JU.PT.rep(url, "%", "%25");
url = JU.PT.rep(url, "#", "%23");
url = JU.PT.rep(url, "[", "%5B");
url = JU.PT.rep(url, "\\", "%5C");
url = JU.PT.rep(url, "]", "%5D");
url = JU.PT.rep(url, " ", "%20");
return url;
}, "~S");
c$.esc = Clazz_defineMethod(c$, "esc", 
function(str){
if (str == null || str.length == 0) return "\"\"";
var haveEscape = false;
var i = 0;
for (; i < "\\\\\tt\rr\nn\"\"".length; i += 2) if (str.indexOf("\\\\\tt\rr\nn\"\"".charAt(i)) >= 0) {
haveEscape = true;
break;
}
if (haveEscape) while (i < "\\\\\tt\rr\nn\"\"".length) {
var pt = -1;
var ch = "\\\\\tt\rr\nn\"\"".charAt(i++);
var ch2 = "\\\\\tt\rr\nn\"\"".charAt(i++);
var sb =  new JU.SB();
var pt0 = 0;
while ((pt = str.indexOf(ch, pt + 1)) >= 0) {
sb.append(str.substring(pt0, pt)).appendC('\\').appendC(ch2);
pt0 = pt + 1;
}
sb.append(str.substring(pt0, str.length));
str = sb.toString();
}
return "\"" + JU.PT.escUnicode(str) + "\"";
}, "~S");
c$.escUnicode = Clazz_defineMethod(c$, "escUnicode", 
function(str){
for (var i = str.length; --i >= 0; ) if ((str.charAt(i)).charCodeAt(0) > 0x7F) {
var s = "0000" + Integer.toHexString(str.charAt(i).charCodeAt(0));
str = str.substring(0, i) + "\\u" + s.substring(s.length - 4) + str.substring(i + 1);
}
return str;
}, "~S");
c$.escF = Clazz_defineMethod(c$, "escF", 
function(f){
var sf = "" + f;
{
if (sf.indexOf(".") < 0 && sf.indexOf("e") < 0 && sf.indexOf("N") < 0 && sf.indexOf("n") < 0)
sf += ".0";
}return sf;
}, "~N");
c$.join = Clazz_defineMethod(c$, "join", 
function(s, c, i0){
if (s.length < i0) return null;
var sb =  new JU.SB();
sb.append(s[i0++]);
for (var i = i0; i < s.length; i++) sb.appendC(c).append(s[i]);

return sb.toString();
}, "~A,~S,~N");
c$.isLike = Clazz_defineMethod(c$, "isLike", 
function(a, b){
var areEqual = a.equals(b);
if (areEqual) return true;
var isStart = b.startsWith("*");
var isEnd = b.endsWith("*");
return (!isStart && !isEnd) ? areEqual : isStart && isEnd ? b.length == 1 || a.contains(b.substring(1, b.length - 1)) : isStart ? a.endsWith(b.substring(1)) : a.startsWith(b.substring(0, b.length - 1));
}, "~S,~S");
c$.getMapValueNoCase = Clazz_defineMethod(c$, "getMapValueNoCase", 
function(h, key){
if ("this".equals(key)) return h;
var val = h.get(key);
if (val == null) for (var e, $e = h.entrySet().iterator (); $e.hasNext()&& ((e = $e.next ()) || true);) if (e.getKey().equalsIgnoreCase(key)) return e.getValue();

return val;
}, "java.util.Map,~S");
c$.clean = Clazz_defineMethod(c$, "clean", 
function(s){
return JU.PT.rep(JU.PT.replaceAllCharacters(s, " \t\n\r", " "), "  ", " ").trim();
}, "~S");
c$.fdup = Clazz_defineMethod(c$, "fdup", 
function(f, pt, n){
var ch;
var count = 0;
for (var i = pt; --i >= 1; ) {
if (JU.PT.isDigit(ch = f.charAt(i))) continue;
switch ((ch).charCodeAt(0)) {
case 46:
if (count++ != 0) return f;
continue;
case 45:
if (i != 1 && f.charAt(i - 1) != '.') return f;
continue;
default:
return f;
}
}
var s = f.substring(0, pt + 1);
var sb =  new JU.SB();
for (var i = 0; i < n; i++) sb.append(s);

sb.append(f.substring(pt + 1));
return sb.toString();
}, "~S,~N,~N");
c$.formatString = Clazz_defineMethod(c$, "formatString", 
function(strFormat, key, strT, floatT, doubleT, doOne){
if (strFormat == null) return null;
if ("".equals(strFormat)) return "";
var len = key.length;
if (strFormat.indexOf("%") < 0 || len == 0 || strFormat.indexOf(key) < 0) return strFormat;
var strLabel = "";
var ich;
var ichPercent;
var ichKey;
for (ich = 0; (ichPercent = strFormat.indexOf('%', ich)) >= 0 && (ichKey = strFormat.indexOf(key, ichPercent + 1)) >= 0; ) {
if (ich != ichPercent) strLabel += strFormat.substring(ich, ichPercent);
ich = ichPercent + 1;
if (ichKey > ichPercent + 6) {
strLabel += '%';
continue;
}try {
var alignLeft = false;
if (strFormat.charAt(ich) == '-') {
alignLeft = true;
++ich;
}var zeroPad = false;
if (strFormat.charAt(ich) == '0') {
zeroPad = true;
++ich;
}var ch;
var width = 0;
while ((ch = strFormat.charAt(ich)) >= '0' && (ch <= '9')) {
width = (10 * width) + (ch.charCodeAt(0) - 48);
++ich;
}
var precision = 2147483647;
var isExponential = false;
if (strFormat.charAt(ich) == '.') {
++ich;
if ((ch = strFormat.charAt(ich)) == '-') {
isExponential = true;
++ich;
}if ((ch = strFormat.charAt(ich)) >= '0' && ch <= '9') {
precision = ch.charCodeAt(0) - 48;
++ich;
if ((ch = strFormat.charAt(ich)) >= '0' && ch <= '9') {
precision = 10 * precision + (ch.charCodeAt(0) - 48);
++ich;
}}if (isExponential) precision = -precision;
}var st = strFormat.substring(ich, ich + len);
if (!st.equals(key)) {
ich = ichPercent + 1;
strLabel += '%';
continue;
}ich += len;
if (!Float.isNaN(floatT)) strLabel += JU.PT.formatF(floatT, width, precision, alignLeft, zeroPad);
 else if (strT != null) strLabel += JU.PT.formatS(strT, width, precision < 0 ? precision - 1 : precision, alignLeft, zeroPad);
 else if (!Double.isNaN(doubleT)) strLabel += JU.PT.formatD(doubleT, width, precision - 1, alignLeft, zeroPad);
if (doOne) break;
} catch (ioobe) {
if (Clazz_exceptionOf(ioobe,"IndexOutOfBoundsException")){
ich = ichPercent;
break;
} else {
throw ioobe;
}
}
}
strLabel += strFormat.substring(ich);
return strLabel;
}, "~S,~S,~S,~N,~N,~B");
c$.formatStringS = Clazz_defineMethod(c$, "formatStringS", 
function(strFormat, key, strT){
return JU.PT.formatString(strFormat, key, strT, NaN, NaN, false);
}, "~S,~S,~S");
c$.formatStringF = Clazz_defineMethod(c$, "formatStringF", 
function(strFormat, key, floatT){
return JU.PT.formatString(strFormat, key, null, floatT, NaN, false);
}, "~S,~S,~N");
c$.formatStringI = Clazz_defineMethod(c$, "formatStringI", 
function(strFormat, key, intT){
return JU.PT.formatString(strFormat, key, "" + intT, NaN, NaN, false);
}, "~S,~S,~N");
c$.sprintf = Clazz_defineMethod(c$, "sprintf", 
function(strFormat, list, values){
if (values == null) return strFormat;
var n = list.length;
if (n == values.length) try {
for (var o = 0; o < n; o++) {
if (values[o] == null) continue;
switch ((list.charAt(o)).charCodeAt(0)) {
case 115:
strFormat = JU.PT.formatString(strFormat, "s", values[o], NaN, NaN, true);
break;
case 102:
strFormat = JU.PT.formatString(strFormat, "f", null, (values[o]).floatValue(), NaN, true);
break;
case 105:
strFormat = JU.PT.formatString(strFormat, "d", "" + values[o], NaN, NaN, true);
strFormat = JU.PT.formatString(strFormat, "i", "" + values[o], NaN, NaN, true);
break;
case 100:
strFormat = JU.PT.formatString(strFormat, "e", null, NaN, (values[o]).doubleValue(), true);
break;
case 112:
var pVal = values[o];
strFormat = JU.PT.formatString(strFormat, "p", null, pVal.x, NaN, true);
strFormat = JU.PT.formatString(strFormat, "p", null, pVal.y, NaN, true);
strFormat = JU.PT.formatString(strFormat, "p", null, pVal.z, NaN, true);
break;
case 113:
var qVal = values[o];
strFormat = JU.PT.formatString(strFormat, "q", null, qVal.x, NaN, true);
strFormat = JU.PT.formatString(strFormat, "q", null, qVal.y, NaN, true);
strFormat = JU.PT.formatString(strFormat, "q", null, qVal.z, NaN, true);
strFormat = JU.PT.formatString(strFormat, "q", null, qVal.w, NaN, true);
break;
case 83:
var sVal = values[o];
for (var i = 0; i < sVal.length; i++) strFormat = JU.PT.formatString(strFormat, "s", sVal[i], NaN, NaN, true);

break;
case 70:
var fVal = values[o];
for (var i = 0; i < fVal.length; i++) strFormat = JU.PT.formatString(strFormat, "f", null, fVal[i], NaN, true);

break;
case 73:
var iVal = values[o];
for (var i = 0; i < iVal.length; i++) strFormat = JU.PT.formatString(strFormat, "d", "" + iVal[i], NaN, NaN, true);

for (var i = 0; i < iVal.length; i++) strFormat = JU.PT.formatString(strFormat, "i", "" + iVal[i], NaN, NaN, true);

break;
case 68:
var dVal = values[o];
for (var i = 0; i < dVal.length; i++) strFormat = JU.PT.formatString(strFormat, "e", null, NaN, dVal[i], true);

}
}
return JU.PT.rep(strFormat, "%%", "%");
} catch (e) {
if (Clazz_exceptionOf(e, Exception)){
} else {
throw e;
}
}
System.out.println("TextFormat.sprintf error " + list + " " + strFormat);
return JU.PT.rep(strFormat, "%", "?");
}, "~S,~S,~A");
c$.formatCheck = Clazz_defineMethod(c$, "formatCheck", 
function(strFormat){
if (strFormat == null || strFormat.indexOf('p') < 0 && strFormat.indexOf('q') < 0) return strFormat;
strFormat = JU.PT.rep(strFormat, "%%", "\1");
strFormat = JU.PT.rep(strFormat, "%p", "%6.2p");
strFormat = JU.PT.rep(strFormat, "%q", "%6.2q");
var format = JU.PT.split(strFormat, "%");
var sb =  new JU.SB();
sb.append(format[0]);
for (var i = 1; i < format.length; i++) {
var f = "%" + format[i];
var pt;
if (f.length >= 3) {
if ((pt = f.indexOf('p')) >= 0) f = JU.PT.fdup(f, pt, 3);
if ((pt = f.indexOf('q')) >= 0) f = JU.PT.fdup(f, pt, 4);
}sb.append(f);
}
return sb.toString().$replace('\1', '%');
}, "~S");
c$.leftJustify = Clazz_defineMethod(c$, "leftJustify", 
function(s, s1, s2){
s.append(s2);
var n = s1.length - s2.length;
if (n > 0) s.append(s1.substring(0, n));
}, "JU.SB,~S,~S");
c$.rightJustify = Clazz_defineMethod(c$, "rightJustify", 
function(s, s1, s2){
var n = s1.length - s2.length;
if (n > 0) s.append(s1.substring(0, n));
s.append(s2);
}, "JU.SB,~S,~S");
c$.safeTruncate = Clazz_defineMethod(c$, "safeTruncate", 
function(f, n){
if (f > -0.001 && f < 0.001) f = 0;
return (f + "         ").substring(0, n);
}, "~N,~N");
c$.isWild = Clazz_defineMethod(c$, "isWild", 
function(s){
return s != null && (s.indexOf("*") >= 0 || s.indexOf("?") >= 0);
}, "~S");
c$.isMatch = Clazz_defineMethod(c$, "isMatch", 
function(search, match, checkStar, allowInitialStar){
if (search.equals(match)) return true;
var mLen = match.length;
if (mLen == 0) return false;
var isStar0 = (checkStar && allowInitialStar ? match.charAt(0) == '*' : false);
if (mLen == 1 && isStar0) return true;
var isStar1 = (checkStar && match.endsWith("*"));
var haveQ = (match.indexOf('?') >= 0);
if (!haveQ) {
if (isStar0) return (isStar1 ? (mLen < 3 || search.indexOf(match.substring(1, mLen - 1)) >= 0) : search.endsWith(match.substring(1)));
 else if (isStar1) return search.startsWith(match.substring(0, mLen - 1));
}var sLen = search.length;
var qqqq = "????";
var nq = 4;
while (nq < sLen) {
qqqq += qqqq;
nq *= 2;
}
if (checkStar) {
if (isStar0) {
match = qqqq + match.substring(1);
mLen += nq - 1;
}if (isStar1) {
match = match.substring(0, mLen - 1) + qqqq;
mLen += nq - 1;
}}if (mLen < sLen) return false;
var ich = 0;
while (mLen > sLen) {
if (allowInitialStar && match.charAt(ich) == '?') {
++ich;
} else if (match.charAt(ich + mLen - 1) != '?') {
return false;
}--mLen;
}
for (var i = sLen; --i >= 0; ) {
var chm = match.charAt(ich + i);
if (chm == '?') continue;
var chs = search.charAt(i);
if (chm != chs && (chm != '\1' || chs != '?')) return false;
}
return true;
}, "~S,~S,~B,~B");
c$.replaceQuotedStrings = Clazz_defineMethod(c$, "replaceQuotedStrings", 
function(s, list, newList){
var n = list.size();
for (var i = 0; i < n; i++) {
var name = list.get(i);
var newName = newList.get(i);
if (!newName.equals(name)) s = JU.PT.rep(s, "\"" + name + "\"", "\"" + newName + "\"");
}
return s;
}, "~S,JU.Lst,JU.Lst");
c$.replaceStrings = Clazz_defineMethod(c$, "replaceStrings", 
function(s, list, newList){
var n = list.size();
for (var i = 0; i < n; i++) {
var name = list.get(i);
var newName = newList.get(i);
if (!newName.equals(name)) s = JU.PT.rep(s, name, newName);
}
return s;
}, "~S,JU.Lst,JU.Lst");
c$.isDigit = Clazz_defineMethod(c$, "isDigit", 
function(ch){
var c = (ch).charCodeAt(0);
return (48 <= c && c <= 57);
}, "~S");
c$.isUpperCase = Clazz_defineMethod(c$, "isUpperCase", 
function(ch){
var c = (ch).charCodeAt(0);
return (65 <= c && c <= 90);
}, "~S");
c$.isLowerCase = Clazz_defineMethod(c$, "isLowerCase", 
function(ch){
var c = (ch).charCodeAt(0);
return (97 <= c && c <= 122);
}, "~S");
c$.isLetter = Clazz_defineMethod(c$, "isLetter", 
function(ch){
var c = (ch).charCodeAt(0);
return (65 <= c && c <= 90 || 97 <= c && c <= 122);
}, "~S");
c$.isLetterOrDigit = Clazz_defineMethod(c$, "isLetterOrDigit", 
function(ch){
var c = (ch).charCodeAt(0);
return (65 <= c && c <= 90 || 97 <= c && c <= 122 || 48 <= c && c <= 57);
}, "~S");
c$.isWhitespace = Clazz_defineMethod(c$, "isWhitespace", 
function(ch){
var c = (ch).charCodeAt(0);
return (c >= 0x1c && c <= 0x20 || c >= 0x9 && c <= 0xd);
}, "~S");
c$.fixPtFloats = Clazz_defineMethod(c$, "fixPtFloats", 
function(pt, f){
pt.x = Math.round(pt.x * f) / f;
pt.y = Math.round(pt.y * f) / f;
pt.z = Math.round(pt.z * f) / f;
}, "JU.T3,~N");
c$.fixFloat = Clazz_defineMethod(c$, "fixFloat", 
function(d, f){
return (Math.round(d * f) / f);
}, "~N,~N");
c$.fixDouble = Clazz_defineMethod(c$, "fixDouble", 
function(d, f){
return Math.round((d * f)) / f;
}, "~N,~N");
c$.parseFloatFraction = Clazz_defineMethod(c$, "parseFloatFraction", 
function(s){
var pt = s.indexOf("/");
return (pt < 0 ? JU.PT.parseFloat(s) : JU.PT.parseFloat(s.substring(0, pt)) / JU.PT.parseFloat(s.substring(pt + 1)));
}, "~S");
c$.tensScale =  Clazz_newFloatArray(-1, [10, 100, 1000, 10000, 100000, 1000000]);
c$.decimalScale =  Clazz_newFloatArray(-1, [0.1, 0.01, 0.001, 0.0001, 0.00001, 0.000001, 0.0000001, 0.00000001, 0.000000001, 0.0000000001, 0.00000000001, 0.000000000001, 0.0000000000001, 0.00000000000001, 0.000000000000001]);
});
;//5.0.1-v7 Mon Aug 17 10:07:10 MDT 2026
Clazz_declarePackage("JU");
(function(){
var c$ = Clazz_decorateAsClass(function(){
this.sb = null;
this.s = null;
Clazz_instantialize(this, arguments);}, JU, "SB", null);
Clazz_makeConstructor(c$, 
function(){
{
this.s = "";
}});
c$.newN = Clazz_defineMethod(c$, "newN", 
function(n){
{
return new JU.SB();
}}, "~N");
c$.newS = Clazz_defineMethod(c$, "newS", 
function(s){
{
var sb = new JU.SB();
sb.s = s;
return sb;
}}, "~S");
Clazz_defineMethod(c$, "append", 
function(s){
{
this.s += s
}return this;
}, "~S");
Clazz_defineMethod(c$, "appendC", 
function(c){
{
this.s += c;
}return this;
}, "~S");
Clazz_defineMethod(c$, "appendI", 
function(i){
{
this.s += i
}return this;
}, "~N");
Clazz_defineMethod(c$, "appendB", 
function(b){
{
this.s += b
}return this;
}, "~B");
Clazz_defineMethod(c$, "appendF", 
function(f){
{
var sf = "" + f;
if (sf.indexOf(".") < 0 && sf.indexOf("e") < 0)
sf += ".0" ;
this.s += sf;
}return this;
}, "~N");
Clazz_defineMethod(c$, "appendD", 
function(d){
{
var sf = "" + d;
if (sf.indexOf(".") < 0 && sf.indexOf("e") < 0)
sf += ".0" ;
this.s += sf;
}return this;
}, "~N");
Clazz_defineMethod(c$, "appendSB", 
function(buf){
{
this.s += buf.s;
}return this;
}, "JU.SB");
Clazz_defineMethod(c$, "appendO", 
function(data){
if (data != null) {
{
this.s += data.toString();
}}return this;
}, "~O");
Clazz_defineMethod(c$, "appendCB", 
function(cb, off, len){
{
this.s += cb.slice(off,off+len).join("");
}}, "~A,~N,~N");
Clazz_overrideMethod(c$, "toString", 
function(){
{
return this.s;
}});
Clazz_defineMethod(c$, "length", 
function(){
{
return this.s.length;
}});
Clazz_defineMethod(c$, "indexOf", 
function(s){
{
return this.s.indexOf(s);
}}, "~S");
Clazz_defineMethod(c$, "charAt", 
function(i){
{
return this.s.charAt(i);
}}, "~N");
Clazz_defineMethod(c$, "charCodeAt", 
function(i){
{
return this.s.charCodeAt(i);
}}, "~N");
Clazz_defineMethod(c$, "setLength", 
function(n){
{
this.s = this.s.substring(0, n);
}}, "~N");
Clazz_defineMethod(c$, "lastIndexOf", 
function(s){
{
return this.s.lastIndexOf(s);
}}, "~S");
Clazz_defineMethod(c$, "indexOf2", 
function(s, i){
{
return this.s.indexOf(s, i);
}}, "~S,~N");
Clazz_defineMethod(c$, "substring", 
function(i){
{
return this.s.substring(i);
}}, "~N");
Clazz_defineMethod(c$, "substring2", 
function(i, j){
{
return this.s.substring(i, j);
}}, "~N,~N");
Clazz_defineMethod(c$, "toBytes", 
function(off, len){
if (len == 0) return  Clazz_newByteArray (0, 0);
var cs;
{
cs = "UTF-8";
}return (len > 0 ? this.substring2(off, off + len) : off == 0 ? this.toString() : this.substring2(off, this.length() - off)).getBytes(cs);
}, "~N,~N");
Clazz_defineMethod(c$, "replace", 
function(start, end, str){
{
this.s = this.s.substring(0, start) + str + this.s.substring(end);
}}, "~N,~N,~S");
Clazz_defineMethod(c$, "insert", 
function(offset, str){
this.replace(offset, offset, str);
}, "~N,~S");
})();
;//5.0.1-v7 Mon Aug 17 10:07:10 MDT 2026
Clazz_declarePackage("JU");
Clazz_load(["javajs.api.JSONEncodable"], "JU.T3", null, function(){
var c$ = Clazz_decorateAsClass(function(){
this.x = 0;
this.y = 0;
this.z = 0;
Clazz_instantialize(this, arguments);}, JU, "T3", null, [javajs.api.JSONEncodable, java.io.Serializable]);
Clazz_defineMethod(c$, "set", 
function(x, y, z){
this.x = x;
this.y = y;
this.z = z;
}, "~N,~N,~N");
Clazz_defineMethod(c$, "setA", 
function(t){
this.x = t[0];
this.y = t[1];
this.z = t[2];
}, "~A");
Clazz_defineMethod(c$, "setT", 
function(t1){
this.x = t1.x;
this.y = t1.y;
this.z = t1.z;
}, "JU.T3");
Clazz_defineMethod(c$, "add2", 
function(t1, t2){
this.x = t1.x + t2.x;
this.y = t1.y + t2.y;
this.z = t1.z + t2.z;
}, "JU.T3,JU.T3");
Clazz_defineMethod(c$, "add", 
function(t1){
this.x += t1.x;
this.y += t1.y;
this.z += t1.z;
}, "JU.T3");
Clazz_defineMethod(c$, "distanceSquared", 
function(p1){
var dx = this.x - p1.x;
var dy = this.y - p1.y;
var dz = this.z - p1.z;
return (dx * dx + dy * dy + dz * dz);
}, "JU.T3");
Clazz_defineMethod(c$, "distance", 
function(p1){
return Math.sqrt(this.distanceSquared(p1));
}, "JU.T3");
Clazz_defineMethod(c$, "sub2", 
function(t1, t2){
this.x = t1.x - t2.x;
this.y = t1.y - t2.y;
this.z = t1.z - t2.z;
}, "JU.T3,JU.T3");
Clazz_defineMethod(c$, "sub", 
function(t1){
this.x -= t1.x;
this.y -= t1.y;
this.z -= t1.z;
}, "JU.T3");
Clazz_defineMethod(c$, "scale", 
function(s){
this.x *= s;
this.y *= s;
this.z *= s;
}, "~N");
Clazz_defineMethod(c$, "add3", 
function(a, b, c){
this.x += a;
this.y += b;
this.z += c;
}, "~N,~N,~N");
Clazz_defineMethod(c$, "scaleT", 
function(p){
this.x *= p.x;
this.y *= p.y;
this.z *= p.z;
}, "JU.T3");
Clazz_defineMethod(c$, "scaleAdd2", 
function(s, t1, t2){
this.x = s * t1.x + t2.x;
this.y = s * t1.y + t2.y;
this.z = s * t1.z + t2.z;
}, "~N,JU.T3,JU.T3");
Clazz_defineMethod(c$, "ave", 
function(a, b){
this.x = (a.x + b.x) / 2;
this.y = (a.y + b.y) / 2;
this.z = (a.z + b.z) / 2;
}, "JU.T3,JU.T3");
Clazz_defineMethod(c$, "dot", 
function(v){
return this.x * v.x + this.y * v.y + this.z * v.z;
}, "JU.T3");
Clazz_defineMethod(c$, "lengthSquared", 
function(){
return this.x * this.x + this.y * this.y + this.z * this.z;
});
Clazz_defineMethod(c$, "length", 
function(){
return Math.sqrt(this.lengthSquared());
});
Clazz_defineMethod(c$, "normalize", 
function(){
var d = this.length();
this.x /= d;
this.y /= d;
this.z /= d;
});
Clazz_defineMethod(c$, "cross", 
function(v1, v2){
this.set(v1.y * v2.z - v1.z * v2.y, v1.z * v2.x - v1.x * v2.z, v1.x * v2.y - v1.y * v2.x);
}, "JU.T3,JU.T3");
Clazz_overrideMethod(c$, "hashCode", 
function(){
var bits = 1;
bits = 31 * bits + JU.T3.floatToIntBits(this.x);
bits = 31 * bits + JU.T3.floatToIntBits(this.y);
bits = 31 * bits + JU.T3.floatToIntBits(this.z);
return (bits ^ (bits >> 32));
});
c$.floatToIntBits = Clazz_defineMethod(c$, "floatToIntBits", 
function(x){
return (x == 0 ? 0 : Float.floatToIntBits(x));
}, "~N");
Clazz_overrideMethod(c$, "equals", 
function(t1){
if (!(Clazz_instanceOf(t1,"JU.T3"))) return false;
var t2 = t1;
return (this.x == t2.x && this.y == t2.y && this.z == t2.z);
}, "~O");
Clazz_overrideMethod(c$, "toString", 
function(){
return "{" + this.x + ", " + this.y + ", " + this.z + "}";
});
Clazz_overrideMethod(c$, "toJSON", 
function(){
return "[" + this.x + "," + this.y + "," + this.z + "]";
});
Clazz_defineMethod(c$, "setP", 
function(t){
this.set(t.x, t.y, t.z);
return this;
}, "JU.T3");
Clazz_defineMethod(c$, "putP", 
function(t){
t.set(this.x, this.y, this.z);
return t;
}, "JU.T3");
});
;//5.0.1-v7 Mon Aug 17 10:07:10 MDT 2026
Clazz_declarePackage("JU");
(function(){
var c$ = Clazz_decorateAsClass(function(){
this.x = 0;
this.y = 0;
this.z = 0;
Clazz_instantialize(this, arguments);}, JU, "T3i", null, java.io.Serializable);
/*LV!1824 unnec constructor*/Clazz_defineMethod(c$, "set", 
function(x, y, z){
this.x = x;
this.y = y;
this.z = z;
}, "~N,~N,~N");
Clazz_defineMethod(c$, "setT", 
function(t1){
this.x = t1.x;
this.y = t1.y;
this.z = t1.z;
}, "JU.T3i");
Clazz_defineMethod(c$, "add", 
function(t){
this.x += t.x;
this.y += t.y;
this.z += t.z;
}, "JU.T3i");
Clazz_defineMethod(c$, "scaleAdd", 
function(s, t1, t2){
this.x = s * t1.x + t2.x;
this.y = s * t1.y + t2.y;
this.z = s * t1.z + t2.z;
}, "~N,JU.T3i,JU.T3i");
Clazz_overrideMethod(c$, "hashCode", 
function(){
return this.x ^ this.y ^ this.z;
});
Clazz_overrideMethod(c$, "equals", 
function(o){
if (!(Clazz_instanceOf(o,"JU.T3i"))) return false;
var t = o;
return (this.x == t.x && this.y == t.y && this.z == t.z);
}, "~O");
Clazz_defineMethod(c$, "asString", 
function(){
return "(" + this.x + ", " + this.y + ", " + this.z + ")";
});
Clazz_overrideMethod(c$, "toString", 
function(){
return this.asString();
});
})();
;//5.0.1-v7 Mon Aug 17 10:07:10 MDT 2026
Clazz_declarePackage("JU");
Clazz_load(["JU.T3"], "JU.T4", null, function(){
var c$ = Clazz_decorateAsClass(function(){
this.w = 0;
Clazz_instantialize(this, arguments);}, JU, "T4", JU.T3);
Clazz_defineMethod(c$, "set4", 
function(x, y, z, w){
this.x = x;
this.y = y;
this.z = z;
this.w = w;
}, "~N,~N,~N,~N");
Clazz_defineMethod(c$, "scale4", 
function(s){
this.scale(s);
this.w *= s;
}, "~N");
Clazz_overrideMethod(c$, "hashCode", 
function(){
return JU.T3.floatToIntBits(this.x) ^ JU.T3.floatToIntBits(this.y) ^ JU.T3.floatToIntBits(this.z) ^ JU.T3.floatToIntBits(this.w);
});
Clazz_overrideMethod(c$, "equals", 
function(o){
if (!(Clazz_instanceOf(o,"JU.T4"))) return false;
var t = o;
return (this.x == t.x && this.y == t.y && this.z == t.z && this.w == t.w);
}, "~O");
Clazz_overrideMethod(c$, "toString", 
function(){
return "{" + this.x + ", " + this.y + ", " + this.z + ", " + this.w + "}";
});
Clazz_overrideMethod(c$, "toJSON", 
function(){
return "[" + this.x + ", " + this.y + ", " + this.z + ", " + this.w + "]";
});
});
;//5.0.1-v7 Mon Aug 17 10:07:10 MDT 2026
Clazz_declarePackage("JU");
Clazz_load(["JU.T3"], "JU.V3", null, function(){
var c$ = Clazz_declareType(JU, "V3", JU.T3);
/*LV!1824 unnec constructor*/c$.newV = Clazz_defineMethod(c$, "newV", 
function(t){
return JU.V3.new3(t.x, t.y, t.z);
}, "JU.T3");
c$.newVsub = Clazz_defineMethod(c$, "newVsub", 
function(t1, t2){
return JU.V3.new3(t1.x - t2.x, t1.y - t2.y, t1.z - t2.z);
}, "JU.T3,JU.T3");
c$.new3 = Clazz_defineMethod(c$, "new3", 
function(x, y, z){
var v =  new JU.V3();
v.x = x;
v.y = y;
v.z = z;
return v;
}, "~N,~N,~N");
Clazz_defineMethod(c$, "angle", 
function(v1){
var xx = this.y * v1.z - this.z * v1.y;
var yy = this.z * v1.x - this.x * v1.z;
var zz = this.x * v1.y - this.y * v1.x;
var cross = Math.sqrt(xx * xx + yy * yy + zz * zz);
return Math.abs(Math.atan2(cross, this.dot(v1)));
}, "JU.V3");
});
;//5.0.1-v7 Mon Aug 17 10:07:10 MDT 2026
Clazz_declarePackage("javajs.api");
Clazz_declareInterface(javajs.api, "GenericBinaryDocument", javajs.api.GenericBinaryDocumentReader);
;//5.0.1-v7 Mon Aug 17 10:07:10 MDT 2026
Clazz_declarePackage("javajs.api");
Clazz_declareInterface(javajs.api, "GenericBinaryDocumentReader");
;//5.0.1-v7 Mon Aug 17 10:07:10 MDT 2026
Clazz_declarePackage("javajs.api");
Clazz_declareInterface(javajs.api, "GenericZipTools");
;//5.0.1-v7 Mon Aug 17 10:07:10 MDT 2026
Clazz_declarePackage("javajs.api");
Clazz_declareInterface(javajs.api, "GenericLineReader");
;//5.0.1-v7 Mon Aug 17 10:07:10 MDT 2026
Clazz_declarePackage("javajs.api");
(function(){
var c$ = Clazz_declareInterface(javajs.api, "GenericCifDataParser");
})();
;//5.0.1-v7 Mon Aug 17 10:07:10 MDT 2026
Clazz_declarePackage("javajs.api");
(function(){
var c$ = Clazz_declareType(javajs.api, "Interface", null);
c$.getInterface = Clazz_defineMethod(c$, "getInterface", 
function(name){
try {
var x = Clazz._4Name(name);
return (x == null ? null : x.newInstance());
} catch (e) {
if (Clazz_exceptionOf(e, Exception)){
System.out.println("Interface.java Error creating instance for " + name + ": \n" + e);
return null;
} else {
throw e;
}
}
}, "~S");
c$.getInstanceWithParams = Clazz_defineMethod(c$, "getInstanceWithParams", 
function(name, classes, params){
try {
var cl = Clazz._4Name(name);
return cl.getConstructor(classes).newInstance(params);
} catch (e) {
if (Clazz_exceptionOf(e, Exception)){
System.out.println("Interface.getInterfaceWithParams Error creating instance for " + name + ": \n" + e);
return null;
} else {
throw e;
}
}
}, "~S,~A,~A");
})();
;//5.0.1-v7 Mon Aug 17 10:07:10 MDT 2026
Clazz_declarePackage("JU");
(function(){
var c$ = Clazz_decorateAsClass(function(){
this.data = null;
Clazz_instantialize(this, arguments);}, JU, "BArray", null);
Clazz_makeConstructor(c$, 
function(data){
this.data = data;
}, "~A");
Clazz_overrideMethod(c$, "equals", 
function(o){
if (Clazz_instanceOf(o,"JU.BArray")) {
var d = (o).data;
if (d.length == this.data.length) {
for (var i = 0; i < d.length; i++) if (d[i] != this.data[i]) return false;

return true;
}}return false;
}, "~O");
Clazz_defineMethod(c$, "hashCode", 
function(){
return this.data.hashCode();
});
Clazz_overrideMethod(c$, "toString", 
function(){
return  String.instantialize(this.data);
});
})();
;//5.0.1-v7 Mon Aug 17 10:07:10 MDT 2026
Clazz_declarePackage("JU");
(function(){
var c$ = Clazz_decorateAsClass(function(){
this.buf = null;
this.cchBuf = 0;
this.ichCurrent = 0;
Clazz_instantialize(this, arguments);}, JU, "LimitedLineReader", null);
Clazz_makeConstructor(c$, 
function(bufferedReader, readLimit){
bufferedReader.mark(readLimit + 1);
this.buf =  Clazz_newCharArray (readLimit, '\0');
this.cchBuf = Math.max(bufferedReader.read(this.buf, 0, readLimit), 0);
this.ichCurrent = 0;
bufferedReader.reset();
}, "java.io.BufferedReader,~N");
Clazz_defineMethod(c$, "getHeader", 
function(n){
return (n == 0 ?  String.instantialize(this.buf) :  String.instantialize(this.buf, 0, Math.min(this.cchBuf, n)));
}, "~N");
Clazz_defineMethod(c$, "readLineWithNewline", 
function(){
while (this.ichCurrent < this.cchBuf) {
var ichBeginningOfLine = this.ichCurrent;
var ch = String.fromCharCode(0);
while (this.ichCurrent < this.cchBuf && (ch = this.buf[this.ichCurrent++]) != '\r' && ch != '\n') {
}
if (ch == '\r' && this.ichCurrent < this.cchBuf && this.buf[this.ichCurrent] == '\n') ++this.ichCurrent;
var cchLine = this.ichCurrent - ichBeginningOfLine;
if (this.buf[ichBeginningOfLine] == '#') continue;
return  String.instantialize(this.buf, ichBeginningOfLine, cchLine);
}
return "";
});
})();
;//5.0.1-v7 Mon Aug 17 10:07:10 MDT 2026
Clazz_declarePackage("JU");
(function(){
var c$ = Clazz_decorateAsClass(function(){
this.a = null;
this.m = 0;
this.n = 0;
if (!Clazz_isClassDefined("JU.Matrix.LUDecomp")) {
JU.Matrix.$Matrix$LUDecomp$ ();
}
Clazz_instantialize(this, arguments);}, JU, "Matrix", null, Cloneable);
Clazz_makeConstructor(c$, 
function(a, m, n){
this.a = (a == null ?  Clazz_newDoubleArray (m, n, 0) : a);
this.m = m;
this.n = n;
}, "~A,~N,~N");
Clazz_defineMethod(c$, "getRowDimension", 
function(){
return this.m;
});
Clazz_defineMethod(c$, "getColumnDimension", 
function(){
return this.n;
});
Clazz_defineMethod(c$, "getArray", 
function(){
return this.a;
});
Clazz_defineMethod(c$, "getArrayCopy", 
function(){
var x =  Clazz_newDoubleArray (this.m, this.n, 0);
for (var i = this.m; --i >= 0; ) for (var j = this.n; --j >= 0; ) x[i][j] = this.a[i][j];


return x;
});
Clazz_defineMethod(c$, "copy", 
function(){
var x =  new JU.Matrix(null, this.m, this.n);
var c = x.a;
for (var i = this.m; --i >= 0; ) for (var j = this.n; --j >= 0; ) c[i][j] = this.a[i][j];


return x;
});
Clazz_overrideMethod(c$, "clone", 
function(){
return this.copy();
});
Clazz_defineMethod(c$, "getSubmatrix", 
function(i0, j0, nrows, ncols){
var x =  new JU.Matrix(null, nrows, ncols);
var xa = x.a;
for (var i = nrows; --i >= 0; ) for (var j = ncols; --j >= 0; ) xa[i][j] = this.a[i0 + i][j0 + j];


return x;
}, "~N,~N,~N,~N");
Clazz_defineMethod(c$, "getMatrixSelected", 
function(r, n){
var x =  new JU.Matrix(null, r.length, n);
var xa = x.a;
for (var i = r.length; --i >= 0; ) {
var b = this.a[r[i]];
for (var j = n; --j >= 0; ) xa[i][j] = b[j];

}
return x;
}, "~A,~N");
Clazz_defineMethod(c$, "transpose", 
function(){
var x =  new JU.Matrix(null, this.n, this.m);
var c = x.a;
for (var i = this.m; --i >= 0; ) for (var j = this.n; --j >= 0; ) c[j][i] = this.a[i][j];


return x;
});
Clazz_defineMethod(c$, "add", 
function(b){
return this.scaleAdd(b, 1);
}, "JU.Matrix");
Clazz_defineMethod(c$, "sub", 
function(b){
return this.scaleAdd(b, -1);
}, "JU.Matrix");
Clazz_defineMethod(c$, "scaleAdd", 
function(b, scale){
var x =  new JU.Matrix(null, this.m, this.n);
var xa = x.a;
var ba = b.a;
for (var i = this.m; --i >= 0; ) for (var j = this.n; --j >= 0; ) xa[i][j] = ba[i][j] * scale + this.a[i][j];


return x;
}, "JU.Matrix,~N");
Clazz_defineMethod(c$, "mul", 
function(b){
if (b.m != this.n) return null;
var x =  new JU.Matrix(null, this.m, b.n);
var xa = x.a;
var ba = b.a;
for (var j = b.n; --j >= 0; ) for (var i = this.m; --i >= 0; ) {
var arowi = this.a[i];
var s = 0;
for (var k = this.n; --k >= 0; ) s += arowi[k] * ba[k][j];

xa[i][j] = s;
}

return x;
}, "JU.Matrix");
Clazz_defineMethod(c$, "inverse", 
function(){
return Clazz_innerTypeInstance(JU.Matrix.LUDecomp, this, null, this.m, this.n).solve(JU.Matrix.identity(this.m, this.m), this.n);
});
Clazz_defineMethod(c$, "trace", 
function(){
var t = 0;
for (var i = Math.min(this.m, this.n); --i >= 0; ) t += this.a[i][i];

return t;
});
c$.identity = Clazz_defineMethod(c$, "identity", 
function(m, n){
var x =  new JU.Matrix(null, m, n);
var xa = x.a;
for (var i = Math.min(m, n); --i >= 0; ) xa[i][i] = 1;

return x;
}, "~N,~N");
Clazz_defineMethod(c$, "getRotation", 
function(){
return this.getSubmatrix(0, 0, this.m - 1, this.n - 1);
});
Clazz_defineMethod(c$, "getTranslation", 
function(){
return this.getSubmatrix(0, this.n - 1, this.m - 1, 1);
});
c$.newT = Clazz_defineMethod(c$, "newT", 
function(r, asColumn){
return (asColumn ?  new JU.Matrix( Clazz_newArray(-1, [ Clazz_newDoubleArray(-1, [r.x]),  Clazz_newDoubleArray(-1, [r.y]),  Clazz_newDoubleArray(-1, [r.z])]), 3, 1) :  new JU.Matrix( Clazz_newArray(-1, [ Clazz_newDoubleArray(-1, [r.x, r.y, r.z])]), 1, 3));
}, "JU.T3,~B");
Clazz_overrideMethod(c$, "toString", 
function(){
var s = "[\n";
for (var i = 0; i < this.m; i++) {
s += "  [";
for (var j = 0; j < this.n; j++) s += " " + this.a[i][j];

s += "]\n";
}
s += "]";
return s;
});
c$.$Matrix$LUDecomp$ = function(){
/*if4*/;(function(){
var c$ = Clazz_decorateAsClass(function(){
Clazz_prepareCallback(this, arguments);
this.LU = null;
this.piv = null;
this.pivsign = 0;
Clazz_instantialize(this, arguments);}, JU.Matrix, "LUDecomp", null);
Clazz_makeConstructor(c$, 
function(m, n){
this.LU = this.b$["JU.Matrix"].getArrayCopy();
this.piv =  Clazz_newIntArray (m, 0);
for (var i = m; --i >= 0; ) this.piv[i] = i;

this.pivsign = 1;
var LUrowi;
var LUcolj =  Clazz_newDoubleArray (m, 0);
for (var j = 0; j < n; j++) {
for (var i = m; --i >= 0; ) LUcolj[i] = this.LU[i][j];

for (var i = m; --i >= 0; ) {
LUrowi = this.LU[i];
var kmax = Math.min(i, j);
var s = 0.0;
for (var k = kmax; --k >= 0; ) s += LUrowi[k] * LUcolj[k];

LUrowi[j] = LUcolj[i] -= s;
}
var p = j;
for (var i = m; --i > j; ) if (Math.abs(LUcolj[i]) > Math.abs(LUcolj[p])) p = i;

if (p != j) {
for (var k = n; --k >= 0; ) {
var t = this.LU[p][k];
this.LU[p][k] = this.LU[j][k];
this.LU[j][k] = t;
}
var k = this.piv[p];
this.piv[p] = this.piv[j];
this.piv[j] = k;
this.pivsign = -this.pivsign;
}if ( new Boolean (j < m & this.LU[j][j] != 0.0).valueOf()) for (var i = m; --i > j; ) this.LU[i][j] /= this.LU[j][j];

}
}, "~N,~N");
Clazz_defineMethod(c$, "solve", 
function(b, n){
for (var j = 0; j < n; j++) if (this.LU[j][j] == 0) return null;

var nx = b.n;
var x = b.getMatrixSelected(this.piv, nx);
var a = x.a;
for (var k = 0; k < n; k++) for (var i = k + 1; i < n; i++) for (var j = 0; j < nx; j++) a[i][j] -= a[k][j] * this.LU[i][k];



for (var k = n; --k >= 0; ) {
for (var j = nx; --j >= 0; ) a[k][j] /= this.LU[k][k];

for (var i = k; --i >= 0; ) for (var j = nx; --j >= 0; ) a[i][j] -= a[k][j] * this.LU[i][k];


}
return x;
}, "JU.Matrix,~N");
/*eoif4*/})();
};
})();
;//5.0.1-v7 Mon Aug 17 10:07:10 MDT 2026
Clazz_declarePackage("JU");
Clazz_load(["JU.P4"], "JU.Quat", ["JU.A4", "$.M3", "$.V3"], function(){
var c$ = Clazz_decorateAsClass(function(){
this.q0 = 0;
this.q1 = 0;
this.q2 = 0;
this.q3 = 0;
this.mat = null;
Clazz_instantialize(this, arguments);}, JU, "Quat", null);
Clazz_makeConstructor(c$, 
function(){
this.q0 = 1;
});
c$.newQ = Clazz_defineMethod(c$, "newQ", 
function(q){
var q1 =  new JU.Quat();
q1.set(q);
return q1;
}, "JU.Quat");
c$.newVA = Clazz_defineMethod(c$, "newVA", 
function(v, theta){
var q =  new JU.Quat();
q.setTA(v, theta);
return q;
}, "JU.T3,~N");
c$.newM = Clazz_defineMethod(c$, "newM", 
function(mat){
var q =  new JU.Quat();
q.setM(JU.M3.newM3(mat));
return q;
}, "JU.M3");
c$.newAA = Clazz_defineMethod(c$, "newAA", 
function(a){
var q =  new JU.Quat();
q.setAA(a);
return q;
}, "JU.A4");
c$.newP4 = Clazz_defineMethod(c$, "newP4", 
function(pt){
var q =  new JU.Quat();
q.setP4(pt);
return q;
}, "JU.P4");
c$.new4 = Clazz_defineMethod(c$, "new4", 
function(q1, q2, q3, q0){
var q =  new JU.Quat();
if (q0 < -1) {
q.q0 = -1;
return q;
}if (q0 > 1) {
q.q0 = 1;
return q;
}q.q0 = q0;
q.q1 = q1;
q.q2 = q2;
q.q3 = q3;
return q;
}, "~N,~N,~N,~N");
Clazz_defineMethod(c$, "set", 
function(q){
this.q0 = q.q0;
this.q1 = q.q1;
this.q2 = q.q2;
this.q3 = q.q3;
}, "JU.Quat");
Clazz_defineMethod(c$, "setP4", 
function(pt){
var factor = (pt == null ? 0 : pt.distance4(JU.Quat.qZero));
if (factor == 0) {
this.q0 = 1;
return;
}this.q0 = pt.w / factor;
this.q1 = pt.x / factor;
this.q2 = pt.y / factor;
this.q3 = pt.z / factor;
}, "JU.P4");
Clazz_defineMethod(c$, "setTA", 
function(pt, theta){
if (pt.x == 0 && pt.y == 0 && pt.z == 0) {
this.q0 = 1;
return;
}var fact = (Math.sin(theta / 2 * 0.017453292519943295) / Math.sqrt(pt.x * pt.x + pt.y * pt.y + pt.z * pt.z));
this.q0 = (Math.cos(theta / 2 * 0.017453292519943295));
this.q1 = (pt.x * fact);
this.q2 = (pt.y * fact);
this.q3 = (pt.z * fact);
}, "JU.T3,~N");
Clazz_defineMethod(c$, "setAA", 
function(a){
var aa = JU.A4.newAA(a);
if (aa.angle == 0) aa.y = 1;
this.setM( new JU.M3().setAA(aa));
}, "JU.A4");
Clazz_defineMethod(c$, "setM", 
function(mat){
this.mat = mat;
var trace = mat.m00 + mat.m11 + mat.m22;
var temp;
var w;
var x;
var y;
var z;
if (trace >= 0.5) {
w = Math.sqrt(1.0 + trace);
x = (mat.m21 - mat.m12) / w;
y = (mat.m02 - mat.m20) / w;
z = (mat.m10 - mat.m01) / w;
} else if ((temp = mat.m00 + mat.m00 - trace) >= 0.5) {
x = Math.sqrt(1.0 + temp);
w = (mat.m21 - mat.m12) / x;
y = (mat.m10 + mat.m01) / x;
z = (mat.m20 + mat.m02) / x;
} else if ((temp = mat.m11 + mat.m11 - trace) >= 0.5 || mat.m11 > mat.m22) {
y = Math.sqrt(1.0 + temp);
w = (mat.m02 - mat.m20) / y;
x = (mat.m10 + mat.m01) / y;
z = (mat.m21 + mat.m12) / y;
} else {
z = Math.sqrt(1.0 + mat.m22 + mat.m22 - trace);
w = (mat.m10 - mat.m01) / z;
x = (mat.m20 + mat.m02) / z;
y = (mat.m21 + mat.m12) / z;
}this.q0 = (w * 0.5);
this.q1 = (x * 0.5);
this.q2 = (y * 0.5);
this.q3 = (z * 0.5);
}, "JU.M3");
Clazz_defineMethod(c$, "setRef", 
function(qref){
if (qref == null) {
this.mul(this.getFixFactor());
return;
}if (this.dot(qref) >= 0) return;
this.q0 *= -1;
this.q1 *= -1;
this.q2 *= -1;
this.q3 *= -1;
}, "JU.Quat");
c$.getQuaternionFrame = Clazz_defineMethod(c$, "getQuaternionFrame", 
function(center, x, xy){
var vA = JU.V3.newV(x);
var vB = JU.V3.newV(xy);
if (center != null) {
vA.sub(center);
vB.sub(center);
}return JU.Quat.getQuaternionFrameV(vA, vB, null, false);
}, "JU.P3,JU.T3,JU.T3");
c$.getQuaternionFrameV = Clazz_defineMethod(c$, "getQuaternionFrameV", 
function(vA, vB, vC, yBased){
if (vC == null) {
vC =  new JU.V3();
vC.cross(vA, vB);
if (yBased) vA.cross(vB, vC);
}var vBprime =  new JU.V3();
vBprime.cross(vC, vA);
vA.normalize();
vBprime.normalize();
vC.normalize();
var mat =  new JU.M3();
mat.setColumnV(0, vA);
mat.setColumnV(1, vBprime);
mat.setColumnV(2, vC);
var q = JU.Quat.newM(mat);
return q;
}, "JU.V3,JU.V3,JU.V3,~B");
Clazz_defineMethod(c$, "getMatrix", 
function(){
if (this.mat == null) this.setMatrix();
return this.mat;
});
Clazz_defineMethod(c$, "setMatrix", 
function(){
this.mat =  new JU.M3();
this.mat.m00 = this.q0 * this.q0 + this.q1 * this.q1 - this.q2 * this.q2 - this.q3 * this.q3;
this.mat.m01 = 2 * this.q1 * this.q2 - 2 * this.q0 * this.q3;
this.mat.m02 = 2 * this.q1 * this.q3 + 2 * this.q0 * this.q2;
this.mat.m10 = 2 * this.q1 * this.q2 + 2 * this.q0 * this.q3;
this.mat.m11 = this.q0 * this.q0 - this.q1 * this.q1 + this.q2 * this.q2 - this.q3 * this.q3;
this.mat.m12 = 2 * this.q2 * this.q3 - 2 * this.q0 * this.q1;
this.mat.m20 = 2 * this.q1 * this.q3 - 2 * this.q0 * this.q2;
this.mat.m21 = 2 * this.q2 * this.q3 + 2 * this.q0 * this.q1;
this.mat.m22 = this.q0 * this.q0 - this.q1 * this.q1 - this.q2 * this.q2 + this.q3 * this.q3;
});
Clazz_defineMethod(c$, "add", 
function(x){
return JU.Quat.newVA(this.getNormal(), this.getTheta() + x);
}, "~N");
Clazz_defineMethod(c$, "mul", 
function(x){
return (x == 1 ? JU.Quat.new4(this.q1, this.q2, this.q3, this.q0) : JU.Quat.newVA(this.getNormal(), this.getTheta() * x));
}, "~N");
Clazz_defineMethod(c$, "mulQ", 
function(p){
return JU.Quat.new4(this.q0 * p.q1 + this.q1 * p.q0 + this.q2 * p.q3 - this.q3 * p.q2, this.q0 * p.q2 + this.q2 * p.q0 + this.q3 * p.q1 - this.q1 * p.q3, this.q0 * p.q3 + this.q3 * p.q0 + this.q1 * p.q2 - this.q2 * p.q1, this.q0 * p.q0 - this.q1 * p.q1 - this.q2 * p.q2 - this.q3 * p.q3);
}, "JU.Quat");
Clazz_defineMethod(c$, "divLeft", 
function(p){
return this.inv().mulQ(p);
}, "JU.Quat");
Clazz_defineMethod(c$, "dot", 
function(q){
return this.q0 * q.q0 + this.q1 * q.q1 + this.q2 * q.q2 + this.q3 * q.q3;
}, "JU.Quat");
Clazz_defineMethod(c$, "inv", 
function(){
return JU.Quat.new4(-this.q1, -this.q2, -this.q3, this.q0);
});
Clazz_defineMethod(c$, "negate", 
function(){
return JU.Quat.new4(-this.q1, -this.q2, -this.q3, -this.q0);
});
Clazz_defineMethod(c$, "getFixFactor", 
function(){
return (this.q0 < 0 || this.q0 == 0 && (this.q1 < 0 || this.q1 == 0 && (this.q2 < 0 || this.q2 == 0 && this.q3 < 0)) ? -1 : 1);
});
Clazz_defineMethod(c$, "getVector", 
function(i){
return this.getVectorScaled(i, 1);
}, "~N");
Clazz_defineMethod(c$, "getVectorScaled", 
function(i, scale){
if (i == -1) {
scale *= this.getFixFactor();
return JU.V3.new3(this.q1 * scale, this.q2 * scale, this.q3 * scale);
}if (this.mat == null) this.setMatrix();
var v =  new JU.V3();
this.mat.getColumnV(i, v);
if (scale != 1) v.scale(scale);
return v;
}, "~N,~N");
Clazz_defineMethod(c$, "getNormal", 
function(){
var v = JU.Quat.getRawNormal(this);
v.scale(this.getFixFactor());
return v;
});
c$.getRawNormal = Clazz_defineMethod(c$, "getRawNormal", 
function(q){
var v = JU.V3.new3(q.q1, q.q2, q.q3);
if (v.length() == 0) return JU.V3.new3(0, 0, 1);
v.normalize();
return v;
}, "JU.Quat");
Clazz_defineMethod(c$, "getTheta", 
function(){
return (Math.acos(Math.abs(this.q0)) * 2 * 180 / 3.141592653589793);
});
Clazz_defineMethod(c$, "getThetaRadians", 
function(){
return (Math.acos(Math.abs(this.q0)) * 2);
});
Clazz_defineMethod(c$, "getNormalDirected", 
function(v0){
var v = this.getNormal();
if (v.x * v0.x + v.y * v0.y + v.z * v0.z < 0) {
v.scale(-1);
}return v;
}, "JU.V3");
Clazz_defineMethod(c$, "get3dProjection", 
function(v3d){
v3d.set(this.q1, this.q2, this.q3);
return v3d;
}, "JU.V3");
Clazz_defineMethod(c$, "getThetaDirected", 
function(axisAngle){
var theta = this.getTheta();
var v = this.getNormal();
if (axisAngle.x * this.q1 + axisAngle.y * this.q2 + axisAngle.z * this.q3 < 0) {
v.scale(-1);
theta = -theta;
}axisAngle.set4(v.x, v.y, v.z, theta);
return axisAngle;
}, "JU.P4");
Clazz_defineMethod(c$, "getThetaDirectedV", 
function(vector){
var theta = this.getTheta();
var v = this.getNormal();
if (vector.x * this.q1 + vector.y * this.q2 + vector.z * this.q3 < 0) {
v.scale(-1);
theta = -theta;
}return theta;
}, "JU.V3");
Clazz_defineMethod(c$, "toPoint4f", 
function(){
return JU.P4.new4(this.q1, this.q2, this.q3, this.q0);
});
Clazz_defineMethod(c$, "toAxisAngle4f", 
function(){
var theta = 2 * Math.acos(Math.abs(this.q0));
var sinTheta2 = Math.sin(theta / 2);
var v = this.getNormal();
if (sinTheta2 < 0) {
v.scale(-1);
theta = 3.141592653589793 - theta;
}return JU.A4.newVA(v, theta);
});
Clazz_defineMethod(c$, "transform2", 
function(pt, ptNew){
if (this.mat == null) this.setMatrix();
this.mat.rotate2(pt, ptNew);
return ptNew;
}, "JU.T3,JU.T3");
Clazz_defineMethod(c$, "leftDifference", 
function(q2){
var q2adjusted = (this.dot(q2) < 0 ? q2.negate() : q2);
return this.inv().mulQ(q2adjusted);
}, "JU.Quat");
Clazz_defineMethod(c$, "rightDifference", 
function(q2){
var q2adjusted = (this.dot(q2) < 0 ? q2.negate() : q2);
return this.mulQ(q2adjusted.inv());
}, "JU.Quat");
Clazz_overrideMethod(c$, "toString", 
function(){
return "{" + this.q1 + " " + this.q2 + " " + this.q3 + " " + this.q0 + "}";
});
Clazz_defineMethod(c$, "div", 
function(p){
return this.mulQ(p.inv());
}, "JU.Quat");
c$.arrayDiv = Clazz_defineMethod(c$, "arrayDiv", 
function(data1, data2, nMax, isRelative){
var n;
if (data1 == null || data2 == null || (n = Math.min(data1.length, data2.length)) == 0) return null;
if (nMax > 0 && n > nMax) n = nMax;
var dqs =  new Array(n);
for (var i = 0; i < n; i++) {
if (data1[i] == null || data2[i] == null) return null;
dqs[i] = (isRelative ? data1[i].divLeft(data2[i]) : data1[i].div(data2[i]));
}
return dqs;
}, "~A,~A,~N,~B");
c$.sphereMean = Clazz_defineMethod(c$, "sphereMean", 
function(data, retStddev, criterion){
if (data == null || data.length == 0) return  new JU.Quat();
if (retStddev == null) retStddev =  Clazz_newFloatArray (1, 0);
if (data.length == 1) {
retStddev[0] = 0;
return JU.Quat.newQ(data[0]);
}var diff = 3.4028235E38;
var lastStddev = 3.4028235E38;
var qMean = JU.Quat.simpleAverage(data);
var maxIter = 100;
var iter = 0;
while (diff > criterion && lastStddev != 0 && iter < maxIter) {
qMean = JU.Quat.newMean(data, qMean);
retStddev[0] = JU.Quat.stdDev(data, qMean);
diff = Math.abs(retStddev[0] - lastStddev);
lastStddev = retStddev[0];
}
return qMean;
}, "~A,~A,~N");
c$.simpleAverage = Clazz_defineMethod(c$, "simpleAverage", 
function(ndata){
var mean = JU.V3.new3(0, 0, 1);
var v = ndata[0].getNormal();
mean.add(v);
for (var i = ndata.length; --i >= 0; ) mean.add(ndata[i].getNormalDirected(mean));

mean.sub(v);
mean.normalize();
var f = 0;
for (var i = ndata.length; --i >= 0; ) f += Math.abs(ndata[i].get3dProjection(v).dot(mean));

if (f != 0) mean.scale(f / ndata.length);
f = Math.sqrt(1 - mean.lengthSquared());
if (Float.isNaN(f)) f = 0;
return JU.Quat.newP4(JU.P4.new4(mean.x, mean.y, mean.z, f));
}, "~A");
c$.newMean = Clazz_defineMethod(c$, "newMean", 
function(data, mean){
var sum =  new JU.V3();
var v;
var q;
var dq;
for (var i = data.length; --i >= 0; ) {
q = data[i];
dq = q.div(mean);
v = dq.getNormal();
v.scale(dq.getTheta());
sum.add(v);
}
sum.scale(1 / data.length);
var dqMean = JU.Quat.newVA(sum, sum.length());
return dqMean.mulQ(mean);
}, "~A,JU.Quat");
c$.stdDev = Clazz_defineMethod(c$, "stdDev", 
function(data, mean){
var sum2 = 0;
var n = data.length;
for (var i = n; --i >= 0; ) {
var theta = data[i].div(mean).getTheta();
sum2 += theta * theta;
}
return Math.sqrt(sum2 / n);
}, "~A,JU.Quat");
Clazz_defineMethod(c$, "getEulerZYZ", 
function(){
var rA;
var rB;
var rG;
if (this.q1 == 0 && this.q2 == 0) {
var theta = this.getTheta();
return  Clazz_newFloatArray(-1, [this.q3 < 0 ? -theta : theta, 0, 0]);
}rA = Math.atan2(2 * (this.q2 * this.q3 + this.q0 * this.q1), 2 * (-this.q1 * this.q3 + this.q0 * this.q2));
rB = Math.acos(this.q3 * this.q3 - this.q2 * this.q2 - this.q1 * this.q1 + this.q0 * this.q0);
rG = Math.atan2(2 * (this.q2 * this.q3 - this.q0 * this.q1), 2 * (this.q0 * this.q2 + this.q1 * this.q3));
return  Clazz_newFloatArray(-1, [(rA / 0.017453292519943295), (rB / 0.017453292519943295), (rG / 0.017453292519943295)]);
});
Clazz_defineMethod(c$, "getEulerZXZ", 
function(){
var rA;
var rB;
var rG;
if (this.q1 == 0 && this.q2 == 0) {
var theta = this.getTheta();
return  Clazz_newFloatArray(-1, [this.q3 < 0 ? -theta : theta, 0, 0]);
}rA = Math.atan2(2 * (this.q1 * this.q3 - this.q0 * this.q2), 2 * (this.q0 * this.q1 + this.q2 * this.q3));
rB = Math.acos(this.q3 * this.q3 - this.q2 * this.q2 - this.q1 * this.q1 + this.q0 * this.q0);
rG = Math.atan2(2 * (this.q1 * this.q3 + this.q0 * this.q2), 2 * (-this.q2 * this.q3 + this.q0 * this.q1));
return  Clazz_newFloatArray(-1, [(rA / 0.017453292519943295), (rB / 0.017453292519943295), (rG / 0.017453292519943295)]);
});
c$.qZero =  new JU.P4();
});
;//5.0.1-v7 Mon Aug 17 10:07:10 MDT 2026
Clazz_declarePackage("JU");
Clazz_load(["java.io.BufferedReader", "javajs.api.GenericLineReader"], "JU.Rdr", ["java.io.BufferedInputStream", "$.ByteArrayInputStream", "$.InputStreamReader", "$.StringReader", "JU.AU", "$.Base64", "$.Encoding", "$.SB"], function(){
var c$ = Clazz_decorateAsClass(function(){
this.reader = null;
Clazz_instantialize(this, arguments);}, JU, "Rdr", null, javajs.api.GenericLineReader);
Clazz_makeConstructor(c$, 
function(reader){
this.reader = reader;
}, "java.io.BufferedReader");
Clazz_overrideMethod(c$, "readNextLine", 
function(){
return this.reader.readLine();
});
c$.readCifData = Clazz_defineMethod(c$, "readCifData", 
function(parser, br, keys){
parser.set(null, br, false);
return (keys == null ? parser.getAllCifData() : parser.getAllCifDataType(keys));
}, "javajs.api.GenericCifDataParser,java.io.BufferedReader,~A");
c$.fixUTF = Clazz_defineMethod(c$, "fixUTF", 
function(bytes){
var encoding = JU.Rdr.getUTFEncoding(bytes);
if (encoding !== JU.Encoding.NONE) {
try {
var s =  String.instantialize(bytes, encoding.name().$replace('_', '-'));
switch (encoding) {
case JU.Encoding.UTF8:
case JU.Encoding.UTF_16BE:
case JU.Encoding.UTF_16LE:
s = s.substring(1);
break;
default:
break;
}
return s;
} catch (e) {
if (Clazz_exceptionOf(e,"java.io.UnsupportedEncodingException")){
System.out.println(e);
} else {
throw e;
}
}
}return  String.instantialize(bytes);
}, "~A");
c$.getUTFEncoding = Clazz_defineMethod(c$, "getUTFEncoding", 
function(bytes){
if (bytes.length >= 3 && (bytes[0] & 0xFF) == 0xEF && (bytes[1] & 0xFF) == 0xBB && (bytes[2] & 0xFF) == 0xBF) return JU.Encoding.UTF8;
if (bytes.length >= 4 && (bytes[0] & 0xFF) == 0 && (bytes[1] & 0xFF) == 0 && (bytes[2] & 0xFF) == 0xFE && (bytes[3] & 0xFF) == 0xFF) return JU.Encoding.UTF_32BE;
if (bytes.length >= 4 && (bytes[0] & 0xFF) == 0xFF && (bytes[1] & 0xFF) == 0xFE && (bytes[2] & 0xFF) == 0 && (bytes[3] & 0xFF) == 0) return JU.Encoding.UTF_32LE;
if (bytes.length >= 2 && (bytes[0] & 0xFF) == 0xFF && (bytes[1] & 0xFF) == 0xFE) return JU.Encoding.UTF_16LE;
if (bytes.length >= 2 && (bytes[0] & 0xFF) == 0xFE && (bytes[1] & 0xFF) == 0xFF) return JU.Encoding.UTF_16BE;
return JU.Encoding.NONE;
}, "~A");
c$.getUTFEncodingForStream = Clazz_defineMethod(c$, "getUTFEncodingForStream", 
function(is){
{
is.resetStream();
}var abMagic =  Clazz_newByteArray (4, 0);
abMagic[3] = 1;
try {
is.mark(5);
} catch (e) {
if (Clazz_exceptionOf(e, Exception)){
return JU.Encoding.NONE;
} else {
throw e;
}
}
is.read(abMagic, 0, 4);
is.reset();
return JU.Rdr.getUTFEncoding(abMagic);
}, "java.io.BufferedInputStream");
c$.isBase64 = Clazz_defineMethod(c$, "isBase64", 
function(sb){
return (sb.indexOf(";base64,") == 0);
}, "JU.SB");
c$.isCompoundDocumentS = Clazz_defineMethod(c$, "isCompoundDocumentS", 
function(is){
return JU.Rdr.isCompoundDocumentB(JU.Rdr.getMagic(is, 8));
}, "java.io.InputStream");
c$.isCompoundDocumentB = Clazz_defineMethod(c$, "isCompoundDocumentB", 
function(bytes){
return (bytes.length >= 8 && (bytes[0] & 0xFF) == 0xD0 && (bytes[1] & 0xFF) == 0xCF && (bytes[2] & 0xFF) == 0x11 && (bytes[3] & 0xFF) == 0xE0 && (bytes[4] & 0xFF) == 0xA1 && (bytes[5] & 0xFF) == 0xB1 && (bytes[6] & 0xFF) == 0x1A && (bytes[7] & 0xFF) == 0xE1);
}, "~A");
c$.isBZip2S = Clazz_defineMethod(c$, "isBZip2S", 
function(is){
return JU.Rdr.isBZip2B(JU.Rdr.getMagic(is, 3));
}, "java.io.InputStream");
c$.isGzipS = Clazz_defineMethod(c$, "isGzipS", 
function(is){
return JU.Rdr.isGzipB(JU.Rdr.getMagic(is, 2));
}, "java.io.InputStream");
c$.isBZip2B = Clazz_defineMethod(c$, "isBZip2B", 
function(bytes){
return (bytes != null && bytes.length >= 3 && (bytes[0] & 0xFF) == 0x42 && (bytes[1] & 0xFF) == 0x5A && (bytes[2] & 0xFF) == 0x68);
}, "~A");
c$.isGzipB = Clazz_defineMethod(c$, "isGzipB", 
function(bytes){
return (bytes != null && bytes.length >= 2 && (bytes[0] & 0xFF) == 0x1F && (bytes[1] & 0xFF) == 0x8B);
}, "~A");
c$.isPickleS = Clazz_defineMethod(c$, "isPickleS", 
function(is){
return JU.Rdr.isPickleB(JU.Rdr.getMagic(is, 2));
}, "java.io.InputStream");
c$.isPickleB = Clazz_defineMethod(c$, "isPickleB", 
function(bytes){
return (bytes != null && bytes.length >= 2 && (bytes[0] & 0xFF) == 0x7D && (bytes[1] & 0xFF) == 0x71);
}, "~A");
c$.isMessagePackS = Clazz_defineMethod(c$, "isMessagePackS", 
function(is){
return JU.Rdr.isMessagePackB(JU.Rdr.getMagic(is, 2));
}, "java.io.InputStream");
c$.isMessagePackB = Clazz_defineMethod(c$, "isMessagePackB", 
function(bytes){
var b;
return (bytes != null && bytes.length >= 1 && (((b = bytes[0] & 0xFF)) == 0xDE || (b & 0xE0) == 0x80 && bytes[1] != 0x50));
}, "~A");
c$.isPngZipStream = Clazz_defineMethod(c$, "isPngZipStream", 
function(is){
return JU.Rdr.isPngZipB(JU.Rdr.getMagic(is, 55));
}, "java.io.InputStream");
c$.isPngZipB = Clazz_defineMethod(c$, "isPngZipB", 
function(bytes){
return (bytes[50] == 0 && bytes[51] == 0x50 && bytes[52] == 0x4E && bytes[53] == 0x47 && bytes[54] == 0x4A);
}, "~A");
c$.isZipS = Clazz_defineMethod(c$, "isZipS", 
function(is){
return JU.Rdr.isZipB(JU.Rdr.getMagic(is, 4));
}, "java.io.InputStream");
c$.isZipB = Clazz_defineMethod(c$, "isZipB", 
function(bytes){
return (bytes.length >= 4 && bytes[0] == 0x50 && bytes[1] == 0x4B && bytes[2] == 0x03 && bytes[3] == 0x04);
}, "~A");
c$.getMagic = Clazz_defineMethod(c$, "getMagic", 
function(is, n){
var abMagic = (n > 264 ?  Clazz_newByteArray (n, 0) : JU.Rdr.b264 == null ? (JU.Rdr.b264 =  Clazz_newByteArray (265, 0)) : JU.Rdr.b264);
{
is.resetStream();
}try {
abMagic[264] = -1;
is.mark(n + 1);
var i = is.read(abMagic, 0, n);
if (i < n) {
abMagic[0] = abMagic[264] = 0;
}} catch (e) {
if (Clazz_exceptionOf(e,"java.io.IOException")){
} else {
throw e;
}
}
try {
is.reset();
} catch (e) {
if (Clazz_exceptionOf(e,"java.io.IOException")){
} else {
throw e;
}
}
return abMagic;
}, "java.io.InputStream,~N");
c$.guessMimeTypeForBytes = Clazz_defineMethod(c$, "guessMimeTypeForBytes", 
function(bytes){
switch (bytes.length < 2 ? -1 : bytes[1]) {
case 0:
return "image/jpg";
case 0x49:
return "image/gif";
case 0x4D:
return "image/BMP";
case 0x50:
return "image/png";
default:
return "image/unknown";
}
}, "~A");
c$.getBIS = Clazz_defineMethod(c$, "getBIS", 
function(bytes){
return  new java.io.BufferedInputStream( new java.io.ByteArrayInputStream(bytes));
}, "~A");
c$.getBR = Clazz_defineMethod(c$, "getBR", 
function(string){
return  new java.io.BufferedReader( new java.io.StringReader(string));
}, "~S");
c$.getUnzippedInputStream = Clazz_defineMethod(c$, "getUnzippedInputStream", 
function(jzt, bis){
while (JU.Rdr.isGzipS(bis)) bis =  new java.io.BufferedInputStream(jzt.newGZIPInputStream(bis));

return bis;
}, "javajs.api.GenericZipTools,java.io.BufferedInputStream");
c$.getUnzippedInputStreamBZip2 = Clazz_defineMethod(c$, "getUnzippedInputStreamBZip2", 
function(jzt, bis){
while (JU.Rdr.isBZip2S(bis)) bis =  new java.io.BufferedInputStream(jzt.newBZip2InputStream(bis));

return bis;
}, "javajs.api.GenericZipTools,java.io.BufferedInputStream");
c$.getBytesFromSB = Clazz_defineMethod(c$, "getBytesFromSB", 
function(sb){
return (JU.Rdr.isBase64(sb) ? JU.Base64.decodeBase64(sb.substring(8)) : sb.toBytes(0, -1));
}, "JU.SB");
c$.getStreamAsBytes = Clazz_defineMethod(c$, "getStreamAsBytes", 
function(bis, out){
var buf =  Clazz_newByteArray (1024, 0);
var bytes = (out == null ?  Clazz_newByteArray (4096, 0) : null);
var len = 0;
var totalLen = 0;
while ((len = bis.read(buf, 0, 1024)) > 0) {
totalLen += len;
if (out == null) {
if (totalLen >= bytes.length) bytes = JU.AU.ensureLengthByte(bytes, totalLen * 2);
System.arraycopy(buf, 0, bytes, totalLen - len, len);
} else {
out.write(buf, 0, len);
}}
bis.close();
if (out == null) {
return JU.AU.arrayCopyByte(bytes, totalLen);
}return totalLen + " bytes";
}, "java.io.BufferedInputStream,JU.OC");
c$.getBufferedReader = Clazz_defineMethod(c$, "getBufferedReader", 
function(bis, charSet){
if (JU.Rdr.getUTFEncodingForStream(bis) === JU.Encoding.NONE) return  new JU.Rdr.StreamReader(bis, charSet);
var bytes = JU.Rdr.getLimitedStreamBytes(bis, -1);
bis.close();
return JU.Rdr.getBR(charSet == null ? JU.Rdr.fixUTF(bytes) :  String.instantialize(bytes, charSet));
}, "java.io.BufferedInputStream,~S");
c$.getLimitedStreamBytes = Clazz_defineMethod(c$, "getLimitedStreamBytes", 
function(is, n){
var buflen = (n > 0 && n < 1024 ? n : 1024);
var buf =  Clazz_newByteArray (buflen, 0);
var bytes =  Clazz_newByteArray (n < 0 ? 4096 : n, 0);
var len = 0;
var totalLen = 0;
if (n < 0) n = 2147483647;
while (totalLen < n && (len = is.read(buf, 0, buflen)) > 0) {
totalLen += len;
if (totalLen > bytes.length) bytes = JU.AU.ensureLengthByte(bytes, totalLen * 2);
System.arraycopy(buf, 0, bytes, totalLen - len, len);
if (n != 2147483647 && totalLen + buflen > bytes.length) buflen = bytes.length - totalLen;
}
if (totalLen == bytes.length) return bytes;
buf =  Clazz_newByteArray (totalLen, 0);
System.arraycopy(bytes, 0, buf, 0, totalLen);
return buf;
}, "java.io.InputStream,~N");
c$.streamToUTF8String = Clazz_defineMethod(c$, "streamToUTF8String", 
function(bis){
var data =  new Array(1);
try {
JU.Rdr.readAllAsString(JU.Rdr.getBufferedReader(bis, "UTF-8"), -1, true, data, 0);
} catch (e) {
if (Clazz_exceptionOf(e,"java.io.IOException")){
} else {
throw e;
}
}
return data[0];
}, "java.io.BufferedInputStream");
c$.readAllAsString = Clazz_defineMethod(c$, "readAllAsString", 
function(br, nBytesMax, allowBinary, data, i){
try {
var sb = JU.SB.newN(8192);
var line;
if (nBytesMax < 0) {
line = br.readLine();
if (allowBinary || line != null && line.indexOf('\0') < 0 && (line.length != 4 || (line.charAt(0)).charCodeAt(0) != 65533 || line.indexOf("PNG") != 1)) {
sb.append(line).appendC('\n');
while ((line = br.readLine()) != null) sb.append(line).appendC('\n');

}} else {
var n = 0;
var len;
while (n < nBytesMax && (line = br.readLine()) != null) {
if (nBytesMax - n < (len = line.length) + 1) line = line.substring(0, nBytesMax - n - 1);
sb.append(line).appendC('\n');
n += len + 1;
}
}br.close();
data[i] = sb.toString();
return true;
} catch (ioe) {
if (Clazz_exceptionOf(ioe, Exception)){
data[i] = ioe.toString();
return false;
} else {
throw ioe;
}
}
}, "java.io.BufferedReader,~N,~B,~A,~N");
c$.getPngZipPointAndCount = Clazz_defineMethod(c$, "getPngZipPointAndCount", 
function(bis, pt_count){
bis.mark(75);
try {
var data = JU.Rdr.getLimitedStreamBytes(bis, 74);
bis.reset();
var pt = 0;
for (var i = 64, f = 1; --i > 54; f *= 10) pt += (data[i] - 48) * f;

var n = 0;
for (var i = 74, f = 1; --i > 64; f *= 10) n += (data[i] - 48) * f;

pt_count[0] = pt;
pt_count[1] = n;
} catch (e) {
pt_count[1] = 0;
}
}, "java.io.BufferedInputStream,~A");
c$.getPngZipStream = Clazz_defineMethod(c$, "getPngZipStream", 
function(bis, asNewStream){
if (!JU.Rdr.isPngZipStream(bis)) return bis;
var data =  Clazz_newByteArray (0, 0);
bis.mark(75);
try {
var pt_count =  Clazz_newIntArray (2, 0);
JU.Rdr.getPngZipPointAndCount(bis, pt_count);
if (pt_count[1] != 0) {
var pt = pt_count[0];
while (pt > 0) pt -= bis.skip(pt);

if (!asNewStream) return bis;
data = JU.Rdr.getLimitedStreamBytes(bis, pt_count[1]);
}} catch (e) {
} finally {
try {
if (asNewStream) bis.close();
} catch (e) {
if (Clazz_exceptionOf(e, Exception)){
} else {
throw e;
}
}
}
return JU.Rdr.getBIS(data);
}, "java.io.BufferedInputStream,~B");
c$.getZipRoot = Clazz_defineMethod(c$, "getZipRoot", 
function(fileName){
var pt = fileName.indexOf("|");
return (pt < 0 ? fileName : fileName.substring(0, pt));
}, "~S");
c$.isTar = Clazz_defineMethod(c$, "isTar", 
function(bis){
var bytes = JU.Rdr.getMagic(bis, 264);
return (bytes[264] == -1 && (bytes[257] & 0xFF) == 0x75 && (bytes[258] & 0xFF) == 0x73 && (bytes[259] & 0xFF) == 0x74 && (bytes[260] & 0xFF) == 0x61 && (bytes[261] & 0xFF) == 0x72);
}, "java.io.BufferedInputStream");
c$.streamToBytes = Clazz_defineMethod(c$, "streamToBytes", 
function(is){
var bytes = JU.Rdr.getLimitedStreamBytes(is, -1);
is.close();
return bytes;
}, "java.io.InputStream");
c$.streamToString = Clazz_defineMethod(c$, "streamToString", 
function(is){
return  String.instantialize(JU.Rdr.streamToBytes(is));
}, "java.io.InputStream");
c$.isBinary = Clazz_defineMethod(c$, "isBinary", 
function(bis, n){
var bytes = JU.Rdr.getMagic(bis, n);
if (JU.Rdr.b264[264] == -1) for (var i = 0; i < n; i++) if (bytes[i] < 9) return true;

return false;
}, "java.io.BufferedInputStream,~N");
/*if3*/;(function(){
var c$ = Clazz_decorateAsClass(function(){
this.stream = null;
Clazz_instantialize(this, arguments);}, JU.Rdr, "StreamReader", java.io.BufferedReader);
Clazz_makeConstructor(c$, 
function(bis, charSet){
Clazz_superConstructor(this, JU.Rdr.StreamReader, [ new java.io.InputStreamReader(bis, (charSet == null ? "UTF-8" : charSet))]);
this.stream = bis;
}, "java.io.BufferedInputStream,~S");
Clazz_defineMethod(c$, "getStream", 
function(){
try {
this.stream.reset();
} catch (e) {
if (Clazz_exceptionOf(e,"java.io.IOException")){
} else {
throw e;
}
}
return this.stream;
});
/*eoif3*/})();
c$.b264 = null;
});
;//5.0.1-v7 Mon Aug 17 10:07:10 MDT 2026
Clazz_declarePackage("JU");
(function(){
var c$ = Clazz_decorateAsClass(function(){
this.x = 0;
this.y = 0;
this.z = 0;
Clazz_instantialize(this, arguments);}, JU, "T3d", null, java.io.Serializable);
/*LV!1824 unnec constructor*/Clazz_defineMethod(c$, "set", 
function(x, y, z){
this.x = x;
this.y = y;
this.z = z;
}, "~N,~N,~N");
Clazz_defineMethod(c$, "setA", 
function(t){
this.x = t[0];
this.y = t[1];
this.z = t[2];
}, "~A");
Clazz_defineMethod(c$, "setT", 
function(t1){
this.x = t1.x;
this.y = t1.y;
this.z = t1.z;
}, "JU.T3d");
Clazz_defineMethod(c$, "add2", 
function(t1, t2){
this.x = t1.x + t2.x;
this.y = t1.y + t2.y;
this.z = t1.z + t2.z;
}, "JU.T3d,JU.T3d");
Clazz_defineMethod(c$, "add", 
function(t1){
this.x += t1.x;
this.y += t1.y;
this.z += t1.z;
}, "JU.T3d");
Clazz_defineMethod(c$, "sub2", 
function(t1, t2){
this.x = t1.x - t2.x;
this.y = t1.y - t2.y;
this.z = t1.z - t2.z;
}, "JU.T3d,JU.T3d");
Clazz_defineMethod(c$, "sub", 
function(t1){
this.x -= t1.x;
this.y -= t1.y;
this.z -= t1.z;
}, "JU.T3d");
Clazz_defineMethod(c$, "scale", 
function(s){
this.x *= s;
this.y *= s;
this.z *= s;
}, "~N");
Clazz_defineMethod(c$, "scaleAdd", 
function(s, t1, t2){
this.x = s * t1.x + t2.x;
this.y = s * t1.y + t2.y;
this.z = s * t1.z + t2.z;
}, "~N,JU.T3d,JU.T3d");
Clazz_defineMethod(c$, "scaleAdd2", 
function(s, t1, t2){
this.x = s * t1.x + t2.x;
this.y = s * t1.y + t2.y;
this.z = s * t1.z + t2.z;
}, "~N,JU.T3d,JU.T3d");
Clazz_overrideMethod(c$, "hashCode", 
function(){
var xbits = JU.T3d.doubleToLongBits0(this.x);
var ybits = JU.T3d.doubleToLongBits0(this.y);
var zbits = JU.T3d.doubleToLongBits0(this.z);
return (xbits ^ (xbits >> 32) ^ ybits ^ (ybits >> 32) ^ zbits ^ (zbits >> 32));
});
c$.doubleToLongBits0 = Clazz_defineMethod(c$, "doubleToLongBits0", 
function(d){
return (d == 0 ? 0 : Double.doubleToLongBits(d));
}, "~N");
Clazz_overrideMethod(c$, "equals", 
function(t1){
if (!(Clazz_instanceOf(t1,"JU.T3d"))) return false;
var t2 = t1;
return (this.x == t2.x && this.y == t2.y && this.z == t2.z);
}, "~O");
Clazz_overrideMethod(c$, "toString", 
function(){
return "{" + this.x + ", " + this.y + ", " + this.z + "}";
});
})();
;//5.0.1-v7 Mon Aug 17 10:07:10 MDT 2026
Clazz_declarePackage("JU");
Clazz_load(["JU.T3d"], "JU.V3d", null, function(){
var c$ = Clazz_declareType(JU, "V3d", JU.T3d);
Clazz_defineMethod(c$, "cross", 
function(v1, v2){
this.set(v1.y * v2.z - v1.z * v2.y, v1.z * v2.x - v1.x * v2.z, v1.x * v2.y - v1.y * v2.x);
}, "JU.V3d,JU.V3d");
Clazz_defineMethod(c$, "normalize", 
function(){
var d = this.length();
this.x /= d;
this.y /= d;
this.z /= d;
});
Clazz_defineMethod(c$, "angle", 
function(v1){
var xx = this.y * v1.z - this.z * v1.y;
var yy = this.z * v1.x - this.x * v1.z;
var zz = this.x * v1.y - this.y * v1.x;
var cross = Math.sqrt(xx * xx + yy * yy + zz * zz);
return Math.abs(Math.atan2(cross, this.dot(v1)));
}, "JU.V3d");
Clazz_defineMethod(c$, "dot", 
function(v){
return this.x * v.x + this.y * v.y + this.z * v.z;
}, "JU.V3d");
Clazz_defineMethod(c$, "lengthSquared", 
function(){
return this.x * this.x + this.y * this.y + this.z * this.z;
});
Clazz_defineMethod(c$, "length", 
function(){
return Math.sqrt(this.lengthSquared());
});
});
;//5.0.1-v7 Mon Aug 17 10:07:10 MDT 2026
Clazz_declarePackage("J.adapter.readers.molxyz");
Clazz_load(["J.adapter.smarter.AtomSetCollectionReader"], "J.adapter.readers.molxyz.MolReader", ["java.util.Hashtable", "JU.BS", "$.Lst", "$.PT", "J.adapter.smarter.Atom", "J.api.JmolAdapter", "JU.Logger"], function(){
var c$ = Clazz_decorateAsClass(function(){
this.haveAtomSerials = false;
this.allow2D = true;
this.iatom0 = 0;
this.vr = null;
this.atomCount = 0;
this.atomData = null;
this.bsDeleted = null;
this.haveNonzeroZ = false;
this.fixN = false;
this.is3D = false;
this.nDouble = 0;
this.nH = 0;
this.nC = 0;
Clazz_instantialize(this, arguments);}, J.adapter.readers.molxyz, "MolReader", J.adapter.smarter.AtomSetCollectionReader);
Clazz_overrideMethod(c$, "initializeReader", 
function(){
this.fixN = this.checkFilterKey("FIXN");
});
Clazz_overrideMethod(c$, "checkLine", 
function(){
var isMDL = (this.line.startsWith("$MDL"));
if (isMDL) {
this.discardLinesUntilStartsWith("$HDR");
this.rd();
if (this.line == null) {
JU.Logger.warn("$HDR not found in MDL RG file");
this.continuing = false;
return false;
}} else if (this.line.equals("M  END")) {
return true;
}if (this.doGetModel(++this.modelNumber, null)) {
this.iatom0 = this.asc.ac;
this.processMolSdHeader();
this.processCtab(isMDL);
this.vr = null;
if (this.isLastModel(this.modelNumber)) {
this.continuing = false;
return false;
}}if (this.line != null && this.line.indexOf("$$$$") < 0) this.discardLinesUntilStartsWith("$$$$");
return true;
});
Clazz_overrideMethod(c$, "finalizeSubclassReader", 
function(){
this.finalizeReaderMR();
});
Clazz_defineMethod(c$, "finalizeReaderMR", 
function(){
if (this.fixN) {
this.addJmolScript("{search('[Nv4+0,nv4+0]')}.formalCharge=1;{search('{[Ov1-0]}[Nv4+1,nv4+1]')}.formalCharge=-1;");
}this.check2D3D();
if (this.bsDeleted != null) {
this.asc.getBSAtoms(-1).andNot(this.bsDeleted);
}this.isTrajectory = false;
this.finalizeReaderASCR();
});
Clazz_defineMethod(c$, "check2D3D", 
function(){
if (this.haveNonzeroZ) {
if (this.is2D) {
this.is2D = this.optimize2D = false;
}} else if (!this.is2D && !this.is3D) {
if (this.nC > 0 && this.nH == 0 && this.nDouble != 0) {
this.is2D = true;
}}if (this.is2D) {
if (!this.allow2D) {
throw  new Exception("File is 2D, not 3D");
}this.set2D();
}});
Clazz_defineMethod(c$, "processMolSdHeader", 
function(){
var thisDataSetName = this.line.trim();
this.asc.setCollectionName(thisDataSetName);
var header = this.line + "\n";
this.rd();
if (this.line == null) return;
header += this.line + "\n";
var dim = (this.line.length >= 22 ? this.line.substring(20, 22) : null);
this.is3D = "3D".equals(dim);
this.is2D = !this.is3D && ("2D".equals(dim) || this.line.startsWith("JME "));
this.rd();
if (this.line == null) return;
this.line = this.line.trim();
header += this.line + "\n";
JU.Logger.info(header);
this.checkCurrentLineForScript();
this.asc.setInfo("fileHeader", header);
this.newAtomSet(thisDataSetName);
});
Clazz_defineMethod(c$, "processCtab", 
function(isMDL){
if (isMDL) this.discardLinesUntilStartsWith("$CTAB");
if (this.rd() == null) return;
if (this.line.indexOf("V3000") >= 0) {
this.optimize2D = this.is2D && !this.noHydrogens;
this.vr = (this.getInterface("J.adapter.readers.molxyz.V3000Rdr")).set(this);
this.discardLinesUntilContains("COUNTS");
this.vr.readAtomsAndBonds(this.getTokens());
} else {
this.readAtomsAndBonds(this.parseIntRange(this.line, 0, 3), this.parseIntRange(this.line, 3, 6));
}this.applySymmetryAndSetTrajectory();
}, "~B");
Clazz_defineMethod(c$, "readAtomsAndBonds", 
function(ac, bc){
this.atomCount = ac;
for (var i = 0; i < ac; ++i) {
this.rd();
var len = this.line.length;
var elementSymbol;
var x;
var y;
var z;
var charge = 0;
var isotope = 0;
var iAtom = -2147483648;
x = this.parseFloatRange(this.line, 0, 10);
y = this.parseFloatRange(this.line, 10, 20);
z = this.parseFloatRange(this.line, 20, 30);
if (len < 34) {
elementSymbol = this.line.substring(31).trim();
} else {
elementSymbol = this.line.substring(31, 34).trim();
if (elementSymbol.equals("H1")) {
elementSymbol = "H";
isotope = 1;
}if (len >= 39) {
var code = this.parseIntRange(this.line, 36, 39);
if (code >= 1 && code <= 7) charge = 4 - code;
code = this.parseIntRange(this.line, 34, 36);
if (code != 0 && code >= -3 && code <= 4) {
isotope = J.api.JmolAdapter.getNaturalIsotope(J.api.JmolAdapter.getElementNumber(elementSymbol)) + code;
}if (iAtom == -2147483648 && this.haveAtomSerials) iAtom = i + 1;
}}this.addMolAtom(iAtom, isotope, elementSymbol, charge, x, y, z);
}
this.asc.setModelInfoForSet("dimension", (this.is2D ? "2D" : "3D"), this.asc.iSet);
this.rd();
if (this.line.startsWith("V  ")) {
this.readAtomValues();
}if (bc == 0) this.asc.setNoAutoBond();
for (var i = 0; i < bc; ++i) {
if (i > 0) this.rd();
var iAtom1;
var iAtom2;
var stereo = 0;
iAtom1 = this.line.substring(0, 3).trim();
iAtom2 = this.line.substring(3, 6).trim();
var order = this.parseIntRange(this.line, 6, 9);
if (order == 1 && this.line.length >= 12) stereo = this.parseIntRange(this.line, 9, 12);
if (stereo != 0 && !this.is3D) this.is2D = true;
order = this.fixOrder(order, stereo);
if (this.haveAtomSerials) this.asc.addNewBondFromNames(iAtom1, iAtom2, order);
 else this.asc.addNewBondWithOrder(this.iatom0 + this.parseIntStr(iAtom1) - 1, this.iatom0 + this.parseIntStr(iAtom2) - 1, order);
}
var molData =  new java.util.Hashtable();
var _keyList =  new JU.Lst();
this.rd();
while (this.line != null && this.line.indexOf("$$$$") != 0) {
if (this.line.indexOf(">") == 0) {
this.readMolData(molData, _keyList);
continue;
}if (this.line.startsWith("M  ISO")) {
this.readIsotopes();
continue;
}if (this.line.startsWith("M  CHG")) {
this.readCharges();
continue;
}this.rd();
}
if (this.atomData != null) {
var atomValueName = molData.get("atom_value_name");
molData.put(atomValueName == null ? "atom_values" : atomValueName.toString(), this.atomData);
}if (!molData.isEmpty()) {
this.asc.setCurrentModelInfo("molDataKeys", _keyList);
this.asc.setCurrentModelInfo("molData", molData);
}}, "~N,~N");
Clazz_defineMethod(c$, "readAtomValues", 
function(){
this.atomData =  new Array(this.atomCount);
for (var i = this.atomData.length; --i >= 0; ) this.atomData[i] = "";

while (this.line.indexOf("V  ") == 0) {
var iAtom = this.parseIntAt(this.line, 3);
if (iAtom < 1 || iAtom > this.atomCount) {
JU.Logger.error("V  nnn does not evalute to a valid atom number: " + iAtom);
return;
}var s = this.line.substring(6).trim();
this.atomData[iAtom - 1] = s;
this.rd();
}
});
Clazz_defineMethod(c$, "readIsotopes", 
function(){
try {
var n = this.parseIntAt(this.line, 6);
var i0 = this.asc.getLastAtomSetAtomIndex();
for (var i = 0, pt = 9; i < n; i++) {
var ipt = this.parseIntAt(this.line, pt);
var atom = this.asc.atoms[ipt + i0 - 1];
var iso = this.parseIntAt(this.line, pt + 4);
pt += 8;
var sym = JU.PT.replaceAllCharacters(atom.elementSymbol, "0123456789", "");
if (iso == 17 && sym.equals("C")) {
atom.elementSymbol = "N";
} else if (iso == 5 && sym.equals("H")) {
this.deleteAtom(atom);
} else {
atom.elementSymbol = "" + iso + sym;
}}
} catch (e) {
}
this.rd();
});
Clazz_defineMethod(c$, "readCharges", 
function(){
try {
var n = this.parseIntAt(this.line, 6);
var i0 = this.asc.getLastAtomSetAtomIndex();
for (var i = this.asc.ac; --i >= i0; ) {
this.asc.atoms[i].formalCharge = 0;
}
for (var i = 0, pt = 9; i < n; i++, pt += 8) {
this.asc.atoms[this.parseIntAt(this.line, pt) + i0 - 1].formalCharge = this.parseIntAt(this.line, pt + 4);
}
} catch (e) {
}
this.rd();
});
Clazz_defineMethod(c$, "deleteAtom", 
function(atom){
if (this.bsDeleted == null) this.bsDeleted =  new JU.BS();
this.bsDeleted.set(atom.index);
}, "J.adapter.smarter.Atom");
Clazz_defineMethod(c$, "readMolData", 
function(molData, _keyList){
var atoms = this.asc.atoms;
var dataName = JU.PT.trim(this.line, "> <").toLowerCase();
var data = "";
var fdata = null;
while (this.rd() != null && !this.line.equals("$$$$") && this.line.length > 0) data += (this.line.length == 81 && this.line.charAt(80) == '+' ? this.line.substring(0, 80) : this.line + "\n");

data = JU.PT.trim(data, "\n");
JU.Logger.info(dataName + ":" + JU.PT.esc(data));
molData.put(dataName, data);
_keyList.addLast(dataName);
var ndata = 0;
if (dataName.toUpperCase().contains("_PARTIAL_CHARGES")) {
try {
fdata = JU.PT.parseFloatArray(data);
for (var i = this.asc.getLastAtomSetAtomIndex(), n = this.asc.ac; i < n; i++) atoms[i].partialCharge = 0;

var pt = 0;
for (var i = Clazz_floatToInt(fdata[pt++]); --i >= 0; ) {
var atomIndex = Clazz_floatToInt(fdata[pt++]) + this.iatom0 - 1;
var partialCharge = fdata[pt++];
atoms[atomIndex].partialCharge = partialCharge;
ndata++;
}
} catch (e) {
for (var i = this.asc.getLastAtomSetAtomIndex(), n = this.asc.ac; i < n; i++) atoms[i].partialCharge = 0;

JU.Logger.error("error reading " + dataName + " field -- partial charges cleared");
}
JU.Logger.info(ndata + " partial charges read");
} else if (dataName.toUpperCase().contains("ATOM_NAMES")) {
ndata = 0;
try {
var tokens = JU.PT.getTokens(data);
var pt = 0;
for (var i = this.parseIntStr(tokens[pt++]); --i >= 0; ) {
var iatom;
while ((iatom = this.parseIntStr(tokens[pt++])) == -2147483648) {
}
var atomIndex = iatom + this.iatom0 - 1;
var name = tokens[pt++];
if (!name.equals(".")) atoms[atomIndex].atomName = name;
ndata++;
}
} catch (e) {
JU.Logger.error("error reading " + dataName + " field");
}
JU.Logger.info(ndata + " atom names read");
}}, "java.util.Map,JU.Lst");
Clazz_defineMethod(c$, "addMolAtom", 
function(iAtom, isotope, elementSymbol, charge, x, y, z){
if ("H".equals(elementSymbol)) this.nH++;
 else if ("C".equals(elementSymbol)) this.nC++;
this.haveNonzeroZ = new Boolean (this.haveNonzeroZ | (Math.abs(z) > 0.001)).valueOf();
switch (isotope) {
case 0:
break;
case 1:
elementSymbol = "1H";
break;
case 2:
elementSymbol = "2H";
break;
case 3:
elementSymbol = "3H";
break;
default:
elementSymbol = isotope + elementSymbol;
}
var atom =  new J.adapter.smarter.Atom();
atom.elementSymbol = elementSymbol;
atom.formalCharge = charge;
this.setAtomCoordXYZ(atom, x, y, z);
if (iAtom == -2147483648) {
this.asc.addAtom(atom);
} else {
this.haveAtomSerials = true;
atom.atomSerial = iAtom;
this.asc.addAtomWithMappedSerialNumber(atom);
}return atom;
}, "~N,~N,~S,~N,~N,~N,~N");
Clazz_defineMethod(c$, "fixOrder", 
function(order, stereo){
switch (order) {
default:
case 0:
case -10:
return 1;
case 1:
switch (stereo) {
case 1:
this.is2D = true;
return 1025;
case 3:
case 6:
this.is2D = true;
return 1041;
case 2:
case 4:
this.is2D = true;
return 1057;
}
break;
case 2:
case 3:
this.nDouble++;
break;
case 4:
return 515;
case 5:
return 66;
case 6:
return 513;
case 7:
return 514;
case 8:
case 9:
return 33;
case 14:
return 4;
case 15:
return 5;
case 16:
return 6;
}
return order;
}, "~N,~N");
Clazz_defineMethod(c$, "addMolBond", 
function(iAtom1, iAtom2, order, stereo){
order = this.fixOrder(order, stereo);
if (this.haveAtomSerials) return this.asc.addNewBondFromNames(iAtom1, iAtom2, order);
return this.asc.addNewBondWithOrder(this.iatom0 + this.parseIntStr(iAtom1) - 1, this.iatom0 + this.parseIntStr(iAtom2) - 1, order);
}, "~S,~S,~N,~N");
});
;//5.0.1-v7 Mon Aug 24 09:29:37 CDT 2026
Clazz_declarePackage("J.adapter.readers.molxyz");
Clazz_load(["J.adapter.smarter.AtomSetCollectionReader"], "J.adapter.readers.molxyz.XyzReader", ["JU.Logger"], function(){
var c$ = Clazz_declareType(J.adapter.readers.molxyz, "XyzReader", J.adapter.smarter.AtomSetCollectionReader);
Clazz_overrideMethod(c$, "checkLine", 
function(){
var modelAtomCount = this.parseIntStr(this.line);
if (modelAtomCount == -2147483648) {
this.continuing = false;
return false;
}this.vibrationNumber = ++this.modelNumber;
if (this.desiredVibrationNumber <= 0 ? this.doGetModel(this.modelNumber, null) : this.doGetVibration(this.vibrationNumber)) {
this.rd();
this.checkCurrentLineForScript();
this.asc.newAtomSet();
var name = this.line.trim();
this.readAtoms(modelAtomCount);
this.applySymmetryAndSetTrajectory();
this.asc.setAtomSetName(name);
if (this.isLastModel(this.modelNumber)) {
this.continuing = false;
return false;
}} else {
this.skipAtomSet(modelAtomCount);
}this.discardLinesUntilNonBlank();
return false;
});
Clazz_overrideMethod(c$, "finalizeSubclassReader", 
function(){
this.isTrajectory = false;
this.finalizeReaderASCR();
});
Clazz_defineMethod(c$, "skipAtomSet", 
function(modelAtomCount){
this.rd();
for (var i = modelAtomCount; --i >= 0; ) this.rd();

}, "~N");
Clazz_defineMethod(c$, "readAtoms", 
function(modelAtomCount){
for (var i = 0; i < modelAtomCount; ++i) {
this.rd();
var tokens = this.getTokens();
if (tokens.length < 4) {
JU.Logger.warn("line cannot be read for XYZ atom data: " + this.line);
continue;
}var atom = this.addAtomXYZSymName(tokens, 1, null, null);
this.setElementAndIsotope(atom, tokens[0]);
var vpt = 4;
switch (tokens.length) {
case 4:
continue;
case 5:
case 6:
case 8:
case 9:
if (tokens[4].indexOf(".") >= 0) {
atom.partialCharge = this.parseFloatStr(tokens[4]);
} else {
var charge = this.parseIntStr(tokens[4]);
if (charge != -2147483648) atom.formalCharge = charge;
}switch (tokens.length) {
case 5:
continue;
case 6:
atom.radius = this.parseFloatStr(tokens[5]);
continue;
case 9:
atom.atomSerial = this.parseIntStr(tokens[8]);
}
vpt++;
default:
var vx = this.parseFloatStr(tokens[vpt++]);
var vy = this.parseFloatStr(tokens[vpt++]);
var vz = this.parseFloatStr(tokens[vpt++]);
if (Float.isNaN(vx) || Float.isNaN(vy) || Float.isNaN(vz)) continue;
this.asc.addVibrationVector(atom.index, vx, vy, vz);
}
}
}, "~N");
});
;//5.0.1-v7 Mon Aug 24 09:29:37 CDT 2026
Clazz_declarePackage("J.adapter.smarter");
Clazz_load(["JU.P3"], "J.adapter.smarter.Atom", ["JU.AU", "$.Lst", "$.V3"], function(){
var c$ = Clazz_decorateAsClass(function(){
this.atomSetIndex = 0;
this.index = 0;
this.bsSymmetry = null;
this.atomSite = 0;
this.elementSymbol = null;
this.elementNumber = -1;
this.atomName = null;
this.formalCharge = -2147483648;
this.partialCharge = NaN;
this.vib = null;
this.bfactor = NaN;
this.foccupancy = 1;
this.radius = NaN;
this.isHetero = false;
this.atomSerial = -2147483648;
this.chainID = 0;
this.seqIdOrWyckoffCode = 0;
this.bondingRadius = NaN;
this.altLoc = '\0';
this.group3 = null;
this.sequenceNumber = -2147483648;
this.insertionCode = '\0';
this.anisoBorU = null;
this.tensors = null;
this.typeSymbol = null;
this.part = 0;
Clazz_instantialize(this, arguments);}, J.adapter.smarter, "Atom", JU.P3, Cloneable);
Clazz_makeConstructor(c$, 
function(){
Clazz_superConstructor (this, J.adapter.smarter.Atom, []);
this.set(NaN, NaN, NaN);
});
Clazz_defineMethod(c$, "addTensor", 
function(tensor, type, reset){
if (tensor == null) return null;
if (reset || this.tensors == null) this.tensors =  new JU.Lst();
this.tensors.addLast(tensor);
if (type != null) tensor.setType(type);
return tensor;
}, "JU.Tensor,~S,~B");
Clazz_defineMethod(c$, "getClone", 
function(){
var a;
try {
a = this.clone();
} catch (e) {
if (Clazz_exceptionOf(e,"CloneNotSupportedException")){
return null;
} else {
throw e;
}
}
if (this.vib != null) {
if (Clazz_instanceOf(this.vib,"JU.Vibration")) {
a.vib = (this.vib).clone();
} else {
a.vib = JU.V3.newV(a.vib);
}}if (this.anisoBorU != null) a.anisoBorU = JU.AU.arrayCopyF(this.anisoBorU, -1);
if (this.tensors != null) {
a.tensors =  new JU.Lst();
for (var i = this.tensors.size(); --i >= 0; ) a.tensors.addLast((this.tensors.get(i)).copyTensor());

}return a;
});
Clazz_defineMethod(c$, "getElementSymbol", 
function(){
if (this.elementSymbol == null && this.atomName != null) {
var len = this.atomName.length;
var ichFirst = 0;
var chFirst = String.fromCharCode(0);
while (ichFirst < len && !J.adapter.smarter.Atom.isValidSymChar1(chFirst = this.atomName.charAt(ichFirst))) ++ichFirst;

switch (len - ichFirst) {
case 0:
break;
default:
var chSecond = this.atomName.charAt(ichFirst + 1);
if (J.adapter.smarter.Atom.isValidSymNoCase(chFirst, chSecond)) {
this.elementSymbol = "" + chFirst + chSecond;
break;
}case 1:
if (J.adapter.smarter.Atom.isValidSym1(chFirst)) this.elementSymbol = "" + chFirst;
break;
}
}return this.elementSymbol;
});
c$.isValidSym1 = Clazz_defineMethod(c$, "isValidSym1", 
function(ch){
return (ch >= 'A' && ch <= 'Z' && J.adapter.smarter.Atom.elementCharMasks[ch.charCodeAt(0) - 65] < 0);
}, "~S");
c$.isValidSym2 = Clazz_defineMethod(c$, "isValidSym2", 
function(ch1, ch2){
return (ch1 >= 'A' && ch1 <= 'Z' && ch2 >= 'a' && ch2 <= 'z' && ((J.adapter.smarter.Atom.elementCharMasks[ch1.charCodeAt(0) - 65] >> (ch2.charCodeAt(0) - 97)) & 1) != 0);
}, "~S,~S");
c$.isValidSymNoCase = Clazz_defineMethod(c$, "isValidSymNoCase", 
function(ch1, ch2){
return J.adapter.smarter.Atom.isValidSym2(ch1, ch2 < 'a' ? String.fromCharCode(ch2.charCodeAt(0) + 32) : ch2);
}, "~S,~S");
c$.isValidSymChar1 = Clazz_defineMethod(c$, "isValidSymChar1", 
function(ch){
return (ch >= 'A' && ch <= 'Z' && J.adapter.smarter.Atom.elementCharMasks[ch.charCodeAt(0) - 65] != 0);
}, "~S");
Clazz_defineMethod(c$, "copyTo", 
function(pt, asc){
var a = asc.newCloneAtom(this);
a.setT(pt);
return a;
}, "JU.P3,J.adapter.smarter.AtomSetCollection");
Clazz_defineMethod(c$, "getMult", 
function(){
return (this.seqIdOrWyckoffCode >> 16) & 0xEFFF;
});
c$.elementCharMasks =  Clazz_newIntArray(-1, [1972292, -2147351151, -2146019271, -2130706430, 1441792, -2147348464, 25, -2147205008, -2147344384, 0, -2147352576, 1179905, 548936, -2147434213, -2147221504, -2145759221, 0, 1056947, -2147339946, -2147477097, -2147483648, -2147483648, -2147483648, 8388624, -2147483646, 139264]);
});
;//5.0.1-v7 Mon Aug 17 10:07:10 MDT 2026
Clazz_declarePackage("J.adapter.smarter");
Clazz_load(["J.api.JmolAdapterAtomIterator"], "J.adapter.smarter.AtomIterator", ["J.api.JmolAdapter"], function(){
var c$ = Clazz_decorateAsClass(function(){
this.iatom = 0;
this.atom = null;
this.ac = 0;
this.atoms = null;
this.bsAtoms = null;
Clazz_instantialize(this, arguments);}, J.adapter.smarter, "AtomIterator", null, J.api.JmolAdapterAtomIterator);
Clazz_makeConstructor(c$, 
function(asc){
this.ac = asc.ac;
this.atoms = asc.atoms;
this.bsAtoms = asc.bsAtoms;
this.iatom = 0;
}, "J.adapter.smarter.AtomSetCollection");
Clazz_overrideMethod(c$, "hasNext", 
function(){
if (this.iatom == this.ac) return false;
while ((this.atom = this.atoms[this.iatom++]) == null || (this.bsAtoms != null && !this.bsAtoms.get(this.atom.index))) if (this.iatom == this.ac) return false;

this.atoms[this.iatom - 1] = null;
return true;
});
Clazz_overrideMethod(c$, "getAtomSetIndex", 
function(){
return this.atom.atomSetIndex;
});
Clazz_overrideMethod(c$, "getSymmetry", 
function(){
return this.atom.bsSymmetry;
});
Clazz_overrideMethod(c$, "getAtomSite", 
function(){
return this.atom.atomSite + 1;
});
Clazz_overrideMethod(c$, "getUniqueID", 
function(){
return Integer.$valueOf(this.atom.index);
});
Clazz_overrideMethod(c$, "getElementNumber", 
function(){
return (this.atom.elementNumber > 0 ? this.atom.elementNumber : J.api.JmolAdapter.getElementNumber(this.atom.getElementSymbol()));
});
Clazz_overrideMethod(c$, "getAtomName", 
function(){
return this.atom.atomName;
});
Clazz_overrideMethod(c$, "getFormalCharge", 
function(){
return (this.atom.formalCharge == -2147483648 ? 0 : this.atom.formalCharge);
});
Clazz_overrideMethod(c$, "getPartialCharge", 
function(){
return this.atom.partialCharge;
});
Clazz_overrideMethod(c$, "getTensors", 
function(){
return this.atom.tensors;
});
Clazz_overrideMethod(c$, "getRadius", 
function(){
return this.atom.radius;
});
Clazz_overrideMethod(c$, "getBondRadius", 
function(){
return this.atom.bondingRadius;
});
Clazz_overrideMethod(c$, "getVib", 
function(){
return (this.atom.vib == null || Float.isNaN(this.atom.vib.z) ? null : this.atom.vib);
});
Clazz_overrideMethod(c$, "getSeqID", 
function(){
return ((this.atom.seqIdOrWyckoffCode & (-2147483648)) == (-2147483648) ? this.atom.seqIdOrWyckoffCode & 2147483647 : 0);
});
Clazz_overrideMethod(c$, "getBfactor", 
function(){
return this.atom.bfactor;
});
Clazz_overrideMethod(c$, "getOccupancy", 
function(){
return this.atom.foccupancy * 100;
});
Clazz_overrideMethod(c$, "getIsHetero", 
function(){
return this.atom.isHetero;
});
Clazz_overrideMethod(c$, "getSerial", 
function(){
return this.atom.atomSerial;
});
Clazz_overrideMethod(c$, "getChainID", 
function(){
return this.atom.chainID;
});
Clazz_overrideMethod(c$, "getAltLoc", 
function(){
return J.api.JmolAdapter.canonizeAlternateLocationID(this.atom.altLoc);
});
Clazz_overrideMethod(c$, "getGroup3", 
function(){
return this.atom.group3;
});
Clazz_overrideMethod(c$, "getSequenceNumber", 
function(){
return this.atom.sequenceNumber;
});
Clazz_overrideMethod(c$, "getInsertionCode", 
function(){
return J.api.JmolAdapter.canonizeInsertionCode(this.atom.insertionCode);
});
Clazz_overrideMethod(c$, "getXYZ", 
function(){
return this.atom;
});
Clazz_overrideMethod(c$, "getElement", 
function(){
return this.getElementNumber() & 0x7F;
});
Clazz_overrideMethod(c$, "getIsotope", 
function(){
return this.getElementNumber() >> 7;
});
Clazz_overrideMethod(c$, "getPart", 
function(){
return this.atom.part;
});
});
;//5.0.1-v7 Mon Aug 17 10:07:10 MDT 2026
Clazz_declarePackage("J.adapter.smarter");
Clazz_load(["java.util.Hashtable"], "J.adapter.smarter.AtomSetCollection", ["java.util.Collections", "$.Properties", "JU.AU", "$.BS", "$.Lst", "$.P3", "$.V3", "J.adapter.smarter.Atom", "$.Bond", "$.SmarterJmolAdapter", "J.api.Interface", "JU.BSUtil", "$.Logger", "JV.JC"], function(){
var c$ = Clazz_decorateAsClass(function(){
this.reader = null;
this.bsAtoms = null;
this.fileTypeName = null;
this.collectionName = null;
this.atomSetInfo = null;
this.atoms = null;
this.ac = 0;
this.bonds = null;
this.bondCount = 0;
this.structures = null;
this.structureCount = 0;
this.atomSetCount = 0;
this.iSet = -1;
this.atomSetNumbers = null;
this.atomSetAtomIndexes = null;
this.atomSetAtomCounts = null;
this.atomSetBondCounts = null;
this.atomSetAuxiliaryInfo = null;
this.errorMessage = null;
this.coordinatesAreFractional = false;
this.isTrajectory = false;
this.trajectoryStepCount = 0;
this.trajectorySteps = null;
this.vibrationSteps = null;
this.trajectoryNames = null;
this.doFixPeriodic = false;
this.allowMultiple = false;
this.readerList = null;
this.atomMapAnyCase = false;
this.fixedSite = 0;
this.bsStructuredModels = null;
this.haveAnisou = false;
this.baseSymmetryAtomCount = 0;
this.crystalReaderLatticeOpsOnly = false;
this.xtalSymmetry = null;
this.bondIndex0 = 0;
this.atomSymbolicMap = null;
this.haveUnitCell = false;
this.vibScale = 0;
this.firstAtomToBond = -1;
this.isConSurf = null;
Clazz_instantialize(this, arguments);}, J.adapter.smarter, "AtomSetCollection", null);
Clazz_prepareFields (c$, function(){
this.atomSetInfo =  new java.util.Hashtable();
this.atoms =  new Array(256);
this.bonds =  new Array(256);
this.structures =  new Array(16);
this.atomSetNumbers =  Clazz_newIntArray (16, 0);
this.atomSetAtomIndexes =  Clazz_newIntArray (16, 0);
this.atomSetAtomCounts =  Clazz_newIntArray (16, 0);
this.atomSetBondCounts =  Clazz_newIntArray (16, 0);
this.atomSetAuxiliaryInfo =  new Array(16);
this.atomSymbolicMap =  new java.util.Hashtable();
});
Clazz_makeConstructor(c$, 
function(fileTypeName, reader, array, list){
this.fileTypeName = fileTypeName;
this.reader = reader;
this.allowMultiple = (reader == null || reader.desiredVibrationNumber < 0);
var p =  new java.util.Properties();
p.put("PATH_KEY", ".PATH");
p.put("PATH_SEPARATOR", J.adapter.smarter.SmarterJmolAdapter.PATH_SEPARATOR);
this.setInfo("properties", p);
if (reader != null) {
var ii = reader.htParams.get("appendToModelIndex");
if (ii != null) this.setInfo("appendToModelIndex", ii);
ii = reader.htParams.get("fixedSite");
if (ii != null) this.fixedSite = ii.intValue();
}if (array != null) {
var n = 0;
this.readerList =  new JU.Lst();
for (var i = 0; i < array.length; i++) if (array[i] != null && (array[i].ac > 0 || array[i].reader != null && array[i].reader.mustFinalizeModelSet)) this.appendAtomSetCollection(n++, array[i]);

if (n > 1) this.setInfo("isMultiFile", Boolean.TRUE);
} else if (list != null) {
this.setInfo("isMultiFile", Boolean.TRUE);
this.appendAtomSetCollectionList(list);
}}, "~S,J.adapter.smarter.AtomSetCollectionReader,~A,JU.Lst");
Clazz_defineMethod(c$, "setCollectionName", 
function(collectionName){
if (collectionName != null && (collectionName = collectionName.trim()).length > 0) this.collectionName = collectionName;
}, "~S");
Clazz_defineMethod(c$, "clearGlobalBoolean", 
function(globalIndex){
this.atomSetInfo.remove(JV.JC.getBoolName(globalIndex));
}, "~N");
Clazz_defineMethod(c$, "setGlobalBoolean", 
function(globalIndex){
this.setInfo(JV.JC.getBoolName(globalIndex), Boolean.TRUE);
}, "~N");
Clazz_defineMethod(c$, "getGlobalBoolean", 
function(globalIndex){
return (this.atomSetInfo.get(JV.JC.getBoolName(globalIndex)) === Boolean.TRUE);
}, "~N");
Clazz_defineMethod(c$, "appendAtomSetCollectionList", 
function(list){
var n = list.size();
if (n == 0) {
this.errorMessage = "No file found!";
return;
}for (var i = 0; i < n; i++) {
var o = list.get(i);
if (Clazz_instanceOf(o,"JU.Lst")) this.appendAtomSetCollectionList(o);
 else this.appendAtomSetCollection(i, o);
}
}, "JU.Lst");
Clazz_defineMethod(c$, "setTrajectory", 
function(){
if (!this.isTrajectory) this.trajectorySteps =  new JU.Lst();
this.isTrajectory = true;
var n = (this.bsAtoms == null ? this.ac : this.bsAtoms.cardinality());
if (n <= 1) return;
var trajectoryStep =  new Array(n);
var haveVibrations = (n > 0 && this.atoms[0].vib != null && !Float.isNaN(this.atoms[0].vib.z));
var vibrationStep = (haveVibrations ?  new Array(n) : null);
var prevSteps = (this.trajectoryStepCount == 0 ? null : this.trajectorySteps.get(this.trajectoryStepCount - 1));
for (var i = 0, ii = 0; i < this.ac; i++) {
if (this.bsAtoms != null && !this.bsAtoms.get(i)) continue;
var pt = JU.P3.newP(this.atoms[i]);
if (this.doFixPeriodic && prevSteps != null) pt = J.adapter.smarter.AtomSetCollection.fixPeriodic(pt, prevSteps[i]);
trajectoryStep[ii] = pt;
if (haveVibrations) vibrationStep[ii] = this.atoms[i].vib;
ii++;
}
if (haveVibrations) {
if (this.vibrationSteps == null) {
this.vibrationSteps =  new JU.Lst();
for (var i = 0; i < this.trajectoryStepCount; i++) this.vibrationSteps.addLast(null);

}this.vibrationSteps.addLast(vibrationStep);
}this.trajectorySteps.addLast(trajectoryStep);
this.trajectoryStepCount++;
});
Clazz_defineMethod(c$, "appendAtomSetCollection", 
function(collectionIndex, collection){
if (collection.reader != null && collection.reader.mustFinalizeModelSet) this.readerList.addLast(collection.reader);
var existingAtomsCount = this.ac;
this.setInfo("loadState", collection.atomSetInfo.get("loadState"));
if (collection.bsAtoms != null) {
this.getBSAtoms(0);
for (var i = collection.bsAtoms.nextSetBit(0); i >= 0; i = collection.bsAtoms.nextSetBit(i + 1)) this.bsAtoms.set(existingAtomsCount + i);

}var clonedAtoms = 0;
var atomSetCount0 = this.atomSetCount;
for (var atomSetNum = 0; atomSetNum < collection.atomSetCount; atomSetNum++) {
this.newAtomSet();
var info = this.atomSetAuxiliaryInfo[this.iSet] = collection.atomSetAuxiliaryInfo[atomSetNum];
var atomInfo = info.get("PDB_CONECT_firstAtom_count_max");
if (atomInfo != null) atomInfo[0] += existingAtomsCount;
this.setCurrentModelInfo("title", collection.collectionName);
this.setAtomSetName(collection.getAtomSetName(atomSetNum));
for (var atomNum = 0; atomNum < collection.atomSetAtomCounts[atomSetNum]; atomNum++) {
if (this.bsAtoms != null) this.bsAtoms.set(this.ac);
this.newCloneAtom(collection.atoms[clonedAtoms]);
clonedAtoms++;
}
this.atomSetNumbers[this.iSet] = (collectionIndex < 0 ? this.iSet + 1 : ((collectionIndex + 1) * 1000000) + collection.atomSetNumbers[atomSetNum]);
}
for (var bondNum = 0; bondNum < collection.bondCount; bondNum++) {
var bond = collection.bonds[bondNum];
this.addNewBondWithOrder(bond.atomIndex1 + existingAtomsCount, bond.atomIndex2 + existingAtomsCount, bond.order);
}
for (var i = JV.JC.globalBooleans.length; --i >= 0; ) if (collection.getGlobalBoolean(i)) this.setGlobalBoolean(i);

for (var i = 0; i < collection.structureCount; i++) {
var s = collection.structures[i];
this.addStructure(s);
s.modelStartEnd[0] += atomSetCount0;
s.modelStartEnd[1] += atomSetCount0;
}
}, "~N,J.adapter.smarter.AtomSetCollection");
Clazz_defineMethod(c$, "setNoAutoBond", 
function(){
this.setInfo("noAutoBond", Boolean.TRUE);
});
Clazz_defineMethod(c$, "freeze", 
function(reverseModels){
if (this.atomSetCount == 1 && this.collectionName == null) this.collectionName = this.getAtomSetAuxiliaryInfoValue(0, "name");
if (reverseModels) this.reverseAtomSets();
if (this.trajectoryStepCount > 1) this.finalizeTrajectory();
this.getList(true);
this.getList(false);
for (var i = 0; i < this.atomSetCount; i++) {
this.setModelInfoForSet("initialAtomCount", Integer.$valueOf(this.atomSetAtomCounts[i]), i);
this.setModelInfoForSet("initialBondCount", Integer.$valueOf(this.atomSetBondCounts[i]), i);
}
}, "~B");
Clazz_defineMethod(c$, "reverseAtomSets", 
function(){
this.reverseArray(this.atomSetAtomIndexes);
this.reverseArray(this.atomSetNumbers);
this.reverseArray(this.atomSetAtomCounts);
this.reverseArray(this.atomSetBondCounts);
J.adapter.smarter.AtomSetCollection.reverseList(this.trajectorySteps);
J.adapter.smarter.AtomSetCollection.reverseList(this.trajectoryNames);
J.adapter.smarter.AtomSetCollection.reverseList(this.vibrationSteps);
this.reverseObject(this.atomSetAuxiliaryInfo);
for (var i = 0; i < this.ac; i++) this.atoms[i].atomSetIndex = this.atomSetCount - 1 - this.atoms[i].atomSetIndex;

for (var i = 0; i < this.structureCount; i++) {
var m = this.structures[i].modelStartEnd[0];
if (m >= 0) {
this.structures[i].modelStartEnd[0] = this.atomSetCount - 1 - this.structures[i].modelStartEnd[1];
this.structures[i].modelStartEnd[1] = this.atomSetCount - 1 - m;
}}
for (var i = 0; i < this.bondCount; i++) this.bonds[i].atomSetIndex = this.atomSetCount - 1 - this.atoms[this.bonds[i].atomIndex1].atomSetIndex;

this.reverseSets(this.bonds, this.bondCount);
var lists = JU.AU.createArrayOfArrayList(this.atomSetCount);
for (var i = 0; i < this.atomSetCount; i++) lists[i] =  new JU.Lst();

for (var i = 0; i < this.ac; i++) lists[this.atoms[i].atomSetIndex].addLast(this.atoms[i]);

var newIndex =  Clazz_newIntArray (this.ac, 0);
var n = this.ac;
for (var i = this.atomSetCount; --i >= 0; ) for (var j = lists[i].size(); --j >= 0; ) {
var a = this.atoms[--n] = lists[i].get(j);
newIndex[a.index] = n;
a.index = n;
}

for (var i = 0; i < this.bondCount; i++) {
this.bonds[i].atomIndex1 = newIndex[this.bonds[i].atomIndex1];
this.bonds[i].atomIndex2 = newIndex[this.bonds[i].atomIndex2];
}
for (var i = 0; i < this.atomSetCount; i++) {
var conect = this.getAtomSetAuxiliaryInfoValue(i, "PDB_CONECT_firstAtom_count_max");
if (conect == null) continue;
conect[0] = newIndex[conect[0]];
conect[1] = this.atomSetAtomCounts[i];
}
});
Clazz_defineMethod(c$, "reverseSets", 
function(o, n){
var lists = JU.AU.createArrayOfArrayList(this.atomSetCount);
for (var i = 0; i < this.atomSetCount; i++) lists[i] =  new JU.Lst();

for (var i = 0; i < n; i++) {
var index = o[i].atomSetIndex;
if (index < 0) return;
lists[o[i].atomSetIndex].addLast(o[i]);
}
for (var i = this.atomSetCount; --i >= 0; ) for (var j = lists[i].size(); --j >= 0; ) o[--n] = lists[i].get(j);


}, "~A,~N");
Clazz_defineMethod(c$, "reverseObject", 
function(o){
var n = this.atomSetCount;
for (var i = Clazz_doubleToInt(n / 2); --i >= 0; ) JU.AU.swap(o, i, n - 1 - i);

}, "~A");
c$.reverseList = Clazz_defineMethod(c$, "reverseList", 
function(list){
if (list == null) return;
java.util.Collections.reverse(list);
}, "JU.Lst");
Clazz_defineMethod(c$, "reverseArray", 
function(a){
var n = this.atomSetCount;
for (var i = Clazz_doubleToInt(n / 2); --i >= 0; ) JU.AU.swapInt(a, i, n - 1 - i);

}, "~A");
Clazz_defineMethod(c$, "getList", 
function(isAltLoc){
var i;
for (i = this.ac; --i >= 0; ) if (this.atoms[i] != null && (isAltLoc ? this.atoms[i].altLoc : this.atoms[i].insertionCode) != '\0') break;

if (i < 0) return;
var lists =  new Array(this.atomSetCount);
for (i = 0; i < this.atomSetCount; i++) lists[i] = "";

var pt;
for (i = 0; i < this.ac; i++) {
if (this.atoms[i] == null) continue;
var id = (isAltLoc ? this.atoms[i].altLoc : this.atoms[i].insertionCode);
if (id != '\0' && lists[pt = this.atoms[i].atomSetIndex].indexOf(id) < 0) lists[pt] += id;
}
var type = (isAltLoc ? "altLocs" : "insertionCodes");
for (i = 0; i < this.atomSetCount; i++) if (lists[i].length > 0) this.setModelInfoForSet(type, lists[i], i);

}, "~B");
Clazz_defineMethod(c$, "finish", 
function(){
if (this.reader != null) this.reader.finalizeModelSet();
 else if (this.readerList != null) for (var i = 0; i < this.readerList.size(); i++) this.readerList.get(i).finalizeModelSet();

this.atoms = null;
this.atomSetAtomCounts =  Clazz_newIntArray (16, 0);
this.atomSetAuxiliaryInfo =  new Array(16);
this.atomSetInfo =  new java.util.Hashtable();
this.atomSetCount = 0;
this.atomSetNumbers =  Clazz_newIntArray (16, 0);
this.atomSymbolicMap =  new java.util.Hashtable();
this.bonds = null;
this.iSet = -1;
this.readerList = null;
this.xtalSymmetry = null;
this.structures =  new Array(16);
this.structureCount = 0;
this.trajectorySteps = null;
this.vibrationSteps = null;
});
Clazz_defineMethod(c$, "discardPreviousAtoms", 
function(){
for (var i = this.ac; --i >= 0; ) this.atoms[i] = null;

this.ac = 0;
this.clearMap();
this.atomSetCount = 0;
this.iSet = -1;
for (var i = this.atomSetAuxiliaryInfo.length; --i >= 0; ) {
this.atomSetAtomCounts[i] = 0;
this.atomSetBondCounts[i] = 0;
this.atomSetAuxiliaryInfo[i] = null;
}
});
Clazz_defineMethod(c$, "removeCurrentAtomSet", 
function(){
if (this.iSet < 0) return;
var ai = this.atomSetAtomIndexes[this.iSet];
if (this.bsAtoms != null) this.bsAtoms.clearBits(ai, this.ac);
this.ac = ai;
this.atomSetAtomCounts[this.iSet] = 0;
this.iSet--;
this.atomSetCount--;
this.reader.doCheckUnitCell = false;
});
Clazz_defineMethod(c$, "getHydrogenAtomCount", 
function(){
var n = 0;
for (var i = 0; i < this.ac; i++) if (this.atoms[i].elementNumber == 1 || this.atoms[i].elementSymbol.equals("H")) n++;

return n;
});
Clazz_defineMethod(c$, "newCloneAtom", 
function(atom){
var clone = atom.getClone();
this.addAtom(clone);
return clone;
}, "J.adapter.smarter.Atom");
Clazz_defineMethod(c$, "cloneFirstAtomSet", 
function(atomCount){
if (!this.allowMultiple) return 0;
this.newAtomSet();
if (atomCount == 0) atomCount = this.atomSetAtomCounts[0];
for (var i = 0; i < atomCount; ++i) this.newCloneAtom(this.atoms[i]);

return this.ac;
}, "~N");
Clazz_defineMethod(c$, "cloneAtomSetWithBonds", 
function(isLast){
var nBonds = this.atomSetBondCounts[isLast ? this.iSet : 0];
var atomIncrement = (isLast ? this.cloneLastAtomSet() : this.cloneFirstAtomSet(0));
if (atomIncrement > 0) for (var i = 0; i < nBonds; i++) {
var bond = this.bonds[this.bondCount - nBonds];
this.addNewBondWithOrder(bond.atomIndex1 + atomIncrement, bond.atomIndex2 + atomIncrement, bond.order);
}
}, "~B");
Clazz_defineMethod(c$, "cloneLastAtomSet", 
function(){
return this.cloneLastAtomSetFromPoints(0, null);
});
Clazz_defineMethod(c$, "cloneLastAtomSetFromPoints", 
function(ac, pts){
if (!this.allowMultiple) return 0;
var count = (ac > 0 ? ac : this.getLastAtomSetAtomCount());
var atomIndex = this.getLastAtomSetAtomIndex();
this.newAtomSet();
for (var i = 0; i < count; ++i) {
var atom = this.newCloneAtom(this.atoms[atomIndex++]);
if (pts != null) atom.setT(pts[i]);
}
return count;
}, "~N,~A");
Clazz_defineMethod(c$, "getLastAtomSetAtomCount", 
function(){
return this.atomSetAtomCounts[this.iSet];
});
Clazz_defineMethod(c$, "getLastAtomSetAtomIndex", 
function(){
return this.ac - this.atomSetAtomCounts[this.iSet];
});
Clazz_defineMethod(c$, "addNewAtom", 
function(){
return this.addAtom( new J.adapter.smarter.Atom());
});
Clazz_defineMethod(c$, "addAtom", 
function(atom){
if (this.ac == this.atoms.length) {
if (this.ac > 200000) this.atoms = JU.AU.ensureLength(this.atoms, this.ac + 50000);
 else this.atoms = JU.AU.doubleLength(this.atoms);
}if (this.atomSetCount == 0) this.newAtomSet();
atom.index = this.ac;
this.atoms[this.ac++] = atom;
atom.atomSetIndex = this.iSet;
atom.atomSite = (this.fixedSite > 0 ? this.fixedSite - 1 : this.atomSetAtomCounts[this.iSet]++);
return atom;
}, "J.adapter.smarter.Atom");
Clazz_defineMethod(c$, "addAtomWithMappedName", 
function(atom){
var atomName = this.addAtom(atom).atomName;
if (atomName != null) this.atomSymbolicMap.put(atomName, atom);
}, "J.adapter.smarter.Atom");
Clazz_defineMethod(c$, "addAtomWithMappedSerialNumber", 
function(atom){
var atomSerial = this.addAtom(atom).atomSerial;
if (atomSerial != -2147483648) this.atomSymbolicMap.put("" + atomSerial, atom);
}, "J.adapter.smarter.Atom");
Clazz_defineMethod(c$, "getAtomFromName", 
function(atomName){
return this.atomSymbolicMap.get(atomName);
}, "~S");
Clazz_defineMethod(c$, "setAtomMapAnyCase", 
function(){
this.atomMapAnyCase = true;
var newMap =  new java.util.Hashtable();
newMap.putAll(this.atomSymbolicMap);
for (var e, $e = this.atomSymbolicMap.entrySet().iterator (); $e.hasNext()&& ((e = $e.next ()) || true);) {
var name = e.getKey();
var uc = name.toUpperCase();
if (!uc.equals(name)) newMap.put(uc, e.getValue());
}
this.atomSymbolicMap = newMap;
});
Clazz_defineMethod(c$, "getAtomIndex", 
function(name){
var a = this.atomSymbolicMap.get(name);
if (a == null && this.atomMapAnyCase) a = this.atomSymbolicMap.get(name.toUpperCase());
return (a == null ? -1 : a.index);
}, "~S");
Clazz_defineMethod(c$, "addNewBondWithOrder", 
function(atomIndex1, atomIndex2, order){
var b = null;
if (atomIndex1 >= 0 && atomIndex1 < this.ac && atomIndex2 >= 0 && atomIndex2 < this.ac && atomIndex1 != atomIndex2) {
b =  new J.adapter.smarter.Bond(atomIndex1, atomIndex2, order);
this.addBond(b);
}return b;
}, "~N,~N,~N");
Clazz_defineMethod(c$, "addNewBondFromNames", 
function(atomName1, atomName2, order){
return this.addNewBondWithOrderA(this.getAtomFromName(atomName1), this.getAtomFromName(atomName2), order);
}, "~S,~S,~N");
Clazz_defineMethod(c$, "addNewBondWithOrderA", 
function(atom1, atom2, order){
return (atom1 != null && atom2 != null ? this.addNewBondWithOrder(atom1.index, atom2.index, order) : null);
}, "J.adapter.smarter.Atom,J.adapter.smarter.Atom,~N");
Clazz_defineMethod(c$, "addBond", 
function(bond){
if (this.trajectoryStepCount > 0) return;
if (bond.atomIndex1 < 0 || bond.atomIndex2 < 0 || bond.order < 0 || bond.atomIndex1 == bond.atomIndex2 || this.atoms[bond.atomIndex1].atomSetIndex != this.atoms[bond.atomIndex2].atomSetIndex) {
if (JU.Logger.debugging) {
JU.Logger.debug(">>>>>>BAD BOND:" + bond.atomIndex1 + "-" + bond.atomIndex2 + " order=" + bond.order);
}return;
}this.addBondNoCheck(bond);
}, "J.adapter.smarter.Bond");
Clazz_defineMethod(c$, "addBondNoCheck", 
function(bond){
if (this.bondCount == this.bonds.length) this.bonds = JU.AU.arrayCopyObject(this.bonds, this.bondCount + 1024);
this.bonds[this.bondCount++] = bond;
this.atomSetBondCounts[this.iSet]++;
}, "J.adapter.smarter.Bond");
Clazz_defineMethod(c$, "finalizeStructures", 
function(){
if (this.structureCount == 0) return;
this.bsStructuredModels =  new JU.BS();
var map =  new java.util.Hashtable();
for (var i = 0; i < this.structureCount; i++) {
var s = this.structures[i];
if (s.modelStartEnd[0] == -1) {
s.modelStartEnd[0] = 0;
s.modelStartEnd[1] = this.atomSetCount - 1;
}this.bsStructuredModels.setBits(s.modelStartEnd[0], s.modelStartEnd[1] + 1);
if (s.strandCount == 0) continue;
var key = s.structureID + " " + s.modelStartEnd[0];
var v = map.get(key);
var count = (v == null ? 0 : v.intValue()) + 1;
map.put(key, Integer.$valueOf(count));
}
for (var i = 0; i < this.structureCount; i++) {
var s = this.structures[i];
if (s.strandCount == 1) s.strandCount = map.get(s.structureID + " " + s.modelStartEnd[0]).intValue();
}
});
Clazz_defineMethod(c$, "addStructure", 
function(structure){
if (this.structureCount == this.structures.length) this.structures = JU.AU.arrayCopyObject(this.structures, this.structureCount + 32);
this.structures[this.structureCount++] = structure;
}, "J.adapter.smarter.Structure");
Clazz_defineMethod(c$, "addVibrationVectorWithSymmetry", 
function(iatom, vx, vy, vz, withSymmetry){
if (!withSymmetry) {
this.addVibrationVector(iatom, vx, vy, vz);
return;
}var atomSite = this.atoms[iatom].atomSite;
var atomSetIndex = this.atoms[iatom].atomSetIndex;
for (var i = iatom; i < this.ac && this.atoms[i].atomSetIndex == atomSetIndex; i++) {
if (this.atoms[i].atomSite == atomSite) this.addVibrationVector(i, vx, vy, vz);
}
}, "~N,~N,~N,~N,~B");
Clazz_defineMethod(c$, "addVibrationVector", 
function(iatom, x, y, z){
if (!this.allowMultiple) iatom = iatom % this.ac;
return (this.atoms[iatom].vib = JU.V3.new3(x, y, z));
}, "~N,~N,~N,~N");
Clazz_defineMethod(c$, "setCoordinatesAreFractional", 
function(tf){
this.coordinatesAreFractional = tf;
this.setCurrentModelInfo("coordinatesAreFractional", Boolean.$valueOf(tf));
if (tf) this.setGlobalBoolean(0);
}, "~B");
Clazz_defineMethod(c$, "setAnisoBorU", 
function(atom, data, type){
this.haveAnisou = true;
atom.anisoBorU = data;
data[6] = type;
}, "J.adapter.smarter.Atom,~A,~N");
Clazz_defineMethod(c$, "setU", 
function(atom, i, val){
var data = atom.anisoBorU;
if (data == null) this.setAnisoBorU(atom, data =  Clazz_newFloatArray (8, 0), 8);
data[i] = val;
}, "J.adapter.smarter.Atom,~N,~N");
Clazz_defineMethod(c$, "getXSymmetry", 
function(){
if (this.xtalSymmetry == null) this.xtalSymmetry = (J.api.Interface.getOption("adapter.smarter.XtalSymmetry", this.reader.vwr, "file")).set(this.reader);
return this.xtalSymmetry;
});
Clazz_defineMethod(c$, "getSymmetry", 
function(){
return this.getXSymmetry().getFileSymmetry();
});
Clazz_defineMethod(c$, "setSymmetryFromAuditBlock", 
function(symmetry){
return (symmetry == null ? null : this.getXSymmetry().setSymmetryFromAuditBlock(symmetry));
}, "J.adapter.smarter.XtalSymmetry.FileSymmetry");
Clazz_defineMethod(c$, "newFileSymmetry", 
function(){
return this.getXSymmetry().newFileSymmetry();
});
Clazz_defineMethod(c$, "setTensors", 
function(){
if (this.haveAnisou) this.getXSymmetry().setTensors(this.isConSurf !== Boolean.TRUE);
});
Clazz_defineMethod(c$, "setInfo", 
function(key, value){
if (value == null) this.atomSetInfo.remove(key);
 else this.atomSetInfo.put(key, value);
}, "~S,~O");
Clazz_defineMethod(c$, "setAtomSetCollectionPartialCharges", 
function(auxKey){
if (!this.atomSetInfo.containsKey(auxKey)) return false;
var atomData = this.atomSetInfo.get(auxKey);
var n = atomData.size();
for (var i = this.ac; --i >= 0; ) this.atoms[i].partialCharge = atomData.get(i % n).floatValue();

JU.Logger.info("Setting partial charges type " + auxKey);
return true;
}, "~S");
Clazz_defineMethod(c$, "mapPartialCharge", 
function(atomName, charge){
this.getAtomFromName(atomName).partialCharge = charge;
}, "~S,~N");
c$.fixPeriodic = Clazz_defineMethod(c$, "fixPeriodic", 
function(pt, pt0){
pt.x = J.adapter.smarter.AtomSetCollection.fixPoint(pt.x, pt0.x);
pt.y = J.adapter.smarter.AtomSetCollection.fixPoint(pt.y, pt0.y);
pt.z = J.adapter.smarter.AtomSetCollection.fixPoint(pt.z, pt0.z);
return pt;
}, "JU.P3,JU.P3");
c$.fixPoint = Clazz_defineMethod(c$, "fixPoint", 
function(x, x0){
while (x - x0 > 0.9) {
x -= 1;
}
while (x - x0 < -0.9) {
x += 1;
}
return x;
}, "~N,~N");
Clazz_defineMethod(c$, "finalizeTrajectoryAs", 
function(trajectorySteps, vibrationSteps){
this.trajectorySteps = trajectorySteps;
this.vibrationSteps = vibrationSteps;
this.trajectoryStepCount = trajectorySteps.size();
this.finalizeTrajectory();
}, "JU.Lst,JU.Lst");
Clazz_defineMethod(c$, "finalizeTrajectory", 
function(){
if (this.trajectoryStepCount == 0) return;
var trajectory = this.trajectorySteps.get(0);
var vibrations = (this.vibrationSteps == null ? null : this.vibrationSteps.get(0));
var n = (this.bsAtoms == null ? this.ac : this.bsAtoms.cardinality());
if (this.vibrationSteps != null && vibrations != null && vibrations.length < n || trajectory.length < n) {
this.errorMessage = "File cannot be loaded as a trajectory";
return;
}var v =  new JU.V3();
for (var i = 0, ii = 0; i < this.ac; i++) {
if (this.bsAtoms != null && !this.bsAtoms.get(i)) continue;
if (this.vibrationSteps != null) this.atoms[i].vib = (vibrations == null ? v : vibrations[ii]);
if (trajectory[ii] != null) this.atoms[i].setT(trajectory[ii]);
ii++;
}
this.setInfo("trajectorySteps", this.trajectorySteps);
if (this.vibrationSteps != null) this.setInfo("vibrationSteps", this.vibrationSteps);
if (this.ac == 0) this.ac = trajectory.length;
});
Clazz_defineMethod(c$, "newAtomSet", 
function(){
this.newAtomSetClear(true);
});
Clazz_defineMethod(c$, "newAtomSetClear", 
function(doClearMap){
if (!this.allowMultiple && this.iSet >= 0) this.reader.discardPreviousAtoms();
this.bondIndex0 = this.bondCount;
if (this.isTrajectory) this.reader.discardPreviousAtoms();
this.iSet = this.atomSetCount++;
if (this.atomSetCount > this.atomSetNumbers.length) {
this.atomSetAtomIndexes = JU.AU.doubleLengthI(this.atomSetAtomIndexes);
this.atomSetAtomCounts = JU.AU.doubleLengthI(this.atomSetAtomCounts);
this.atomSetBondCounts = JU.AU.doubleLengthI(this.atomSetBondCounts);
this.atomSetAuxiliaryInfo = JU.AU.doubleLength(this.atomSetAuxiliaryInfo);
}this.atomSetAtomIndexes[this.iSet] = this.ac;
if (this.atomSetCount + this.trajectoryStepCount > this.atomSetNumbers.length) {
this.atomSetNumbers = JU.AU.doubleLengthI(this.atomSetNumbers);
}if (this.isTrajectory) {
this.atomSetNumbers[this.iSet + this.trajectoryStepCount] = this.atomSetCount + this.trajectoryStepCount;
} else {
this.atomSetNumbers[this.iSet] = this.atomSetCount;
}if (doClearMap) {
this.clearMap();
}this.setCurrentModelInfo("title", this.collectionName);
}, "~B");
Clazz_defineMethod(c$, "clearMap", 
function(){
this.atomSymbolicMap.clear();
this.atomMapAnyCase = false;
});
Clazz_defineMethod(c$, "getAtomSetAtomIndex", 
function(i){
return this.atomSetAtomIndexes[i];
}, "~N");
Clazz_defineMethod(c$, "getAtomSetAtomCount", 
function(i){
return this.atomSetAtomCounts[i];
}, "~N");
Clazz_defineMethod(c$, "getAtomSetBondCount", 
function(i){
return this.atomSetBondCounts[i];
}, "~N");
Clazz_defineMethod(c$, "setAtomSetName", 
function(atomSetName){
if (atomSetName == null) return;
if (this.isTrajectory) {
this.setTrajectoryName(atomSetName);
return;
}var name0 = (this.iSet < 0 ? null : this.getAtomSetName(this.iSet));
this.setModelInfoForSet("name", atomSetName, this.iSet);
if (this.reader != null && atomSetName.length > 0 && !atomSetName.equals(name0)) this.reader.appendLoadNote(atomSetName);
if (!this.allowMultiple) this.setCollectionName(atomSetName);
}, "~S");
Clazz_defineMethod(c$, "setTrajectoryName", 
function(name){
if (this.trajectoryStepCount == 0) return;
if (this.trajectoryNames == null) {
this.trajectoryNames =  new JU.Lst();
}for (var i = this.trajectoryNames.size(); i < this.trajectoryStepCount; i++) this.trajectoryNames.addLast(null);

this.trajectoryNames.set(this.trajectoryStepCount - 1, name);
}, "~S");
Clazz_defineMethod(c$, "setCurrentAtomSetNumber", 
function(atomSetNumber){
this.setAtomSetNumber(this.iSet + (this.isTrajectory ? this.trajectoryStepCount : 0), atomSetNumber);
}, "~N");
Clazz_defineMethod(c$, "setAtomSetNumber", 
function(index, atomSetNumber){
this.atomSetNumbers[index] = atomSetNumber;
}, "~N,~N");
Clazz_defineMethod(c$, "setAtomSetModelProperty", 
function(key, value){
this.setAtomSetModelPropertyForSet(key, value, this.iSet);
}, "~S,~S");
Clazz_defineMethod(c$, "setAtomSetModelPropertyForSet", 
function(key, value, atomSetIndex){
var p = this.getAtomSetAuxiliaryInfoValue(atomSetIndex, "modelProperties");
if (p == null) this.setModelInfoForSet("modelProperties", p =  new java.util.Properties(), atomSetIndex);
p.put(key, value);
if (key.startsWith(".")) p.put(key.substring(1), value);
}, "~S,~S,~N");
Clazz_defineMethod(c$, "setAtomProperties", 
function(key, data, atomSetIndex, isGroup){
if ((typeof(data)=='string') && !(data).endsWith("\n")) data = data + "\n";
if (atomSetIndex < 0) atomSetIndex = this.iSet;
var p = this.getAtomSetAuxiliaryInfoValue(atomSetIndex, "atomProperties");
if (p == null) this.setModelInfoForSet("atomProperties", p =  new java.util.Hashtable(), atomSetIndex);
p.put(key, data);
}, "~S,~O,~N,~B");
Clazz_defineMethod(c$, "setAtomSetPartialCharges", 
function(auxKey){
if (!this.atomSetAuxiliaryInfo[this.iSet].containsKey(auxKey)) {
return false;
}var atomData = this.getAtomSetAuxiliaryInfoValue(this.iSet, auxKey);
for (var i = atomData.size(); --i >= 0; ) {
this.atoms[i].partialCharge = atomData.get(i).floatValue();
}
return true;
}, "~S");
Clazz_defineMethod(c$, "getAtomSetAuxiliaryInfoValue", 
function(index, key){
return this.atomSetAuxiliaryInfo[index >= 0 ? index : this.iSet].get(key);
}, "~N,~S");
Clazz_defineMethod(c$, "setCurrentModelInfo", 
function(key, value){
this.setModelInfoForSet(key, value, this.iSet);
}, "~S,~O");
Clazz_defineMethod(c$, "setModelInfoForSet", 
function(key, value, atomSetIndex){
if (atomSetIndex < 0) return;
if (this.atomSetAuxiliaryInfo[atomSetIndex] == null) this.atomSetAuxiliaryInfo[atomSetIndex] =  new java.util.Hashtable();
if (value == null) this.atomSetAuxiliaryInfo[atomSetIndex].remove(key);
 else this.atomSetAuxiliaryInfo[atomSetIndex].put(key, value);
}, "~S,~O,~N");
Clazz_defineMethod(c$, "getAtomSetNumber", 
function(atomSetIndex){
return this.atomSetNumbers[atomSetIndex >= this.atomSetCount ? 0 : atomSetIndex];
}, "~N");
Clazz_defineMethod(c$, "getAtomSetName", 
function(atomSetIndex){
if (this.trajectoryNames != null && atomSetIndex < this.trajectoryNames.size()) return this.trajectoryNames.get(atomSetIndex);
if (atomSetIndex >= this.atomSetCount) atomSetIndex = this.atomSetCount - 1;
return this.getAtomSetAuxiliaryInfoValue(atomSetIndex, "name");
}, "~N");
Clazz_defineMethod(c$, "getAtomSetAuxiliaryInfo", 
function(atomSetIndex){
var i = (atomSetIndex >= this.atomSetCount ? this.atomSetCount - 1 : atomSetIndex);
return (i < 0 ? null : this.atomSetAuxiliaryInfo[i]);
}, "~N");
Clazz_defineMethod(c$, "setAtomSetEnergy", 
function(energyString, value){
if (this.iSet < 0) return;
JU.Logger.info("Energy for model " + (this.iSet + 1) + " = " + energyString);
this.setCurrentModelInfo("EnergyString", energyString);
this.setCurrentModelInfo("Energy", Float.$valueOf(value));
this.setAtomSetModelProperty("Energy", "" + value);
}, "~S,~N");
Clazz_defineMethod(c$, "setAtomSetFrequency", 
function(mode, pathKey, label, freq, units){
this.setAtomSetModelProperty("FreqValue", freq);
freq += " " + (units == null ? "cm^-1" : units);
var name = (label == null ? "" : label + " ") + freq;
this.setAtomSetName(name);
this.setAtomSetModelProperty("Frequency", freq);
this.setAtomSetModelProperty("Mode", "" + mode);
this.setModelInfoForSet("vibrationalMode", Integer.$valueOf(mode), this.iSet);
if (label != null) this.setAtomSetModelProperty("FrequencyLabel", label);
this.setAtomSetModelProperty(".PATH", (pathKey == null ? "" : pathKey + J.adapter.smarter.SmarterJmolAdapter.PATH_SEPARATOR + "Frequencies") + "Frequencies");
return name;
}, "~N,~S,~S,~S,~S");
Clazz_defineMethod(c$, "getBondList", 
function(){
var info =  new Array(this.bondCount);
for (var i = 0; i < this.bondCount; i++) {
info[i] =  Clazz_newArray(-1, [this.atoms[this.bonds[i].atomIndex1].atomName, this.atoms[this.bonds[i].atomIndex2].atomName, "" + this.bonds[i].order]);
}
return info;
});
Clazz_defineMethod(c$, "centralize", 
function(){
var pt =  new JU.P3();
for (var i = 0; i < this.atomSetCount; i++) {
var n = this.atomSetAtomCounts[i];
var atom0 = this.atomSetAtomIndexes[i];
pt.set(0, 0, 0);
for (var j = atom0 + n; --j >= atom0; ) pt.add(this.atoms[j]);

pt.scale(1 / n);
for (var j = atom0 + n; --j >= atom0; ) this.atoms[j].sub(pt);

}
});
Clazz_defineMethod(c$, "mergeTrajectories", 
function(a){
if (!this.isTrajectory || !a.isTrajectory || this.vibrationSteps != null) return;
for (var i = 0; i < a.trajectoryStepCount; i++) this.trajectorySteps.add(this.trajectoryStepCount++, a.trajectorySteps.get(i));

this.setInfo("trajectorySteps", this.trajectorySteps);
this.setInfo("ignoreUnitCell", a.atomSetInfo.get("ignoreUnitCell"));
}, "J.adapter.smarter.AtomSetCollection");
Clazz_defineMethod(c$, "removeAtomSet", 
function(imodel){
if (this.bsAtoms == null) this.bsAtoms = JU.BSUtil.newBitSet2(0, this.ac);
var i0 = this.atomSetAtomIndexes[imodel];
var nAtoms = this.atomSetAtomCounts[imodel];
var i1 = i0 + nAtoms;
this.bsAtoms.clearBits(i0, i1);
for (var i = i1; i < this.ac; i++) this.atoms[i].atomSetIndex--;

for (var i = imodel + 1; i < this.atomSetCount; i++) {
this.atomSetAuxiliaryInfo[i - 1] = this.atomSetAuxiliaryInfo[i];
this.atomSetAtomIndexes[i - 1] = this.atomSetAtomIndexes[i];
this.atomSetBondCounts[i - 1] = this.atomSetBondCounts[i];
this.atomSetAtomCounts[i - 1] = this.atomSetAtomCounts[i];
this.atomSetNumbers[i - 1] = this.atomSetNumbers[i];
}
for (var i = 0; i < this.bondCount; i++) this.bonds[i].atomSetIndex = this.atoms[this.bonds[i].atomIndex1].atomSetIndex;

this.atomSetAuxiliaryInfo[--this.atomSetCount] = null;
var n = 0;
for (var i = 0; i < this.structureCount; i++) {
var s = this.structures[i];
if (s.modelStartEnd[0] == imodel && s.modelStartEnd[1] == imodel) {
this.structures[i] = null;
n++;
}}
if (n > 0) {
var ss =  new Array(this.structureCount - n);
for (var i = 0, pt = 0; i < this.structureCount; i++) if (this.structures[i] != null) ss[pt++] = this.structures[i];

this.structures = ss;
}}, "~N");
Clazz_defineMethod(c$, "removeLastUnselectedAtoms", 
function(){
var n = this.ac;
var nremoved = 0;
var i0 = this.getLastAtomSetAtomIndex();
var nnow = 0;
for (var i = i0; i < n; i++) {
if (!this.bsAtoms.get(i)) {
nremoved++;
this.ac--;
this.atoms[i] = null;
continue;
}if (nremoved > 0) {
this.atoms[this.atoms[i].index = i - nremoved] = this.atoms[i];
this.atoms[i] = null;
}nnow++;
}
this.atomSetAtomCounts[this.iSet] = nnow;
if (nnow == 0) {
this.iSet--;
this.atomSetCount--;
} else {
this.bsAtoms.setBits(i0, i0 + nnow);
}});
Clazz_defineMethod(c$, "checkNoEmptyModel", 
function(){
while (this.atomSetCount > 0 && this.atomSetAtomCounts[this.atomSetCount - 1] == 0) this.atomSetCount--;

});
Clazz_defineMethod(c$, "getBSAtoms", 
function(n){
if (this.bsAtoms == null) {
this.bsAtoms =  new JU.BS();
if (n != 0) this.bsAtoms.setBits(0, (n < 0 ? this.ac : n));
}return this.bsAtoms;
}, "~N");
Clazz_defineMethod(c$, "setBSAtomsForSet", 
function(iSet){
if (this.bsAtoms != null) {
if (iSet < 0) iSet = this.iSet;
var pt = this.atomSetAtomIndexes[iSet];
if (this.bsAtoms.nextSetBit(pt) < 0) {
var n = this.atomSetAtomCounts[iSet];
this.bsAtoms.setBits(pt, pt + n);
}}}, "~N");
Clazz_defineMethod(c$, "fix2Stereo", 
function(){
this.getBSAtoms(-1);
for (var i = this.bondCount; --i >= 0; ) {
var b = this.bonds[i];
if (this.atoms[b.atomIndex2].elementSymbol.equals("H") && b.order != 1025 && b.order != 1041 && this.atoms[b.atomIndex1].elementSymbol.equals("C")) {
this.bsAtoms.clear(b.atomIndex2);
} else if (this.atoms[b.atomIndex1].elementSymbol.equals("H") && this.atoms[b.atomIndex2].elementSymbol.equals("C")) {
this.bsAtoms.clear(b.atomIndex1);
}}
});
});
;//5.0.1-v7 Mon Aug 24 10:01:38 CDT 2026
Clazz_declarePackage("J.adapter.smarter");
Clazz_load(["javajs.api.GenericLineReader", "JU.SB", "JV.Viewer"], "J.adapter.smarter.AtomSetCollectionReader", ["JU.BS", "$.Lst", "$.M3", "$.P3", "$.PT", "$.Quat", "$.V3", "J.adapter.smarter.Atom", "$.AtomSetCollection", "J.api.Interface", "$.JmolAdapter", "JU.BSUtil", "$.Logger", "$.SimpleUnitCell", "JV.FileManager", "$.JC"], function(){
var c$ = Clazz_decorateAsClass(function(){
this.isBinary = false;
this.debugging = false;
this.requiresBSFilter = false;
this.primitiveToCrystal = null;
this.asc = null;
this.reader = null;
this.binaryDoc = null;
this.readerName = null;
this.htParams = null;
this.trajectorySteps = null;
this.domains = null;
this.validation = null;
this.dssr = null;
this.openVarna = false;
this.isConcatenated = false;
this.addedData = null;
this.addedDataKey = null;
this.thisBiomolecule = null;
this.lstNCS = null;
this.floatifyJavaDouble = true;
this.line = null;
this.prevline = null;
this.next = null;
this.ptLine = 0;
this.checkNearAtoms = true;
this.latticeType = null;
this.latticeCells = null;
this.fillRange = null;
this.doProcessLines = false;
this.iHaveUnitCell = false;
this.iHaveSymmetryOperators = false;
this.continuing = true;
this.vwr = null;
this.doApplySymmetry = false;
this.ignoreFileSymmetryOperators = false;
this.isTrajectory = false;
this.applySymmetryToBonds = false;
this.doCheckUnitCell = false;
this.getHeader = false;
this.isSequential = false;
this.optimize2D = false;
this.noHydrogens = false;
this.noMinimize = false;
this.is2D = false;
this.isMolecular = false;
this.templateAtomCount = 0;
this.modelNumber = 0;
this.vibrationNumber = 0;
this.desiredVibrationNumber = -2147483648;
this.bsModels = null;
this.useFileModelNumbers = false;
this.havePartialChargeFilter = false;
this.calculationType = "?";
this.sgName = null;
this.ignoreFileUnitCell = false;
this.ignoreFileSpaceGroupName = false;
this.unitCellParams = null;
this.desiredModelNumber = -2147483648;
this.symmetry = null;
this.out = null;
this.iHaveFractionalCoordinates = false;
this.doPackUnitCell = false;
this.ptSupercell = null;
this.mustFinalizeModelSet = false;
this.forcePacked = false;
this.packingRange = null;
this.cellSlop = 1.0E-4;
this.rotateHexCell = false;
this.isPrimitive = false;
this.modDim = 0;
this.lowPrecision = false;
this.highprecision0 = false;
this.loadNote = null;
this.doConvertToFractional = false;
this.fileCoordinatesAreFractional = false;
this.merging = false;
this.symmetryRange = 0;
this.firstLastStep = null;
this.lastModelNumber = 2147483647;
this.desiredSpaceGroupIndex = -1;
this.latticeScaling = NaN;
this.unitCellOffset = null;
this.unitCellOffsetFractional = false;
this.moreUnitCellInfo = null;
this.paramsLattice = null;
this.paramsCentroid = false;
this.paramsPacked = false;
this.fileScaling = null;
this.fileOffset = null;
this.fileOffsetFractional = null;
this.filePath = null;
this.fileName = null;
this.baseAtomIndex = 0;
this.baseBondIndex = 0;
this.stateScriptVersionInt = 2147483647;
this.isFinalized = false;
this.noPack = false;
this.isSUPERCELL = false;
this.precision = 0;
this.haveModel = false;
this.previousSpaceGroup = null;
this.previousUnitCell = null;
this.nMatrixElements = 0;
this.ucItems = null;
this.matUnitCellOrientation = null;
this.bsFilter = null;
this.filter = null;
this.filterCased = null;
this.haveAtomFilter = false;
this.filterAltLoc = false;
this.filterGroup3 = false;
this.filterChain = false;
this.filterAtomName = false;
this.filterAtomType = false;
this.filterAtomTypeStr = null;
this.filterAtomNameTerminator = ";";
this.filterElement = false;
this.filterHetero = false;
this.filterAllHetero = false;
this.filterEveryNth = false;
this.filterSymop = null;
this.filterN = 0;
this.nFiltered = 0;
this.doSetOrientation = false;
this.doCentralize = false;
this.addVibrations = false;
this.useAltNames = false;
this.ignoreStructure = false;
this.isDSSP1 = false;
this.allowPDBFilter = false;
this.doReadMolecularOrbitals = false;
this.reverseModels = false;
this.modelNameRequired = null;
this.doCentroidUnitCell = false;
this.centroidPacked = false;
this.strSupercell = null;
this.allow_a_len_1 = false;
this.slabXY = false;
this.polymerX = false;
this.filteredPrecision = false;
this.filter1 = null;
this.filter2 = null;
this.filter1Cased = null;
this.filter2Cased = null;
this.matRot = null;
this.ms = null;
this.vibsFractional = false;
this.previousScript = null;
this.siteScript = null;
Clazz_instantialize(this, arguments);}, J.adapter.smarter, "AtomSetCollectionReader", null, javajs.api.GenericLineReader);
Clazz_prepareFields (c$, function(){
this.next =  Clazz_newIntArray (1, 0);
this.highprecision0 = JV.Viewer.isHighPrecision;
this.loadNote =  new JU.SB();
});
Clazz_defineMethod(c$, "getPackingRangeValue", 
function(def){
return (this.packingRange != null ? this.packingRange.floatValue() : def != 0 ? def : 0.02);
}, "~N");
Clazz_defineMethod(c$, "setup", 
function(fullPath, htParams, readerOrDocument){
this.setupASCR(fullPath, htParams, readerOrDocument);
}, "~S,java.util.Map,~O");
Clazz_defineMethod(c$, "setupASCR", 
function(fullPath, htParams, readerOrDocument){
if (fullPath == null) return;
this.debugging = JU.Logger.debugging;
this.htParams = htParams;
this.filePath = JV.FileManager.stripTypePrefix("" + htParams.get("fullPathName"));
var i = this.filePath.lastIndexOf('/');
this.fileName = this.filePath.substring(i + 1);
if (Clazz_instanceOf(readerOrDocument,"java.io.BufferedReader")) this.reader = readerOrDocument;
 else if (Clazz_instanceOf(readerOrDocument,"javajs.api.GenericBinaryDocument")) this.binaryDoc = readerOrDocument;
}, "~S,java.util.Map,~O");
Clazz_defineMethod(c$, "readData", 
function(){
this.initialize();
this.asc =  new J.adapter.smarter.AtomSetCollection(this.readerName, this, null, null);
try {
this.initializeReader();
if (this.binaryDoc == null) {
if (this.line == null && this.continuing) this.rd();
while (this.line != null && this.continuing) if (this.checkLine()) this.rd();

} else {
this.binaryDoc.setOutputChannel(this.out);
this.processBinaryDocument();
}this.finalizeSubclassReader();
if (!this.isFinalized) this.finalizeReaderASCR();
} catch (e) {
JU.Logger.info("Reader error: " + e);
e.printStackTrace();
this.setError(e);
}
if (this.reader != null) this.reader.close();
if (this.binaryDoc != null) this.binaryDoc.close();
return this.finish();
});
Clazz_defineMethod(c$, "fixBaseIndices", 
function(){
try {
var ii = this.htParams.get("baseModelIndex");
if (ii == null) return;
var baseModelIndex = ii.intValue();
this.baseAtomIndex += this.asc.ac;
this.baseBondIndex += this.asc.bondCount;
baseModelIndex += this.asc.atomSetCount;
this.htParams.put("baseAtomIndex", Integer.$valueOf(this.baseAtomIndex));
this.htParams.put("baseBondIndex", Integer.$valueOf(this.baseBondIndex));
this.htParams.put("baseModelIndex", Integer.$valueOf(baseModelIndex));
} catch (e) {
if (Clazz_exceptionOf(e, Exception)){
} else {
throw e;
}
}
});
Clazz_defineMethod(c$, "readDataObject", 
function(node){
this.initialize();
this.asc =  new J.adapter.smarter.AtomSetCollection(this.readerName, this, null, null);
this.initializeReader();
this.processDOM(node);
return this.finish();
}, "~O");
Clazz_defineMethod(c$, "processDOM", 
function(DOMNode){
}, "~O");
Clazz_defineMethod(c$, "processBinaryDocument", 
function(){
});
Clazz_defineMethod(c$, "initializeReader", 
function(){
});
Clazz_defineMethod(c$, "checkLine", 
function(){
return true;
});
Clazz_defineMethod(c$, "checkLastModel", 
function(){
if (this.isLastModel(this.modelNumber) && this.doProcessLines) return (this.continuing = this.doProcessLines = false);
this.doProcessLines = false;
return true;
});
Clazz_defineMethod(c$, "isLastModel", 
function(modelNumber){
return (this.desiredModelNumber > 0 || modelNumber >= this.lastModelNumber);
}, "~N");
Clazz_defineMethod(c$, "appendLoadNote", 
function(info){
if (info == null) {
this.loadNote =  new JU.SB();
return;
}this.loadNote.append(info).append("\n");
JU.Logger.info(info);
}, "~S");
Clazz_defineMethod(c$, "initializeTrajectoryFile", 
function(){
this.asc.addAtom( new J.adapter.smarter.Atom());
this.trajectorySteps = this.htParams.get("trajectorySteps");
if (this.trajectorySteps == null) this.htParams.put("trajectorySteps", this.trajectorySteps =  new JU.Lst());
});
Clazz_defineMethod(c$, "finalizeSubclassReader", 
function(){
});
Clazz_defineMethod(c$, "finalizeReaderASCR", 
function(){
this.isFinalized = true;
if (this.asc.atomSetCount > 0) {
if (this.asc.atomSetCount == 1) {
this.asc.setCurrentModelInfo("dbName", this.htParams.get("dbName"));
this.asc.setCurrentModelInfo("auxFiles", this.htParams.get("auxFiles"));
}this.applySymmetryAndSetTrajectory();
this.asc.finalizeStructures();
if (this.doCentralize) this.asc.centralize();
if (this.fillRange != null) this.asc.setInfo("boundbox", this.fillRange);
var info = this.asc.getAtomSetAuxiliaryInfo(0);
if (info != null) {
if (this.domains != null) {
this.asc.setGlobalBoolean(5);
var s = (this.domains).getMapKeys(2, true);
var pt = s.indexOf("{ ", 2);
if (pt >= 0) s = s.substring(pt + 2);
pt = s.indexOf("_metadata");
if (pt < 0) pt = s.indexOf("metadata");
if (pt >= 0) s = s.substring(0, pt);
s = JU.PT.rep(JU.PT.replaceAllCharacters(s, "{}", "").trim(), "\n", "\n  ") + "\n\nUse SHOW DOMAINS for details.";
this.appendLoadNote("\nDomains loaded:\n   " + s);
for (var i = this.asc.atomSetCount; --i >= 0; ) {
info = this.asc.getAtomSetAuxiliaryInfo(i);
info.put("domains", this.domains);
}
}if (this.validation != null) {
for (var i = this.asc.atomSetCount; --i >= 0; ) {
info = this.asc.getAtomSetAuxiliaryInfo(i);
info.put("validation", this.validation);
}
}if (this.dssr != null) {
info.put("dssrJSON", Boolean.TRUE);
info.put("dssr", this.dssr);
if (this.openVarna) this.vwr.plugin("VARNA", "show", "dssr");
this.addJmolScript("set cartoonblocks;cartoons only;color structure");
} else if (this.openVarna) {
this.addJmolScript("calculate structure dssr;set cartoonblocks;cartoons only;color structure");
}}}if (!this.floatifyJavaDouble) this.asc.setInfo("highPrecision", Boolean.TRUE);
this.setLoadNote();
});
Clazz_defineMethod(c$, "setLoadNote", 
function(){
var s = this.loadNote.toString();
if (this.loadNote.length() > 0) this.asc.setInfo("modelLoadNote", s);
return s;
});
Clazz_defineMethod(c$, "setIsPDB", 
function(){
this.asc.setGlobalBoolean(4);
if (this.htParams.get("pdbNoHydrogens") != null) this.asc.setInfo("pdbNoHydrogens", this.htParams.get("pdbNoHydrogens"));
if (this.checkFilterKey("ADDHYDROGENS")) this.asc.setInfo("pdbAddHydrogens", Boolean.TRUE);
});
Clazz_defineMethod(c$, "setModelPDB", 
function(isPDB){
if (isPDB) this.asc.setGlobalBoolean(4);
 else this.asc.clearGlobalBoolean(4);
this.asc.setCurrentModelInfo(JV.JC.getBoolName(4), isPDB ? Boolean.TRUE : null);
}, "~B");
Clazz_defineMethod(c$, "finish", 
function(){
if (false != this.highprecision0) this.vwr.setBooleanPropertyTok("doubleprecision", 603979831, this.highprecision0);
var s = this.htParams.get("loadState");
this.asc.setInfo("loadState", s == null ? "" : s);
s = this.htParams.get("smilesString");
if (s != null) this.asc.setInfo("smilesString", s);
if (!this.htParams.containsKey("templateAtomCount")) this.htParams.put("templateAtomCount", Integer.$valueOf(this.asc.ac));
if (this.bsFilter != null) {
this.htParams.put("filteredAtomCount", Integer.$valueOf(JU.BSUtil.cardinalityOf(this.bsFilter)));
this.htParams.put("bsFilter", this.bsFilter);
}if (!this.calculationType.equals("?")) this.asc.setInfo("calculationType", this.calculationType);
var name = this.asc.fileTypeName;
var fileType = name;
if (fileType.indexOf("(") >= 0) fileType = fileType.substring(0, fileType.indexOf("("));
for (var i = this.asc.atomSetCount; --i >= 0; ) {
this.asc.setModelInfoForSet("fileName", this.filePath, i);
this.asc.setModelInfoForSet("fileType", fileType, i);
}
this.asc.freeze(this.reverseModels);
if (this.asc.errorMessage != null) return this.asc.errorMessage + "\nfor file " + this.filePath + "\ntype " + name;
if (!this.merging && (this.asc.bsAtoms == null ? this.asc.ac == 0 : this.asc.bsAtoms.nextSetBit(0) < 0) && fileType.indexOf("DataOnly") < 0 && this.asc.atomSetInfo.get("dataOnly") == null) return "No atoms found\nfor file " + this.filePath + "\ntype " + name;
this.fixBaseIndices();
return this.asc;
});
Clazz_defineMethod(c$, "setError", 
function(e){
var s = e.getMessage();
if (this.line == null) this.asc.errorMessage = "Error reading file at end of file \n" + s;
 else this.asc.errorMessage = "Error reading file at line " + this.ptLine + ":\n" + this.line + "\n" + s;
e.printStackTrace();
}, "Throwable");
Clazz_defineMethod(c$, "initialize", 
function(){
if (this.htParams.containsKey("baseAtomIndex")) this.baseAtomIndex = (this.htParams.get("baseAtomIndex")).intValue();
if (this.htParams.containsKey("baseBondIndex")) this.baseBondIndex = (this.htParams.get("baseBondIndex")).intValue();
this.initializeSymmetry();
this.vwr = this.htParams.remove("vwr");
if (this.htParams.containsKey("stateScriptVersionInt")) this.stateScriptVersionInt = (this.htParams.get("stateScriptVersionInt")).intValue();
this.packingRange = this.htParams.get("packingRange");
var isHighPrecision = (this.htParams.get("highPrecision") != null);
if (this.packingRange == null && isHighPrecision) {
this.floatifyJavaDouble = false;
this.packingRange = Float.$valueOf(1.0E-4);
}this.merging = this.htParams.containsKey("merging");
this.getHeader = this.htParams.containsKey("getHeader");
this.isSequential = this.htParams.containsKey("isSequential");
this.readerName = this.htParams.get("readerName");
if (this.htParams.containsKey("outputChannel")) this.out = this.htParams.get("outputChannel");
if (this.htParams.containsKey("vibrationNumber")) this.desiredVibrationNumber = (this.htParams.get("vibrationNumber")).intValue();
 else if (this.htParams.containsKey("modelNumber")) this.desiredModelNumber = (this.htParams.get("modelNumber")).intValue();
this.applySymmetryToBonds = this.htParams.containsKey("applySymmetryToBonds");
this.bsFilter = (this.requiresBSFilter ? this.htParams.get("bsFilter") : null);
this.setFilter(null);
this.fillRange = this.htParams.get("fillRange");
this.paramsLattice = this.htParams.get("lattice");
var o = this.htParams.get("supercell");
if (this.strSupercell != null && !this.noPack) {
this.forcePacked = true;
}if (Clazz_instanceOf(o,"JU.P3")) {
var s = this.ptSupercell = o;
if (s.length() != 1) {
this.strSupercell = (Clazz_floatToInt(s.x)) + "a," + (Clazz_floatToInt(s.y)) + "b," + (Clazz_floatToInt(s.z)) + "c";
this.isSUPERCELL = true;
}} else if ((typeof(o)=='string')) {
this.strSupercell = o;
this.isSUPERCELL = true;
}var ptFile = (this.htParams.containsKey("ptFile") ? (this.htParams.get("ptFile")).intValue() : -1);
this.isTrajectory = this.htParams.containsKey("isTrajectory");
if (ptFile > 0 && this.htParams.containsKey("firstLastSteps")) {
var val = (this.htParams.get("firstLastSteps")).get(ptFile - 1);
if (Clazz_instanceOf(val,"JU.BS")) {
this.bsModels = val;
} else {
this.firstLastStep = val;
}} else if (this.htParams.containsKey("firstLastStep")) {
this.firstLastStep = this.htParams.get("firstLastStep");
} else if (this.htParams.containsKey("bsModels")) {
this.bsModels = this.htParams.get("bsModels");
}this.useFileModelNumbers = this.htParams.containsKey("useFileModelNumbers") || this.checkFilterKey("USEFILEMODELNUMBERS");
if (this.htParams.containsKey("templateAtomCount")) this.templateAtomCount = (this.htParams.get("templateAtomCount")).intValue();
if (this.bsModels != null || this.firstLastStep != null) this.desiredModelNumber = -2147483648;
if (this.bsModels == null && this.firstLastStep != null) {
if (this.firstLastStep[0] < 0) this.firstLastStep[0] = 0;
if (this.firstLastStep[2] == 0 || this.firstLastStep[1] < this.firstLastStep[0]) this.firstLastStep[1] = -1;
if (this.firstLastStep[2] < 1) this.firstLastStep[2] = 1;
this.bsModels = JU.BSUtil.newAndSetBit(this.firstLastStep[0]);
if (this.firstLastStep[1] > this.firstLastStep[0]) {
for (var i = this.firstLastStep[0]; i <= this.firstLastStep[1]; i += this.firstLastStep[2]) this.bsModels.set(i);

}}if (this.bsModels != null && (this.firstLastStep == null || this.firstLastStep[1] != -1)) this.lastModelNumber = this.bsModels.length();
this.symmetryRange = (this.htParams.containsKey("symmetryRange") ? (this.htParams.get("symmetryRange")).floatValue() : 0);
this.paramsCentroid = this.htParams.containsKey("centroid");
this.paramsPacked = this.htParams.containsKey("packed");
this.initializeSymmetryOptions();
if (this.htParams.containsKey("spaceGroupIndex")) {
this.desiredSpaceGroupIndex = (this.htParams.get("spaceGroupIndex")).intValue();
if (this.desiredSpaceGroupIndex == -2) this.sgName = this.htParams.get("spaceGroupName");
this.ignoreFileSpaceGroupName = (this.desiredSpaceGroupIndex == -2 || this.desiredSpaceGroupIndex >= 0);
this.ignoreFileSymmetryOperators = (this.desiredSpaceGroupIndex != -1);
}if (this.htParams.containsKey("unitCellOffset")) {
this.fileScaling = JU.P3.new3(1, 1, 1);
this.fileOffset = this.htParams.get("unitCellOffset");
this.fileOffsetFractional = JU.P3.newP(this.fileOffset);
this.unitCellOffsetFractional = this.htParams.containsKey("unitCellOffsetFractional");
}if (this.htParams.containsKey("unitcell")) {
var fParams = this.htParams.get("unitcell");
if (this.merging) this.setFractionalCoordinates(true);
if (fParams.length == 9) {
this.addExplicitLatticeVector(0, fParams, 0);
this.addExplicitLatticeVector(1, fParams, 3);
this.addExplicitLatticeVector(2, fParams, 6);
} else {
this.setUnitCell(fParams[0], fParams[1], fParams[2], fParams[3], fParams[4], fParams[5]);
}this.ignoreFileUnitCell = this.iHaveUnitCell;
if (this.merging && !this.iHaveUnitCell) this.setFractionalCoordinates(false);
}this.domains = this.htParams.get("domains");
this.validation = this.htParams.get("validation");
this.dssr = this.htParams.get("dssr");
this.isConcatenated = this.htParams.containsKey("concatenate");
});
Clazz_defineMethod(c$, "parsePrecision", 
function(s){
if (!this.filteredPrecision) {
var pt = s.indexOf('.') + 1;
if (pt >= 0) {
var n = s.indexOf('(');
if (n < 0) {
this.precision = Math.max(this.precision, s.length - 1 - pt);
} else {
if (this.precision == 0) this.precision = n;
this.precision = Math.min(this.precision, n - 1 - pt);
}}}return this.parseFloatStr(s);
}, "~S");
Clazz_defineMethod(c$, "setLowPrecision", 
function(){
this.lowPrecision = true;
this.cellSlop = 1.0E-4;
if (this.packingRange == null) this.packingRange = Double.$valueOf(1.0E-4);
});
Clazz_defineMethod(c$, "setPrecision", 
function(){
var isHigh;
if (this.lowPrecision) {
isHigh = false;
this.precision = 4;
} else {
if (this.precision > 1000) {
this.precision -= 1000;
} else {
this.precision = Math.min(12, Math.max(4, this.precision));
}isHigh = (this.precision >= 7);
if (isHigh) {
this.vwr.setBooleanProperty("doubleprecision", true);
if (JV.Viewer.isHighPrecision) {
this.cellSlop = 1.0E-12;
if (!this.paramsPacked) this.packingRange = Double.$valueOf(this.cellSlop);
this.asc.setInfo("highPrecision", Boolean.TRUE);
} else {
isHigh = false;
this.precision = 6;
this.appendLoadNote("Structure read has high precision but this version of Jmol uses float precision.\nUse JmolD.jar or JavaScript for full precision.");
}}}if (!isHigh) {
if (this.precision < 10) {
this.cellSlop = Math.pow(10, -this.precision);
}}this.symmetry.setPrecision(this.cellSlop);
this.unitCellParams[26] = this.cellSlop;
if (this.fileCoordinatesAreFractional) {
for (var i = this.asc.ac, n = this.asc.getLastAtomSetAtomIndex(); --i >= n; ) {
this.symmetry.twelfthify(this.asc.atoms[i]);
}
}this.appendLoadNote("Precision set to " + this.precision + "; packing set to " + (this.packingRange == null ? 0.02 : this.packingRange.floatValue()));
});
Clazz_defineMethod(c$, "initializeSymmetryOptions", 
function(){
this.latticeCells =  Clazz_newIntArray (4, 0);
this.doApplySymmetry = false;
var pt = this.paramsLattice;
if (pt == null || pt.length() == 0) {
if (!this.forcePacked && this.strSupercell == null) return;
pt = JU.P3.new3(1, 1, 1);
}this.latticeCells[0] = Clazz_floatToInt(pt.x);
this.latticeCells[1] = Clazz_floatToInt(pt.y);
this.latticeCells[2] = Clazz_floatToInt(pt.z);
if (Clazz_instanceOf(pt,"JU.T4")) this.latticeCells[3] = Clazz_floatToInt((pt).w);
this.doCentroidUnitCell = this.paramsCentroid;
if (this.doCentroidUnitCell && (this.latticeCells[2] == -1 || this.latticeCells[2] == 0)) this.latticeCells[2] = 1;
var isPacked = this.forcePacked || this.paramsPacked;
this.centroidPacked = this.doCentroidUnitCell && isPacked;
this.doPackUnitCell = !this.doCentroidUnitCell && (isPacked || this.latticeCells[2] < 0);
this.doApplySymmetry = (this.latticeCells[0] > 0 && this.latticeCells[1] > 0);
if (!this.doApplySymmetry) this.latticeCells =  Clazz_newIntArray (3, 0);
});
Clazz_defineMethod(c$, "doGetModel", 
function(modelNumber, title){
if (title != null && this.modelNameRequired != null && this.modelNameRequired.length > 0 && title.toUpperCase().indexOf(this.modelNameRequired) < 0) return false;
var isOK = (this.bsModels == null ? this.desiredModelNumber < 1 || modelNumber == this.desiredModelNumber : modelNumber > this.lastModelNumber ? false : modelNumber > 0 && this.bsModels.get(modelNumber - 1) || this.haveModel && this.firstLastStep != null && this.firstLastStep[1] < 0 && (this.firstLastStep[2] < 2 || (modelNumber - 1 - this.firstLastStep[0]) % this.firstLastStep[2] == 0));
if (isOK && this.desiredModelNumber == 0) this.discardPreviousAtoms();
this.haveModel = new Boolean (this.haveModel | isOK).valueOf();
if (isOK) this.doProcessLines = true;
return isOK;
}, "~N,~S");
Clazz_defineMethod(c$, "discardPreviousAtoms", 
function(){
this.asc.discardPreviousAtoms();
});
Clazz_defineMethod(c$, "initializeSymmetry", 
function(){
this.previousSpaceGroup = this.sgName;
this.previousUnitCell = this.unitCellParams;
this.iHaveUnitCell = this.ignoreFileUnitCell;
if (!this.ignoreFileUnitCell) {
this.unitCellParams =  Clazz_newFloatArray (27, 0);
for (var i = 27; --i >= 0; ) this.unitCellParams[i] = NaN;

this.unitCellParams[25] = this.latticeScaling;
this.unitCellParams[26] = this.cellSlop;
this.symmetry = null;
}if (!this.ignoreFileSpaceGroupName) this.sgName = "unspecified!";
this.doCheckUnitCell = false;
});
Clazz_defineMethod(c$, "newAtomSet", 
function(name){
if (this.asc.iSet >= 0) {
this.asc.newAtomSet();
this.asc.setCollectionName("<collection of " + (this.asc.iSet + 1) + " models>");
} else {
this.asc.setCollectionName(name);
}this.asc.setModelInfoForSet("name", name, Math.max(0, this.asc.iSet));
this.asc.setAtomSetName(name);
}, "~S");
Clazz_defineMethod(c$, "cloneLastAtomSet", 
function(ac, pts){
var lastAtomCount = this.asc.getLastAtomSetAtomCount();
this.asc.cloneLastAtomSetFromPoints(ac, pts);
if (this.asc.haveUnitCell) {
this.iHaveUnitCell = true;
this.doCheckUnitCell = true;
this.sgName = this.previousSpaceGroup;
this.unitCellParams = this.previousUnitCell;
}return lastAtomCount;
}, "~N,~A");
Clazz_defineMethod(c$, "setSpaceGroupName", 
function(name){
if (this.ignoreFileSpaceGroupName || name == null) return;
var s = name.trim();
if (s.length == 0 || s.equals("HM:") || s.equals(this.sgName)) return;
if (!s.equals("P1")) JU.Logger.info("Setting space group name to " + s);
this.sgName = s;
}, "~S");
Clazz_defineMethod(c$, "setSymmetryOperator", 
function(xyz){
if (this.ignoreFileSymmetryOperators) return -1;
var isym = this.asc.getXSymmetry().addSpaceGroupOperation(xyz, true);
if (isym < 0) this.warnSkippingOperation(xyz);
this.iHaveSymmetryOperators = true;
return isym;
}, "~S");
Clazz_defineMethod(c$, "warnSkippingOperation", 
function(xyz){
JU.Logger.warn("Skipping symmetry operation " + xyz);
}, "~S");
Clazz_defineMethod(c$, "initializeCartesianToFractional", 
function(){
for (var i = 0; i < 16; i++) if (!Float.isNaN(this.unitCellParams[6 + i])) return;

for (var i = 0; i < 16; i++) this.unitCellParams[6 + i] = ((i % 5 == 0 ? 1 : 0));

this.nMatrixElements = 0;
});
Clazz_defineMethod(c$, "clearUnitCell", 
function(){
if (this.ignoreFileUnitCell) return;
for (var i = 6; i < 22; i++) this.unitCellParams[i] = NaN;

this.checkUnitCell(6);
});
Clazz_defineMethod(c$, "setUnitCellItem", 
function(i, x){
if (this.ignoreFileUnitCell) return;
if (i == 0 && x == 1 && !this.allow_a_len_1 || i == 3 && x == 0) {
if (this.ucItems == null) this.ucItems =  Clazz_newFloatArray (6, 0);
this.ucItems[i] = x;
return;
}if (this.ucItems != null && i < 6) this.ucItems[i] = x;
if (!Float.isNaN(x) && i >= 6 && Float.isNaN(this.unitCellParams[6])) this.initializeCartesianToFractional();
this.unitCellParams[i] = x;
if (this.debugging) {
JU.Logger.debug("setunitcellitem " + i + " " + x);
}if (i < 6 || Float.isNaN(x)) this.iHaveUnitCell = this.checkUnitCell(6);
 else if (++this.nMatrixElements == 12) this.iHaveUnitCell = this.checkUnitCell(22);
}, "~N,~N");
Clazz_defineMethod(c$, "setUnitCell", 
function(a, b, c, alpha, beta, gamma){
if (this.ignoreFileUnitCell) return;
this.clearUnitCell();
this.unitCellParams[0] = a;
this.unitCellParams[1] = b;
this.unitCellParams[2] = c;
if (alpha != 0) this.unitCellParams[3] = alpha;
if (beta != 0) this.unitCellParams[4] = beta;
if (gamma != 0) this.unitCellParams[5] = gamma;
this.iHaveUnitCell = this.checkUnitCell(6);
}, "~N,~N,~N,~N,~N,~N");
Clazz_defineMethod(c$, "addExplicitLatticeVector", 
function(i, xyz, i0){
if (this.ignoreFileUnitCell) return;
if (i == 0) for (var j = 0; j < 6; j++) this.unitCellParams[j] = 0;

i = 6 + i * 3;
this.unitCellParams[i++] = xyz[i0++];
this.unitCellParams[i++] = xyz[i0++];
this.unitCellParams[i] = xyz[i0];
if (Float.isNaN(this.unitCellParams[0])) {
for (i = 0; i < 6; i++) this.unitCellParams[i] = -1;

}this.iHaveUnitCell = this.checkUnitCell(15);
if (this.iHaveUnitCell) {
if (this.slabXY || this.polymerX) this.unitCellParams[2] = -1;
if (this.polymerX) this.unitCellParams[1] = -1;
}}, "~N,~A,~N");
Clazz_defineMethod(c$, "checkUnitCell", 
function(n){
for (var i = 0; i < n; i++) if (Float.isNaN(this.unitCellParams[i])) return false;

this.fixFloatA(this.unitCellParams);
if (n == 22 && this.unitCellParams[0] == 1) {
if (this.unitCellParams[1] == 1 && this.unitCellParams[2] == 1 && this.unitCellParams[6] == 1 && this.unitCellParams[11] == 1 && this.unitCellParams[16] == 1) {
return false;
}}if (n == 6 && Float.isNaN(this.unitCellParams[6])) {
if (this.slabXY && this.unitCellParams[2] > 0) {
JU.SimpleUnitCell.addVectors(this.unitCellParams);
this.unitCellParams[2] = -1;
} else if (this.polymerX && this.unitCellParams[1] > 0) {
JU.SimpleUnitCell.addVectors(this.unitCellParams);
this.unitCellParams[1] = this.unitCellParams[2] = -1;
}}if (this.doApplySymmetry) {
this.getSymmetry();
this.doConvertToFractional = !this.fileCoordinatesAreFractional;
}return true;
}, "~N");
Clazz_defineMethod(c$, "getSymmetry", 
function(){
if (!this.iHaveUnitCell) return null;
if (this.symmetry == null) {
(this.symmetry = this.asc.newFileSymmetry()).setUnitCellFromParams(this.unitCellParams, false, this.cellSlop);
this.checkUnitCellOffset();
}if (this.symmetry == null) this.iHaveUnitCell = false;
 else this.symmetry.setSpaceGroupName(this.sgName);
return this.symmetry;
});
Clazz_defineMethod(c$, "checkUnitCellOffset", 
function(){
if (this.fileOffsetFractional == null || this.symmetry == null) return;
this.fileOffset.setT(this.fileOffsetFractional);
if (this.unitCellOffsetFractional != this.fileCoordinatesAreFractional) {
if (this.unitCellOffsetFractional) this.symmetry.toCartesian(this.fileOffset, false);
 else this.symmetry.toFractional(this.fileOffset, false);
}});
Clazz_defineMethod(c$, "fractionalizeCoordinates", 
function(toFrac){
if (this.getSymmetry() == null) return;
var a = this.asc.atoms;
if (toFrac) for (var i = this.asc.ac; --i >= 0; ) this.symmetry.toFractional(a[i], false);

 else for (var i = this.asc.ac; --i >= 0; ) this.symmetry.toCartesian(a[i], false);

this.setFractionalCoordinates(toFrac);
}, "~B");
Clazz_defineMethod(c$, "setFractionalCoordinates", 
function(TF){
this.iHaveFractionalCoordinates = this.fileCoordinatesAreFractional = TF;
this.checkUnitCellOffset();
}, "~B");
Clazz_defineMethod(c$, "setFilterAtomTypeStr", 
function(s){
this.filterAtomTypeStr = s;
this.filterAtomNameTerminator = "\0";
}, "~S");
Clazz_defineMethod(c$, "setFilter", 
function(filter0){
if (filter0 == null) {
filter0 = this.htParams.get("filter");
} else {
this.bsFilter = null;
this.filterCased = null;
}if (this.filterCased == null) this.filterCased = (filter0 == null ? null : filter0 + ";");
if (filter0 != null) filter0 = filter0.toUpperCase();
this.filter = filter0;
if (this.filter == null) return;
this.checkFilterKeys();
this.filterSymmetry();
this.filterModelName();
this.filterAtoms();
var s = this.getFilter("FILESCALING=");
if (s != null) {
var fs = this.parseFloatStr(s);
this.fileScaling = JU.P3.new3(fs, fs, fs);
this.fileOffset =  new JU.P3();
}}, "~S");
Clazz_defineMethod(c$, "filterAtoms", 
function(){
if (this.checkFilterKey("HETATM")) {
this.filterHetero = true;
this.filter = JU.PT.rep(this.filter, "HETATM", "HETATM-Y");
this.filterCased = JU.PT.rep(this.filterCased, "HETATM", "HETATM-Y");
}if (this.checkFilterKey("ATOM")) {
this.filterHetero = true;
this.filter = JU.PT.rep(this.filter, "ATOM", "HETATM-N");
this.filterCased = JU.PT.rep(this.filterCased, "ATOM", "HETATM-N");
}this.filterAtomName = this.checkFilterKey("*.") || this.checkFilterKey("!.");
if (this.filter.startsWith("_") || this.filter.startsWith("!_") || this.filter.indexOf(";_") >= 0 || this.filter.indexOf(";!_") >= 0) this.filterElement = this.checkFilterKey("_");
this.filterGroup3 = this.checkFilterKey("[");
this.filterChain = this.checkFilterKey(":");
this.filterAltLoc = this.checkFilterKey("%");
this.filterEveryNth = this.checkFilterKey("/=");
this.filterAllHetero = this.checkFilterKey("ALLHET");
if (this.filterEveryNth) this.filterN = this.parseIntAt(this.filter, this.filter.indexOf("/=") + 2);
 else if (this.filter.startsWith("=") || this.filter.indexOf(";=") >= 0) this.filterAtomType = this.checkFilterKey("=");
if (this.filterN == -2147483648) this.filterEveryNth = false;
this.haveAtomFilter = this.filterAtomName || this.filterAtomType || this.filterElement || this.filterGroup3 || this.filterChain || this.filterAltLoc || this.filterHetero || this.filterEveryNth || this.checkFilterKey("/=");
if (this.bsFilter == null) {
this.bsFilter =  new JU.BS();
this.htParams.put("bsFilter", this.bsFilter);
if (this.haveAtomFilter) {
var ipt;
this.filter1Cased = this.filterCased;
this.filter2Cased = "";
if ((ipt = this.filter.indexOf("|")) >= 0) {
this.filter1Cased = this.filter.substring(0, ipt).trim() + ";";
this.filter2Cased = ";" + this.filter.substring(ipt).trim();
}this.filter1 = this.filter1Cased.toUpperCase();
this.filter2 = (this.filter2Cased.length == 0 ? null : this.filter2Cased.toUpperCase());
}}});
Clazz_defineMethod(c$, "filterModelName", 
function(){
this.modelNameRequired = JU.PT.getQuotedAttribute(this.filter, "NAME");
if (this.modelNameRequired == null) return;
if (this.modelNameRequired.length == 0) {
this.modelNameRequired = this.getFilter("NAME=");
if (this.modelNameRequired.startsWith("'")) this.modelNameRequired = JU.PT.split(this.modelNameRequired, "'")[1];
}this.filter = JU.PT.rep(this.filter, this.modelNameRequired, "");
this.filter = JU.PT.rep(this.filter, "NAME=", "");
this.filter = JU.PT.rep(this.filter, "\"\"", "");
this.filter = JU.PT.rep(this.filter, "''", "");
});
Clazz_defineMethod(c$, "filterSymmetry", 
function(){
if (this.checkFilterKey("CELL=")) this.strSupercell = this.filter.substring(this.filter.indexOf("CELL=") + 5).toLowerCase();
this.filter = ";" + this.filter + ";";
JU.Logger.info("filtering with " + this.filter);
var s = this.getFilter("SYMOP=");
if (s != null) this.filterSymop = " " + s.$replace(',', ' ') + " ";
this.filter = this.filter.$replace(',', ';');
var p = this.getFilter("PRECISION=");
if (p != null) {
var prec = JU.PT.parseInt(p);
if (prec > 0 && prec <= 16) {
this.precision = 1000 + prec;
this.filteredPrecision = true;
}}s = this.getFilter("LATTICESCALING=");
if (s != null && this.unitCellParams.length > 25) this.unitCellParams[25] = this.latticeScaling = this.parseFloatStr(s);
});
Clazz_defineMethod(c$, "checkFilterKeys", 
function(){
this.doSetOrientation = !this.checkFilterKey("NOORIENT");
this.doCentralize = (!this.checkFilterKey("NOCENTER") && this.checkFilterKey("CENTER"));
this.addVibrations = !this.checkFilterKey("NOVIB");
this.ignoreStructure = this.checkFilterKey("DSSP");
this.isDSSP1 = this.checkFilterKey("DSSP1");
this.doReadMolecularOrbitals = !this.checkFilterKey("NOMO");
this.useAltNames = this.checkFilterKey("ALTNAME");
this.reverseModels = this.checkFilterKey("REVERSEMODELS");
this.allow_a_len_1 = this.checkFilterKey("TOPOS");
this.slabXY = this.checkFilterKey("SLABXY");
this.polymerX = !this.slabXY && this.checkFilterKey("POLYMERX");
this.noHydrogens = this.checkFilterKey("NOH");
this.noMinimize = this.checkFilterKey("NOMIN");
this.optimize2D = this.checkFilterKey("2D") && !this.noHydrogens && !this.noMinimize;
this.noPack = this.checkFilterKey("NOPACK");
this.openVarna = this.checkFilterKey("VARNA");
if (this.checkFilterKey("LOWPRECISION")) {
this.setLowPrecision();
}if (this.checkFilterKey("HETATM")) {
this.filterHetero = true;
this.filter = JU.PT.rep(this.filter, "HETATM", "HETATM-Y");
this.filterCased = JU.PT.rep(this.filterCased, "HETATM", "HETATM-Y");
}if (this.checkFilterKey("ATOM")) {
this.filterHetero = true;
this.filter = JU.PT.rep(this.filter, "ATOM", "HETATM-N");
this.filterCased = JU.PT.rep(this.filterCased, "ATOM", "HETATM-N");
}});
Clazz_defineMethod(c$, "getFilterWithCase", 
function(key){
var pt = (this.filterCased == null ? -1 : this.filterCased.toUpperCase().indexOf(key.toUpperCase()));
return (pt < 0 ? null : this.filterCased.substring(pt + key.length, this.filterCased.indexOf(";", pt)));
}, "~S");
Clazz_defineMethod(c$, "getFilter", 
function(key){
var pt = (this.filter == null ? -1 : this.filter.indexOf(key));
return (pt < 0 ? null : this.filter.substring(pt + key.length, this.filter.indexOf(";", pt)));
}, "~S");
Clazz_defineMethod(c$, "checkFilterKey", 
function(key){
return (this.filter != null && this.filter.indexOf(key) >= 0);
}, "~S");
Clazz_defineMethod(c$, "checkAndRemoveFilterKey", 
function(key){
if (!this.checkFilterKey(key)) return false;
this.filter = JU.PT.rep(this.filter, key, "");
if (this.filter.length < 3) this.filter = null;
return true;
}, "~S");
Clazz_defineMethod(c$, "filterAtom", 
function(atom, iAtom){
if (!this.haveAtomFilter) return true;
var isOK = this.checkFilter(atom, this.filter1, this.filter1Cased);
if (this.filter2 != null) isOK = new Boolean (isOK | this.checkFilter(atom, this.filter2, this.filter2Cased)).valueOf();
if (isOK && this.filterEveryNth && (!atom.isHetero || !this.filterAllHetero)) isOK = (((this.nFiltered++) % this.filterN) == 0);
this.bsFilter.setBitTo(iAtom >= 0 ? iAtom : this.asc.ac, isOK);
return isOK;
}, "J.adapter.smarter.Atom,~N");
Clazz_defineMethod(c$, "checkFilter", 
function(atom, f, fCased){
if (atom.isHetero && this.filterAllHetero) return true;
return (!this.filterGroup3 || atom.group3 == null || !this.filterReject(f, "[", atom.group3.toUpperCase() + "]")) && (!this.filterAtomName || this.allowAtomName(atom.atomName, f)) && (this.filterAtomTypeStr == null || atom.atomName == null || atom.atomName.toUpperCase().indexOf("\0" + this.filterAtomTypeStr) >= 0) && (!this.filterElement || atom.elementSymbol == null || !this.filterReject(f, "_", atom.elementSymbol.toUpperCase() + ";")) && (!this.filterChain || atom.chainID == 0 || !this.filterReject(fCased, ":", "" + this.vwr.getChainIDStr(atom.chainID))) && (!this.filterAltLoc || atom.altLoc == '\0' || !this.filterReject(f, "%", "" + atom.altLoc)) && (!this.filterHetero || !this.allowPDBFilter || !this.filterReject(f, "HETATM", atom.isHetero ? "-Y" : "-N"));
}, "J.adapter.smarter.Atom,~S,~S");
Clazz_defineMethod(c$, "rejectAtomName", 
function(name){
return this.filterAtomName && !this.allowAtomName(name, this.filter);
}, "~S");
Clazz_defineMethod(c$, "allowAtomName", 
function(atomName, f){
return (atomName == null || !this.filterReject(f, ".", atomName.toUpperCase() + this.filterAtomNameTerminator));
}, "~S,~S");
Clazz_defineMethod(c$, "filterReject", 
function(f, code, atomCode){
return (f.indexOf(code) >= 0 && (f.indexOf("!" + code) >= 0) == (f.indexOf(code + atomCode) >= 0));
}, "~S,~S,~S");
Clazz_defineMethod(c$, "set2D", 
function(){
this.asc.setInfo("is2D", Boolean.TRUE);
this.asc.getBSAtoms(-1);
if (this.noHydrogens) {
this.asc.setInfo("noHydrogen", Boolean.TRUE);
this.optimize2D = false;
}if (this.optimize2D) {
this.asc.fix2Stereo();
this.asc.setInfo("doMinimize", Boolean.TRUE);
this.appendLoadNote("This model is 2D. Its 3D structure was generated.");
} else {
this.appendLoadNote("This model is 2D. Its 3D structure has not been generated; use LOAD \"\" FILTER \"2D\" to optimize 3D.");
this.addJmolScript("select thismodel;wireframe only");
}});
Clazz_defineMethod(c$, "doGetVibration", 
function(vibrationNumber){
return this.addVibrations && (this.desiredVibrationNumber <= 0 || vibrationNumber == this.desiredVibrationNumber);
}, "~N");
Clazz_defineMethod(c$, "setTransform", 
function(x1, y1, z1, x2, y2, z2, x3, y3, z3){
if (this.matRot != null || !this.doSetOrientation) return;
this.matRot =  new JU.M3();
var v = JU.V3.new3(x1, y1, z1);
v.normalize();
this.matRot.setColumnV(0, v);
v.set(x2, y2, z2);
v.normalize();
this.matRot.setColumnV(1, v);
v.set(x3, y3, z3);
v.normalize();
this.matRot.setColumnV(2, v);
this.asc.setInfo("defaultOrientationMatrix", JU.M3.newM3(this.matRot));
var q = JU.Quat.newM(this.matRot);
this.asc.setInfo("defaultOrientationQuaternion", q);
JU.Logger.info("defaultOrientationMatrix = " + this.matRot);
}, "~N,~N,~N,~N,~N,~N,~N,~N,~N");
Clazz_defineMethod(c$, "setAtomCoordXYZ", 
function(atom, x, y, z){
atom.set(x, y, z);
this.setAtomCoord(atom);
}, "J.adapter.smarter.Atom,~N,~N,~N");
Clazz_defineMethod(c$, "setAtomCoordScaled", 
function(atom, tokens, i, f){
if (atom == null) atom = this.asc.addNewAtom();
this.setAtomCoordXYZ(atom, this.parsePrecision(tokens[i]) * f, this.parsePrecision(tokens[i + 1]) * f, this.parsePrecision(tokens[i + 2]) * f);
return atom;
}, "J.adapter.smarter.Atom,~A,~N,~N");
Clazz_defineMethod(c$, "setAtomCoordTokens", 
function(atom, tokens, i){
this.setAtomCoordXYZ(atom, this.parsePrecision(tokens[i]), this.parsePrecision(tokens[i + 1]), this.parsePrecision(tokens[i + 2]));
}, "J.adapter.smarter.Atom,~A,~N");
Clazz_defineMethod(c$, "addAtomXYZSymName", 
function(tokens, i, sym, name){
var atom = this.asc.addNewAtom();
if (sym != null) atom.elementSymbol = sym;
if (name != null) atom.atomName = name;
this.setAtomCoordTokens(atom, tokens, i);
return atom;
}, "~A,~N,~S,~S");
Clazz_defineMethod(c$, "setAtomCoord", 
function(atom){
var mustFractionalize = (this.doConvertToFractional && !this.fileCoordinatesAreFractional && this.getSymmetry() != null);
if (this.fileScaling != null) {
atom.x = atom.x * this.fileScaling.x + this.fileOffset.x;
atom.y = atom.y * this.fileScaling.y + this.fileOffset.y;
atom.z = atom.z * this.fileScaling.z + this.fileOffset.z;
}if (mustFractionalize) {
if (!this.symmetry.haveUnitCell()) this.symmetry.setUnitCellFromParams(this.unitCellParams, false, NaN);
this.symmetry.toFractional(atom, false);
this.iHaveFractionalCoordinates = true;
}if (this.floatifyJavaDouble && this.fileCoordinatesAreFractional) this.fixFloatPt(atom, 100000.0);
this.doCheckUnitCell = true;
}, "J.adapter.smarter.Atom");
Clazz_defineMethod(c$, "addSites", 
function(htSites){
this.asc.setCurrentModelInfo("pdbSites", htSites);
var sites = "";
for (var entry, $entry = htSites.entrySet().iterator (); $entry.hasNext()&& ((entry = $entry.next ()) || true);) {
var name = entry.getKey();
var htSite = entry.getValue();
var ch;
for (var i = name.length; --i >= 0; ) if (!JU.PT.isLetterOrDigit(ch = name.charAt(i)) && ch != '\'') name = name.substring(0, i) + "_" + name.substring(i + 1);

var groups = htSite.get("groups");
if (groups.length == 0) continue;
this.addSiteScript("@site_" + name + " " + groups);
this.addSiteScript("site_" + name + " = [\"" + JU.PT.rep(groups, ",", "\",\"") + "\"]");
sites += ",\"site_" + name + "\"";
}
if (sites.length > 0) this.addSiteScript("site_list = [" + sites.substring(1) + "]");
}, "java.util.Map");
Clazz_defineMethod(c$, "applySymmetryAndSetTrajectory", 
function(){
this.applySymTrajASCR();
});
Clazz_defineMethod(c$, "applySymTrajASCR", 
function(){
if (this.forcePacked) this.initializeSymmetryOptions();
var doApply = (this.iHaveUnitCell && this.doCheckUnitCell);
var sym = null;
if (doApply) {
sym = this.getSymmetry();
this.setPrecision();
sym = this.asc.getXSymmetry().applySymmetryFromReader(sym);
} else {
this.asc.setTensors();
}if (this.isTrajectory) this.asc.setTrajectory();
if (this.moreUnitCellInfo != null) {
this.setMoreInfo();
this.moreUnitCellInfo = null;
}this.finalizeSubclassSymmetry(sym != null);
if (this.merging && sym != null && this.iHaveFractionalCoordinates && this.iHaveUnitCell && this.iHaveSymmetryOperators) {
this.fractionalizeCoordinates(false);
this.addJmolScript("modelkit spacegroup P1");
}this.initializeSymmetry();
return sym;
});
Clazz_defineMethod(c$, "setMoreInfo", 
function(){
this.asc.setCurrentModelInfo("moreUnitCellInfo", this.moreUnitCellInfo);
for (var i = this.moreUnitCellInfo.size(); --i >= 0; ) {
var s = this.moreUnitCellInfo.get(i).$plit("=");
this.asc.setCurrentModelInfo(s[0], s[1]);
}
});
Clazz_defineMethod(c$, "finalizeSubclassSymmetry", 
function(haveSymmetry){
}, "~B");
Clazz_defineMethod(c$, "doPreSymmetry", 
function(doApplySymmetry){
}, "~B");
Clazz_defineMethod(c$, "finalizeMOData", 
function(moData){
this.asc.setCurrentModelInfo("moData", moData);
if (moData == null) return;
var orbitals = moData.get("mos");
if (orbitals != null) JU.Logger.info(orbitals.size() + " molecular orbitals read in model " + this.asc.atomSetCount);
}, "java.util.Map");
c$.getElementSymbol = Clazz_defineMethod(c$, "getElementSymbol", 
function(elementNumber){
return J.api.JmolAdapter.getElementSymbol(elementNumber);
}, "~N");
Clazz_defineMethod(c$, "fillDataBlock", 
function(data, minLineLen){
var nLines = data.length;
for (var i = 0; i < nLines; i++) {
data[i] = JU.PT.getTokens(this.discardLinesUntilNonBlank());
if (data[i].length < minLineLen) --i;
}
}, "~A,~N");
Clazz_defineMethod(c$, "fill3x3", 
function(tokens, pt){
var a =  Clazz_newDoubleArray (3, 3, 0);
var needTokens = (tokens == null);
var pt0 = pt;
for (var i = 0; i < 3; i++) {
if (needTokens || pt >= tokens.length) {
while ((tokens = JU.PT.getTokens(this.rd())).length < 3) {
}
pt = (pt0 < 0 ? tokens.length + pt0 : pt0);
}for (var j = 0; j < 3; j++) a[i][j] = Double.$valueOf(tokens[pt++]).doubleValue();

}
return a;
}, "~A,~N");
Clazz_defineMethod(c$, "fillFloatArray", 
function(s, width, data){
var tokens =  new Array(0);
var pt = 0;
for (var i = 0; i < data.length; i++) {
while (tokens != null && pt >= tokens.length) {
if (s == null) s = this.rd();
if (width == 0) {
tokens = JU.PT.getTokens(s);
} else {
tokens =  new Array(Clazz_doubleToInt(s.length / width));
for (var j = 0; j < tokens.length; j++) tokens[j] = s.substring(j * width, (j + 1) * width);

}s = null;
pt = 0;
}
if (tokens == null) break;
data[i] = this.parseFloatStr(tokens[pt++]);
}
return data;
}, "~S,~N,~A");
Clazz_defineMethod(c$, "fillFrequencyData", 
function(iAtom0, ac, modelAtomCount, ignore, isWide, col0, colWidth, atomIndexes, minLineLen, data){
var withSymmetry = (ac != 0 && modelAtomCount != ac && data == null);
if (ac == 0 && atomIndexes != null) ac = atomIndexes.length;
var nLines = (isWide ? ac : ac * 3);
var nFreq = ignore.length;
if (data == null) {
data =  new Array(nLines);
this.fillDataBlockFixed(data, col0, colWidth, minLineLen);
} else if (!isWide) {
var ptNonblank = minLineLen;
this.fillDataBlockFixed(data, col0, colWidth, -ptNonblank);
if (data[0] == null) return;
iAtom0 += this.parseIntAt(this.line, ptNonblank - 5) - 1;
}for (var i = 0, atomPt = 0; i < nLines; i++, atomPt++) {
var values = data[i];
var valuesY = (isWide ? null : data[++i]);
var valuesZ = (isWide ? null : data[++i]);
var dataPt = values.length - (isWide ? nFreq * 3 : nFreq) - 1;
for (var j = 0, jj = 0; jj < nFreq; jj++) {
++dataPt;
var x = values[dataPt];
if (x.charAt(0) == ')') x = x.substring(1);
var vx = this.parseFloatStr(x);
var vy = this.parseFloatStr(isWide ? values[++dataPt] : valuesY[dataPt]);
var vz = this.parseFloatStr(isWide ? values[++dataPt] : valuesZ[dataPt]);
if (ignore[jj]) continue;
var iAtom = (atomIndexes == null ? atomPt : atomIndexes[atomPt]);
if (iAtom < 0) continue;
iAtom += iAtom0 + modelAtomCount * j++;
if (this.debugging) JU.Logger.debug("atom " + iAtom + " vib" + j + ": " + vx + " " + vy + " " + vz);
this.asc.addVibrationVectorWithSymmetry(iAtom, vx, vy, vz, withSymmetry);
}
}
}, "~N,~N,~N,~A,~B,~N,~N,~A,~N,~A");
Clazz_defineMethod(c$, "fillDataBlockFixed", 
function(data, col0, colWidth, minLineLen){
if (colWidth == 0) {
this.fillDataBlock(data, minLineLen);
return;
}var nLines = data.length;
for (var i = 0; i < nLines; i++) {
this.discardLinesUntilNonBlank();
if (minLineLen < 0 && this.line.charAt(-minLineLen) == ' ') {
data[0] = null;
return;
}var nFields = Clazz_doubleToInt((this.line.length - col0 + 1) / colWidth);
data[i] =  new Array(nFields);
for (var j = 0, start = col0; j < nFields; j++, start += colWidth) data[i][j] = this.line.substring(start, Math.min(this.line.length, start + colWidth));

}
}, "~A,~N,~N,~N");
Clazz_defineMethod(c$, "readLines", 
function(nLines){
for (var i = nLines; --i >= 0; ) this.rd();

return this.line;
}, "~N");
Clazz_defineMethod(c$, "discardLinesUntilStartsWith", 
function(startsWith){
while (this.rd() != null && !this.line.startsWith(startsWith)) {
}
return this.line;
}, "~S");
Clazz_defineMethod(c$, "discardLinesUntilContains", 
function(containsMatch){
while (this.rd() != null && this.line.indexOf(containsMatch) < 0) {
}
return this.line;
}, "~S");
Clazz_defineMethod(c$, "discardLinesUntilContains2", 
function(s1, s2){
while (this.rd() != null && this.line.indexOf(s1) < 0 && this.line.indexOf(s2) < 0) {
}
return this.line;
}, "~S,~S");
Clazz_defineMethod(c$, "discardLinesUntilBlank", 
function(){
while (this.rd() != null && this.line.trim().length != 0) {
}
return this.line;
});
Clazz_defineMethod(c$, "discardLinesUntilNonBlank", 
function(){
while (this.rd() != null && this.line.trim().length == 0) {
}
return this.line;
});
Clazz_defineMethod(c$, "checkLineForScript", 
function(line){
this.line = line;
this.checkCurrentLineForScript();
}, "~S");
Clazz_defineMethod(c$, "checkCurrentLineForScript", 
function(){
if (this.line.endsWith("#noautobond")) {
this.line = this.line.substring(0, this.line.lastIndexOf('#')).trim();
this.asc.setNoAutoBond();
}var pt = this.line.indexOf("jmolscript:");
if (pt >= 0) {
var script = this.line.substring(pt + 11, this.line.length);
if (script.indexOf("#") >= 0) {
script = script.substring(0, script.indexOf("#"));
}this.addJmolScript(script);
this.line = this.line.substring(0, pt).trim();
}});
Clazz_defineMethod(c$, "addJmolScript", 
function(script){
JU.Logger.info("#jmolScript: " + script);
if (this.previousScript == null) this.previousScript = "";
 else if (!this.previousScript.endsWith(";")) this.previousScript += ";";
this.previousScript += script;
this.asc.setInfo("jmolscript", this.previousScript);
}, "~S");
Clazz_defineMethod(c$, "addSiteScript", 
function(script){
if (this.siteScript == null) this.siteScript = "";
 else if (!this.siteScript.endsWith(";")) this.siteScript += ";";
this.siteScript += script;
this.asc.setInfo("sitescript", this.siteScript);
}, "~S");
Clazz_defineMethod(c$, "rd", 
function(){
return this.RL();
});
Clazz_defineMethod(c$, "RL", 
function(){
this.prevline = this.line;
this.line = this.reader.readLine();
if (this.out != null && this.line != null) this.out.append(this.line).append("\n");
this.ptLine++;
if (this.debugging && this.line != null) JU.Logger.info(this.line);
return this.line;
});
c$.getStrings = Clazz_defineMethod(c$, "getStrings", 
function(sinfo, nFields, width){
var fields =  new Array(nFields);
for (var i = 0, pt = 0; i < nFields; i++, pt += width) fields[i] = sinfo.substring(pt, pt + width);

return fields;
}, "~S,~N,~N");
Clazz_defineMethod(c$, "getTokens", 
function(){
return JU.PT.getTokens(this.line);
});
c$.getTokensFloat = Clazz_defineMethod(c$, "getTokensFloat", 
function(s, f, n){
if (f == null) f =  Clazz_newFloatArray (n, 0);
JU.PT.parseFloatArrayDataN(JU.PT.getTokens(s), f, n);
return f;
}, "~S,~A,~N");
Clazz_defineMethod(c$, "parseFloat", 
function(){
return JU.PT.parseFloatNext(this.line, this.next);
});
Clazz_defineMethod(c$, "parseFloatStr", 
function(s){
this.next[0] = 0;
return JU.PT.parseFloatNext(s, this.next);
}, "~S");
Clazz_defineMethod(c$, "parseFloatRange", 
function(s, iStart, iEnd){
this.next[0] = iStart;
return JU.PT.parseFloatRange(s, iEnd, this.next);
}, "~S,~N,~N");
Clazz_defineMethod(c$, "parseInt", 
function(){
return JU.PT.parseIntNext(this.line, this.next);
});
Clazz_defineMethod(c$, "parseIntStr", 
function(s){
this.next[0] = 0;
return JU.PT.parseIntNext(s, this.next);
}, "~S");
Clazz_defineMethod(c$, "parseIntAt", 
function(s, iStart){
this.next[0] = iStart;
return JU.PT.parseIntNext(s, this.next);
}, "~S,~N");
Clazz_defineMethod(c$, "parseIntRange", 
function(s, iStart, iEnd){
this.next[0] = iStart;
return JU.PT.parseIntRange(s, iEnd, this.next);
}, "~S,~N,~N");
Clazz_defineMethod(c$, "parseToken", 
function(){
return JU.PT.parseTokenNext(this.line, this.next);
});
Clazz_defineMethod(c$, "parseTokenStr", 
function(s){
this.next[0] = 0;
return JU.PT.parseTokenNext(s, this.next);
}, "~S");
Clazz_defineMethod(c$, "parseTokenNext", 
function(s){
return JU.PT.parseTokenNext(s, this.next);
}, "~S");
Clazz_defineMethod(c$, "parseTokenRange", 
function(s, iStart, iEnd){
this.next[0] = iStart;
return JU.PT.parseTokenRange(s, iEnd, this.next);
}, "~S,~N,~N");
c$.getFortranFormatLengths = Clazz_defineMethod(c$, "getFortranFormatLengths", 
function(s){
var vdata =  new JU.Lst();
var n = 0;
var c = 0;
var factor = 1;
var inN = false;
var inCount = true;
s += ",";
for (var i = 0; i < s.length; i++) {
var ch = s.charAt(i);
switch ((ch).charCodeAt(0)) {
case 46:
inN = false;
continue;
case 44:
for (var j = 0; j < c; j++) vdata.addLast(Integer.$valueOf(n * factor));

inN = false;
inCount = true;
c = 0;
continue;
case 88:
n = c;
c = 1;
factor = -1;
continue;
}
var isDigit = JU.PT.isDigit(ch);
if (isDigit) {
if (inN) n = n * 10 + ch.charCodeAt(0) - 48;
 else if (inCount) c = c * 10 + ch.charCodeAt(0) - 48;
} else if (JU.PT.isLetter(ch)) {
n = 0;
inN = true;
inCount = false;
factor = 1;
} else {
inN = false;
}}
return vdata;
}, "~S");
Clazz_defineMethod(c$, "read3Vectors", 
function(isBohr){
var vectors =  new Array(3);
var f =  Clazz_newFloatArray (3, 0);
for (var i = 0; i < 3; i++) {
if (i > 0 || Float.isNaN(this.parseFloatStr(this.line))) {
this.rd();
if (i == 0 && this.line != null) {
i = -1;
continue;
}}this.fillFloatArray(this.line, 0, f);
vectors[i] =  new JU.V3();
vectors[i].setA(f);
if (isBohr) vectors[i].scale(0.5291772);
}
return vectors;
}, "~B");
Clazz_defineMethod(c$, "setElementAndIsotope", 
function(atom, str){
var isotope = this.parseIntStr(str);
if (isotope == -2147483648) {
atom.elementSymbol = str;
} else {
str = str.substring(("" + isotope).length);
atom.elementNumber = (str.length == 0 ? isotope : ((isotope << 7) + J.api.JmolAdapter.getElementNumber(str)));
}}, "J.adapter.smarter.Atom,~S");
Clazz_defineMethod(c$, "finalizeModelSet", 
function(){
});
Clazz_defineMethod(c$, "setChainID", 
function(atom, label){
atom.chainID = this.vwr.getChainID(label, true);
}, "J.adapter.smarter.Atom,~S");
Clazz_overrideMethod(c$, "readNextLine", 
function(){
if (this.rd() != null && this.line.indexOf("#jmolscript:") >= 0) this.checkCurrentLineForScript();
return this.line;
});
Clazz_defineMethod(c$, "addMoreUnitCellInfo", 
function(info){
if (this.moreUnitCellInfo == null) this.moreUnitCellInfo =  new JU.Lst();
this.moreUnitCellInfo.addLast(info);
}, "~S");
Clazz_defineMethod(c$, "getInterface", 
function(className){
var o = J.api.Interface.getInterface(className, this.vwr, "file");
if (o == null) throw  new NullPointerException("Interface");
return o;
}, "~S");
Clazz_defineMethod(c$, "forceSymmetry", 
function(andPack){
if (andPack) this.doPackUnitCell = andPack;
if (!this.doApplySymmetry) {
this.doApplySymmetry = true;
this.latticeCells[0] = this.latticeCells[1] = this.latticeCells[2] = 1;
}}, "~B");
Clazz_defineMethod(c$, "fixFloatA", 
function(pts){
if (this.floatifyJavaDouble) for (var i = pts.length; --i >= 0; ) if (!Float.isNaN(pts[i])) pts[i] = JU.PT.fixFloat(pts[i], 100000.0);

}, "~A");
Clazz_defineMethod(c$, "fixDoubleA", 
function(pts){
if (this.floatifyJavaDouble) for (var i = pts.length; --i >= 0; ) if (!Double.isNaN(pts[i])) pts[i] = JU.PT.fixDouble(pts[i], 100000.0);

}, "~A");
Clazz_defineMethod(c$, "fixFloatPt", 
function(pt, prec){
if (this.floatifyJavaDouble) JU.PT.fixPtFloats(pt, prec);
}, "JU.P3,~N");
});
;//5.0.1-v7 Mon Aug 24 10:01:38 CDT 2026
Clazz_declarePackage("J.adapter.smarter");
(function(){
var c$ = Clazz_decorateAsClass(function(){
this.atomSetIndex = 0;
Clazz_instantialize(this, arguments);}, J.adapter.smarter, "AtomSetObject", null);
})();
;//5.0.1-v7 Mon Aug 17 10:07:10 MDT 2026
Clazz_declarePackage("J.adapter.smarter");
Clazz_load(["J.adapter.smarter.AtomSetObject"], "J.adapter.smarter.Bond", null, function(){
var c$ = Clazz_decorateAsClass(function(){
this.atomIndex1 = 0;
this.atomIndex2 = 0;
this.order = 0;
this.pymolRadius = -1;
this.colix = -1;
this.uniqueID = -1;
this.distance = 0;
Clazz_instantialize(this, arguments);}, J.adapter.smarter, "Bond", J.adapter.smarter.AtomSetObject);
Clazz_makeConstructor(c$, 
function(atomIndex1, atomIndex2, order){
Clazz_superConstructor (this, J.adapter.smarter.Bond, []);
this.atomIndex1 = atomIndex1;
this.atomIndex2 = atomIndex2;
this.order = order;
}, "~N,~N,~N");
Clazz_overrideMethod(c$, "toString", 
function(){
return "[Bond " + this.atomIndex1 + " " + this.atomIndex2 + " " + this.order + "]";
});
});
;//5.0.1-v7 Mon Aug 17 10:07:10 MDT 2026
Clazz_declarePackage("J.adapter.smarter");
Clazz_load(["J.api.JmolAdapterBondIterator"], "J.adapter.smarter.BondIterator", null, function(){
var c$ = Clazz_decorateAsClass(function(){
this.bsAtoms = null;
this.bonds = null;
this.ibond = 0;
this.bond = null;
this.bondCount = 0;
Clazz_instantialize(this, arguments);}, J.adapter.smarter, "BondIterator", J.api.JmolAdapterBondIterator);
Clazz_makeConstructor(c$, 
function(asc){
Clazz_superConstructor (this, J.adapter.smarter.BondIterator, []);
this.bsAtoms = asc.bsAtoms;
this.bonds = asc.bonds;
this.bondCount = asc.bondCount;
this.ibond = 0;
}, "J.adapter.smarter.AtomSetCollection");
Clazz_overrideMethod(c$, "hasNext", 
function(){
if (this.ibond == this.bondCount) return false;
while ((this.bond = this.bonds[this.ibond++]) == null || (this.bsAtoms != null && (!this.bsAtoms.get(this.bond.atomIndex1) || !this.bsAtoms.get(this.bond.atomIndex2)))) if (this.ibond == this.bondCount) return false;

return true;
});
Clazz_overrideMethod(c$, "getAtomUniqueID1", 
function(){
return Integer.$valueOf(this.bond.atomIndex1);
});
Clazz_overrideMethod(c$, "getAtomUniqueID2", 
function(){
return Integer.$valueOf(this.bond.atomIndex2);
});
Clazz_overrideMethod(c$, "getEncodedOrder", 
function(){
return this.bond.order;
});
Clazz_overrideMethod(c$, "getPymolRadius", 
function(){
return this.bond.pymolRadius;
});
Clazz_overrideMethod(c$, "getColix", 
function(){
return this.bond.colix;
});
});
;//5.0.1-v7 Mon Aug 17 10:07:10 MDT 2026
Clazz_declarePackage("J.adapter.smarter");
Clazz_load(null, "J.adapter.smarter.Resolver", ["java.io.BufferedInputStream", "java.util.StringTokenizer", "JU.LimitedLineReader", "$.PT", "$.Rdr", "J.adapter.smarter.AtomSetCollectionReader", "$.SmarterJmolAdapter", "J.api.Interface", "JU.Logger"], function(){
var c$ = Clazz_declareType(J.adapter.smarter, "Resolver", null);
c$.getReaderClassBase = Clazz_defineMethod(c$, "getReaderClassBase", 
function(type){
var name = type + "Reader";
if (type.startsWith("Xml")) return "J.adapter.readers." + "xml." + name;
var key = ";" + type + ";";
for (var i = 1; i < J.adapter.smarter.Resolver.readerSets.length; i += 2) if (J.adapter.smarter.Resolver.readerSets[i].indexOf(key) >= 0) return "J.adapter.readers." + J.adapter.smarter.Resolver.readerSets[i - 1] + name;

return "J.adapter.readers." + "???." + name;
}, "~S");
c$.getFileType = Clazz_defineMethod(c$, "getFileType", 
function(br){
try {
return J.adapter.smarter.Resolver.determineAtomSetCollectionReader(br, null);
} catch (e) {
if (Clazz_exceptionOf(e, Exception)){
return null;
} else {
throw e;
}
}
}, "java.io.BufferedReader");
c$.getAtomCollectionReader = Clazz_defineMethod(c$, "getAtomCollectionReader", 
function(fullName, type, readerOrDocument, htParams, ptFile){
var readerName;
fullName = J.adapter.smarter.Resolver.fixDOSName(fullName);
var errMsg = null;
if (type == null) {
type = J.adapter.smarter.Resolver.getFileTypefromFilter(htParams.get("filter"));
}if (type != null) {
readerName = J.adapter.smarter.Resolver.getReaderFromType(type);
if (readerName == null) readerName = J.adapter.smarter.Resolver.getReaderFromType("Xml" + type);
if (readerName == null) errMsg = "unrecognized file format type " + type + " file=" + fullName;
 else JU.Logger.info("The Resolver assumes " + readerName + " file=" + fullName);
} else {
readerName = J.adapter.smarter.Resolver.determineAtomSetCollectionReader(readerOrDocument, htParams);
if (readerName.charAt(0) == '\n') errMsg = "unrecognized file format for file\n" + fullName + "\n" + J.adapter.smarter.Resolver.split(readerName, 50);
 else if (readerName.equals("spt")) errMsg = "NOTE: file recognized as a script file: " + fullName + "\n";
 else if (!fullName.equals("ligand")) JU.Logger.info("The Resolver thinks " + readerName);
}if (errMsg != null) {
J.adapter.smarter.SmarterJmolAdapter.close(readerOrDocument);
JU.Logger.error(errMsg);
return errMsg;
}htParams.put("ptFile", Integer.$valueOf(ptFile));
if (ptFile <= 0) htParams.put("readerName", readerName);
return J.adapter.smarter.Resolver.getReader(readerName, htParams);
}, "~S,~S,~O,java.util.Map,~N");
c$.getReader = Clazz_defineMethod(c$, "getReader", 
function(readerName, htParams){
var rdr = null;
var className = null;
var err = null;
className = J.adapter.smarter.Resolver.getReaderClassBase(readerName);
if ((rdr = J.api.Interface.getInterface(className, null, "reader")) == null) {
err = "File reader was not found:" + className;
JU.Logger.error(err);
return err;
}return rdr;
}, "~S,java.util.Map");
c$.getReaderFromType = Clazz_defineMethod(c$, "getReaderFromType", 
function(type){
if (type != null) {
if (type.endsWith("(XML)")) {
type = "Xml" + type.substring(0, type.length - 5);
}type = ";" + type.toLowerCase() + ";";
if (";zmatrix;cfi;c;vfi;v;mnd;jag;gms;g;gau;mp;nw;orc;pqs;qc;".indexOf(type) >= 0) return "Input";
var set;
var pt;
for (var i = J.adapter.smarter.Resolver.readerSets.length; --i >= 0; ) {
if ((pt = (set = J.adapter.smarter.Resolver.readerSets[i--]).toLowerCase().indexOf(type)) >= 0) return set.substring(pt + 1, set.indexOf(";", pt + 2));
}
}return null;
}, "~S");
c$.split = Clazz_defineMethod(c$, "split", 
function(a, n){
var s = "";
var l = a.length;
for (var i = 0, j = 0; i < l; i = j) s += a.substring(i, (j = Math.min(i + n, l))) + "\n";

return s;
}, "~S,~N");
c$.DOMResolve = Clazz_defineMethod(c$, "DOMResolve", 
function(htParams){
var rdrName = J.adapter.smarter.Resolver.getXmlType(htParams.get("nameSpaceInfo"));
if (JU.Logger.debugging) {
JU.Logger.debug("The Resolver thinks " + rdrName);
}htParams.put("readerName", rdrName);
return J.adapter.smarter.Resolver.getReader("XmlReader", htParams);
}, "java.util.Map");
c$.determineAtomSetCollectionReader = Clazz_defineMethod(c$, "determineAtomSetCollectionReader", 
function(readerOrDocument, htParams){
var readerName;
if (Clazz_instanceOf(readerOrDocument,"javajs.api.GenericBinaryDocument")) {
var doc = readerOrDocument;
readerName = J.adapter.smarter.Resolver.getBinaryType(doc.getInputStream());
return (readerName == null ? "binary file type not recognized" : readerName);
}if (Clazz_instanceOf(readerOrDocument,"java.io.InputStream")) {
readerName = J.adapter.smarter.Resolver.getBinaryType(readerOrDocument);
if (readerName != null) return readerName;
readerOrDocument = JU.Rdr.getBufferedReader( new java.io.BufferedInputStream(readerOrDocument), null);
}var rdr = readerOrDocument;
var llr =  new JU.LimitedLineReader(rdr, 16384);
var leader = llr.getHeader(64);
if (leader.length == 0) throw  new java.io.EOFException("File contains no data.");
leader = leader.trim();
var isJSONMap = false;
if (leader.length > 0) {
if (leader.indexOf("PNG") == 1 && leader.indexOf("PNGJ") >= 0) return "pngj";
if (leader.indexOf("PNG") == 1 || leader.indexOf("JPG") == 1 || leader.indexOf("JFIF") == 6) return "spt";
if (leader.indexOf("\"num_pairs\"") >= 0) return "dssr";
if (leader.indexOf("output.31\n") >= 0) return "GenNBO|output.31";
if ((readerName = J.adapter.smarter.Resolver.checkFileStart(leader)) != null) {
return (readerName.equals("Xml") ? J.adapter.smarter.Resolver.getXmlType(llr.getHeader(0)) : readerName);
}isJSONMap = (leader.charAt(0) == '{');
if (isJSONMap && (readerName = J.adapter.smarter.Resolver.checkJsonHeader(leader)) != null) {
return readerName;
}}var lines =  new Array(16);
var nLines = 0;
for (var i = 0; i < lines.length; ++i) {
lines[i] = llr.readLineWithNewline();
if (lines[i].length > 0) nLines++;
}
if ((readerName = J.adapter.smarter.Resolver.checkSpecial1(nLines, lines, leader)) != null) return readerName;
if ((readerName = J.adapter.smarter.Resolver.checkLineStarts(lines)) != null) return readerName;
if ((readerName = J.adapter.smarter.Resolver.checkHeaderContains(llr.getHeader(0))) != null) {
return readerName;
}if ((readerName = J.adapter.smarter.Resolver.checkSpecial2(lines)) != null) return readerName;
var msg;
if (isJSONMap) {
var json = rdr.readLine();
if ((readerName = J.adapter.smarter.Resolver.checkJSONContains(json)) != null) {
if (htParams != null) htParams.put("fileData", json);
return readerName;
}msg = (htParams == null ? null : json.substring(0, Math.min(100, json.length)));
} else if (htParams == null) {
msg = null;
} else {
if ((readerName = J.adapter.smarter.Resolver.getReaderFromType(htParams.get("defaultType"))) != null) {
return readerName;
}msg = "\n" + lines[0] + "\n" + lines[1] + "\n" + lines[2] + "\n";
}return msg;
}, "~O,java.util.Map");
c$.checkJsonHeader = Clazz_defineMethod(c$, "checkJsonHeader", 
function(leader){
if (leader.startsWith("{\"SSG_international_symbol")) return "FSGOutput";
return null;
}, "~S");
c$.getBinaryType = Clazz_defineMethod(c$, "getBinaryType", 
function(inputStream){
var magic = JU.Rdr.getMagic(inputStream, 100);
var m0 = magic[0] & 0xff;
return (JU.Rdr.isPickleB(magic) ? "PyMOL" : m0 == 0xDE ? (J.adapter.smarter.Resolver.bytesMatch(magic, 4, J.adapter.smarter.Resolver.mmtfMagic) ? "MMTF" : null) : m0 == 0x83 ? (J.adapter.smarter.Resolver.checkBCIF(magic, true) ? "BCIF" : null) : J.adapter.smarter.Resolver.bytesMatch(magic, 0, J.adapter.smarter.Resolver.cdxMagic) ? "CDX" : J.adapter.smarter.Resolver.bytesMatch(magic, 0, J.adapter.smarter.Resolver.cmdfMagic) ? "Cmdf" : J.adapter.smarter.Resolver.bytesMatch(magic, 0, J.adapter.smarter.Resolver.cmdxMagic) ? "Cmdx" : null);
}, "java.io.InputStream");
c$.checkBCIF = Clazz_defineMethod(c$, "checkBCIF", 
function(magic, forCoord){
if (J.adapter.smarter.Resolver.bytesMatch(magic, 10, J.adapter.smarter.Resolver.bcifMolstarMagic) || J.adapter.smarter.Resolver.bytesMatch(magic, 10, J.adapter.smarter.Resolver.bcifModelMagic) || J.adapter.smarter.Resolver.bytesMatch(magic, 10, J.adapter.smarter.Resolver.bcifModelMagic) || J.adapter.smarter.Resolver.bytesMatch(magic, 10, J.adapter.smarter.Resolver.bcifCoordMagic)) return forCoord;
if (J.adapter.smarter.Resolver.bytesMatch(magic, 10, J.adapter.smarter.Resolver.bcifDensityMagic) || J.adapter.smarter.Resolver.bytesMatch(magic, 10, J.adapter.smarter.Resolver.bcifVolumeMagic)) return !forCoord;
return ((J.adapter.smarter.Resolver.findBytes(magic, J.adapter.smarter.Resolver.bcifServerMagic) < 0) == forCoord);
}, "~A,~B");
c$.findBytes = Clazz_defineMethod(c$, "findBytes", 
function(bytes, find){
out : for (var j = bytes.length - find.length; --j >= 0; ) {
for (var i = find.length; --i >= 0; ) {
if (bytes[j + i] != find[i]) continue out;
}
return j;
}
return -1;
}, "~A,~A");
c$.bytesMatch = Clazz_defineMethod(c$, "bytesMatch", 
function(a, pt, b){
if (b.length > a.length - pt) return false;
for (var i = b.length; --i >= 0; ) {
if (a[pt + i] != b[i]) return false;
}
return true;
}, "~A,~N,~A");
c$.checkFileStart = Clazz_defineMethod(c$, "checkFileStart", 
function(leader){
for (var i = 0; i < J.adapter.smarter.Resolver.fileStartsWithRecords.length; ++i) {
var recordTags = J.adapter.smarter.Resolver.fileStartsWithRecords[i];
for (var j = 1; j < recordTags.length; ++j) {
var recordTag = recordTags[j];
if (leader.startsWith(recordTag)) return recordTags[0];
}
}
return null;
}, "~S");
c$.checkSpecial1 = Clazz_defineMethod(c$, "checkSpecial1", 
function(nLines, lines, leader){
if (nLines == 1 && lines[0].length > 0 && JU.PT.isDigit(lines[0].charAt(0))) return "Jme";
if (J.adapter.smarter.Resolver.checkMopacGraphf(lines)) return "MopacGraphf";
if (J.adapter.smarter.Resolver.checkOdyssey(lines)) return "Odyssey";
switch (J.adapter.smarter.Resolver.checkMol(lines)) {
case 1:
case 3:
case 2000:
case 3000:
return "Mol";
}
switch (J.adapter.smarter.Resolver.checkXyz(lines)) {
case 1:
return "Xyz";
case 2:
return "Bilbao";
case 3:
return "PWmat";
}
if (J.adapter.smarter.Resolver.checkAlchemy(lines[0])) return "Alchemy";
if (J.adapter.smarter.Resolver.checkFoldingXyz(lines)) return "FoldingXyz";
if (J.adapter.smarter.Resolver.checkXSF(lines)) return "Xcrysden";
if (J.adapter.smarter.Resolver.checkCube(lines)) return "Cube";
if (J.adapter.smarter.Resolver.checkWien2k(lines)) return "Wien2k";
if (J.adapter.smarter.Resolver.checkAims(lines)) return "Aims";
if (J.adapter.smarter.Resolver.checkGenNBO(lines, leader)) return "GenNBO";
return null;
}, "~N,~A,~S");
c$.checkXSF = Clazz_defineMethod(c$, "checkXSF", 
function(lines){
var i = 0;
while (lines[i].length == 0) {
i++;
}
return (lines[i].startsWith("ANIMSTEPS ") || lines[i].equals("ATOMS\n") && JU.PT.parseInt(lines[i + 1]) > 0);
}, "~A");
c$.checkAims = Clazz_defineMethod(c$, "checkAims", 
function(lines){
for (var i = 0; i < lines.length; i++) {
if (lines[i].startsWith("mol 1")) return false;
var tokens = JU.PT.getTokens(lines[i]);
if (tokens.length == 0) continue;
if (tokens[0].startsWith("atom") && tokens.length > 4 && Float.isNaN(JU.PT.parseFloat(tokens[4])) || tokens[0].startsWith("multipole") && tokens.length >= 6 || tokens[0].startsWith("lattice_vector") && tokens.length >= 4) return true;
}
return false;
}, "~A");
c$.checkAlchemy = Clazz_defineMethod(c$, "checkAlchemy", 
function(line){
var pt;
if ((pt = line.indexOf("ATOMS")) > 0 && line.indexOf("BONDS") > pt) {
var n = JU.PT.parseInt(line.substring(0, pt).trim());
return (n > 0);
}return false;
}, "~S");
c$.isInt = Clazz_defineMethod(c$, "isInt", 
function(s){
J.adapter.smarter.Resolver.n[0] = 0;
s = s.trim();
return s.length > 0 && JU.PT.parseIntNext(s, J.adapter.smarter.Resolver.n) != -2147483648 && J.adapter.smarter.Resolver.n[0] == s.length;
}, "~S");
c$.isFloat = Clazz_defineMethod(c$, "isFloat", 
function(s){
return !Float.isNaN(JU.PT.parseFloat(s));
}, "~S");
c$.checkCube = Clazz_defineMethod(c$, "checkCube", 
function(lines){
for (var j = 2; j <= 5; j++) {
var tokens2 =  new java.util.StringTokenizer(lines[j]);
var n = tokens2.countTokens();
if (!(n == 4 || j == 2 && n == 5) || !J.adapter.smarter.Resolver.isInt(tokens2.nextToken())) return false;
for (var i = 3; --i >= 0; ) if (!J.adapter.smarter.Resolver.isFloat(tokens2.nextToken())) return false;

if (n == 5 && !J.adapter.smarter.Resolver.isInt(tokens2.nextToken())) return false;
}
return true;
}, "~A");
c$.checkFoldingXyz = Clazz_defineMethod(c$, "checkFoldingXyz", 
function(lines){
var tokens =  new java.util.StringTokenizer(lines[0].trim(), " \t");
if (tokens.countTokens() < 2 || !J.adapter.smarter.Resolver.isInt(tokens.nextToken().trim())) return false;
var secondLine = lines[1].trim();
if (secondLine.length == 0) secondLine = lines[2].trim();
tokens =  new java.util.StringTokenizer(secondLine, " \t");
return (tokens.countTokens() > 0 && J.adapter.smarter.Resolver.isInt(tokens.nextToken().trim()));
}, "~A");
c$.checkGenNBO = Clazz_defineMethod(c$, "checkGenNBO", 
function(lines, leader){
return (leader.indexOf("$GENNBO") >= 0 || lines[1].startsWith(" Basis set information needed for plotting orbitals") || lines[1].indexOf("s in the AO basis:") >= 0 || lines[1].indexOf("***** NBO ") >= 0 || lines[2].indexOf(" N A T U R A L   A T O M I C   O R B I T A L") >= 0);
}, "~A,~S");
c$.checkMol = Clazz_defineMethod(c$, "checkMol", 
function(lines){
var line4trimmed = ("X" + lines[3]).trim().toUpperCase();
if (line4trimmed.length < 7 || line4trimmed.indexOf(".") >= 0 || lines[0].startsWith("data_")) return 0;
if (line4trimmed.endsWith("V2000")) return 2000;
if (line4trimmed.endsWith("V3000")) return 3000;
var n1 = JU.PT.parseInt(lines[3].substring(0, 3).trim());
var n2 = JU.PT.parseInt(lines[3].substring(3, 6).trim());
return (n1 > 0 && n2 >= 0 && lines[0].indexOf("@<TRIPOS>") != 0 && lines[1].indexOf("@<TRIPOS>") != 0 && lines[2].indexOf("@<TRIPOS>") != 0 ? 3 : 0);
}, "~A");
c$.checkMopacGraphf = Clazz_defineMethod(c$, "checkMopacGraphf", 
function(lines){
return (lines[0].indexOf("MOPAC-Graphical data") > 2);
}, "~A");
c$.checkOdyssey = Clazz_defineMethod(c$, "checkOdyssey", 
function(lines){
var i;
for (i = 0; i < lines.length; i++) if (!lines[i].startsWith("C ") && lines[i].length != 0) break;

if (i >= lines.length || lines[i].charAt(0) != ' ' || (i = i + 2) + 1 >= lines.length) return false;
var l = lines[i];
if (l.length < 3) return false;
var spin = JU.PT.parseInt(l.substring(2).trim());
var charge = JU.PT.parseInt(l.substring(0, 2).trim());
if ((l = lines[i + 1]).length < 2) return false;
var atom1 = JU.PT.parseInt(l.substring(0, 2).trim());
if (spin < 0 || spin > 5 || atom1 <= 0 || charge == -2147483648 || charge > 5) return false;
var atomline = J.adapter.smarter.AtomSetCollectionReader.getTokensFloat(l, null, 5);
return !Float.isNaN(atomline[1]) && !Float.isNaN(atomline[2]) && !Float.isNaN(atomline[3]) && Float.isNaN(atomline[4]);
}, "~A");
c$.checkWien2k = Clazz_defineMethod(c$, "checkWien2k", 
function(lines){
return (lines[2].startsWith("MODE OF CALC=") || lines[2].startsWith("             RELA") || lines[2].startsWith("             NREL"));
}, "~A");
c$.checkXyz = Clazz_defineMethod(c$, "checkXyz", 
function(lines){
var checkPWM = false;
var i = JU.PT.parseInt(lines[0]);
if (i >= 0 && lines[0].trim().equals("" + i)) {
if (J.adapter.smarter.Resolver.isInt(lines[2])) return 2;
checkPWM = true;
}if (lines[0].indexOf("Bilbao Crys") >= 0) return 2;
var s;
if ((checkPWM || lines.length > 5 && i > 0) && ((s = lines[1].trim().toUpperCase()).startsWith("LATTICE VECTOR") || s.equals("LATTICE"))) return 3;
return (checkPWM ? 1 : 0);
}, "~A");
c$.checkLineStarts = Clazz_defineMethod(c$, "checkLineStarts", 
function(lines){
for (var i = 0; i < J.adapter.smarter.Resolver.lineStartsWithRecords.length; ++i) {
var recordTags = J.adapter.smarter.Resolver.lineStartsWithRecords[i];
for (var j = 1; j < recordTags.length; ++j) {
var recordTag = recordTags[j];
for (var k = 0; k < lines.length; k++) {
if (lines[k].startsWith(recordTag)) return recordTags[0];
}
}
}
return null;
}, "~A");
c$.checkHeaderContains = Clazz_defineMethod(c$, "checkHeaderContains", 
function(header){
for (var i = 0; i < J.adapter.smarter.Resolver.headerContainsRecords.length; ++i) {
var fileType = J.adapter.smarter.Resolver.checkHeaderRecords(header, J.adapter.smarter.Resolver.headerContainsRecords[i]);
if (fileType != null) return fileType;
}
return null;
}, "~S");
c$.checkJSONContains = Clazz_defineMethod(c$, "checkJSONContains", 
function(header){
for (var i = 0; i < J.adapter.smarter.Resolver.jsonContainsRecords.length; ++i) {
var fileType = J.adapter.smarter.Resolver.checkHeaderRecords(header, J.adapter.smarter.Resolver.jsonContainsRecords[i]);
if (fileType != null) return fileType;
}
return null;
}, "~S");
c$.checkHeaderRecords = Clazz_defineMethod(c$, "checkHeaderRecords", 
function(header, recordTags){
for (var j = 1; j < recordTags.length; ++j) {
var recordTag = recordTags[j];
if (header.indexOf(recordTag) < 0) continue;
var type = recordTags[0];
if (!type.equals("Xml")) return type;
if (header.indexOf("/AFLOWDATA/") >= 0 || header.indexOf("-- Structure PRE --") >= 0) return "AFLOW";
return (header.indexOf("<!DOCTYPE HTML PUBLIC") < 0 && header.indexOf("XHTML") < 0 && (header.indexOf("xhtml") < 0 || header.indexOf("<cml") >= 0) ? J.adapter.smarter.Resolver.getXmlType(header) : null);
}
return null;
}, "~S,~A");
c$.getXmlType = Clazz_defineMethod(c$, "getXmlType", 
function(header){
if (header.indexOf("http://www.molpro.net/") >= 0) {
return "XmlMolpro";
}if (header.indexOf("odyssey") >= 0) {
return "XmlOdyssey";
}if (header.indexOf("C3XML") >= 0) {
return "XmlChem3d";
}if (header.indexOf("CDXML") >= 0) {
return "XmlCdx";
}if (header.indexOf("arguslab") >= 0) {
return "XmlArgus";
}if (header.indexOf("jvxl") >= 0 || header.indexOf("http://www.xml-cml.org/schema") >= 0 || header.indexOf("cml:") >= 0 || header.indexOf("<cml>") >= 0) {
return "XmlCml";
}if (header.indexOf("<nmrML") >= 0) {
return "XmlNmrml";
}if (header.indexOf("XSD") >= 0) {
return "XmlXsd";
}if (header.indexOf(">vasp") >= 0) {
return "XmlVasp";
}if (header.indexOf("<GEOMETRY_INFO>") >= 0) {
return "XmlQE";
}return "XmlCml(unidentified)";
}, "~S");
c$.checkSpecial2 = Clazz_defineMethod(c$, "checkSpecial2", 
function(lines){
if (J.adapter.smarter.Resolver.checkGromacs(lines)) return "Gromacs";
if (J.adapter.smarter.Resolver.checkCrystal(lines)) return "Crystal";
if (J.adapter.smarter.Resolver.checkFAH(lines)) return "FAH";
var s = J.adapter.smarter.Resolver.checkCastepVaspSiesta(lines);
if (s != null) return s;
return null;
}, "~A");
c$.checkFAH = Clazz_defineMethod(c$, "checkFAH", 
function(lines){
var s = lines[0].trim() + lines[2].trim();
return s.equals("{\"atoms\": [");
}, "~A");
c$.checkCrystal = Clazz_defineMethod(c$, "checkCrystal", 
function(lines){
var s = lines[1].trim();
if (s.equals("SLAB") || s.equals("MOLECULE") || s.equals("CRYSTAL") || s.equals("POLYMER") || (s = lines[3]).equals("SLAB") || s.equals("MOLECULE") || s.equals("POLYMER")) return true;
for (var i = 0; i < lines.length; i++) {
if (lines[i].trim().equals("OPTGEOM") || lines[i].trim().equals("FREQCALC") || lines[i].contains("DOVESI") || lines[i].contains("TORINO") || lines[i].contains("http://www.crystal.unito.it") || lines[i].contains("Pcrystal") || lines[i].contains("MPPcrystal") || lines[i].contains("crystal executable")) return true;
}
return false;
}, "~A");
c$.checkGromacs = Clazz_defineMethod(c$, "checkGromacs", 
function(lines){
if (JU.PT.parseInt(lines[1]) == -2147483648) return false;
var len = -1;
for (var i = 2; i < 16 && len != 0; i++) if ((len = lines[i].length) != 69 && len != 45 && len != 0) return false;

return true;
}, "~A");
c$.checkCastepVaspSiesta = Clazz_defineMethod(c$, "checkCastepVaspSiesta", 
function(lines){
for (var i = 0; i < lines.length; i++) {
var line = lines[i].toUpperCase();
if (line.indexOf("FREQUENCIES IN         CM-1") == 1 || line.contains("CASTEP") || line.startsWith("%BLOCK LATTICE_ABC") || line.startsWith("%BLOCK LATTICE_CART") || line.startsWith("%BLOCK POSITIONS_FRAC") || line.startsWith("%BLOCK POSITIONS_ABS") || line.contains("<-- E")) return "Castep";
if (line.contains("%BLOCK")) return "Siesta";
if (i >= 6 && i < 10 && (line.startsWith("DIRECT") || line.startsWith("CARTESIAN"))) return "VaspPoscar";
}
return null;
}, "~A");
c$.getFileTypefromFilter = Clazz_defineMethod(c$, "getFileTypefromFilter", 
function(filter){
var pt = (filter == null ? -1 : filter.toLowerCase().indexOf("filetype"));
return (pt < 0 ? null : filter.substring(pt + 8, (filter + ";").indexOf(";", pt)).$replace('=', ' ').trim());
}, "~S");
c$.fixDOSName = Clazz_defineMethod(c$, "fixDOSName", 
function(fileName){
return (fileName.indexOf(":\\") >= 0 ? fileName.$replace('\\', '/') : fileName);
}, "~S");
c$.setDefaultType = Clazz_defineMethod(c$, "setDefaultType", 
function(type, htParams){
htParams.put("defaultType", type);
}, "~S,java.util.Map");
c$.readerSets =  Clazz_newArray(-1, ["cif.", ";Cif;Cif2;MMCif;MMTF;MagCif;BCIF;", "molxyz.", ";Mol3D;Mol;Xyz;", "more.", ";AFLOW;BinaryDcd;CDX;Gromacs;Jcampdx;MdCrd;MdTop;Mol2;TlsDataOnly;", "quantum.", ";Adf;Csf;Dgrid;GamessUK;GamessUS;Gaussian;GaussianFchk;GaussianWfn;Jaguar;Molden;MopacGraphf;GenNBO;NWChem;Psi;Qchem;QCJSON;WebMO;Orca;MO;Ams;", "pdb.", ";Pdb;Pqr;P2n;JmolData;", "pymol.", ";PyMOL;", "simple.", ";Alchemy;Ampac;Cube;FoldingXyz;GhemicalMM;HyperChem;Jme;JSON;Mopac;MopacArchive;Tinker;Input;FAH;", "spartan.", ";Spartan;SpartanSmol;Odyssey;", "xtal.", ";Abinit;Aims;Bilbao;Castep;Cgd;Crystal;Dmol;Espresso;Gulp;Jana;Magres;Shelx;Siesta;VaspOutcar;VaspPoscar;Wien2k;Xcrysden;PWmat;Optimade;Cmdf;Cmdx;FSGOutput;", "xml.", ";XmlCdx;XmlArgus;XmlCml;XmlChem3d;XmlMolpro;XmlNmrml;XmlOdyssey;XmlXsd;XmlVasp;XmlQE;"]);
c$.cdxMagic =  Clazz_newByteArray(-1, [86, 106, 67, 68]);
c$.cmdfMagic =  Clazz_newByteArray(-1, [67, 77, 68, 70]);
c$.cmdxMagic =  Clazz_newByteArray(-1, [67, 77, 68, 88]);
c$.mmtfMagic =  Clazz_newByteArray(-1, [109, 109, 116, 102]);
c$.bcifMolstarMagic =  Clazz_newByteArray(-1, [109, 111, 108, 42]);
c$.bcifDensityMagic =  Clazz_newByteArray(-1, [68, 101, 110, 115]);
c$.bcifVolumeMagic =  Clazz_newByteArray(-1, [86, 111, 108, 117]);
c$.bcifModelMagic =  Clazz_newByteArray(-1, [77, 111, 100, 101]);
c$.bcifCoordMagic =  Clazz_newByteArray(-1, [67, 111, 111, 114, 100]);
c$.bcifServerMagic =  Clazz_newByteArray(-1, [83, 69, 82, 86, 69, 82]);
c$.sptRecords =  Clazz_newArray(-1, ["spt", "# Jmol state", "# Jmol script", "JmolManifest"]);
c$.m3dStartRecords =  Clazz_newArray(-1, ["Alchemy", "STRUCTURE  1.00     1"]);
c$.cubeFileStartRecords =  Clazz_newArray(-1, ["Cube", "JVXL", "#JVXL"]);
c$.mol2Records =  Clazz_newArray(-1, ["Mol2", "mol2", "@<TRIPOS>"]);
c$.webmoFileStartRecords =  Clazz_newArray(-1, ["WebMO", "[HEADER]"]);
c$.moldenFileStartRecords =  Clazz_newArray(-1, ["Molden", "[Molden", "MOLDEN", "[MOLDEN"]);
c$.dcdFileStartRecords =  Clazz_newArray(-1, ["BinaryDcd", "T\0\0\0CORD", "\0\0\0TCORD"]);
c$.tlsDataOnlyFileStartRecords =  Clazz_newArray(-1, ["TlsDataOnly", "REFMAC\n\nTL", "REFMAC\r\n\r\n", "REFMAC\r\rTL"]);
c$.inputFileStartRecords =  Clazz_newArray(-1, ["Input", "#ZMATRIX", "%mem=", "AM1", "$rungauss"]);
c$.magresFileStartRecords =  Clazz_newArray(-1, ["Magres", "#$magres", "# magres"]);
c$.pymolStartRecords =  Clazz_newArray(-1, ["PyMOL", "}q"]);
c$.janaStartRecords =  Clazz_newArray(-1, ["Jana", "Version Jana"]);
c$.jsonStartRecords =  Clazz_newArray(-1, ["JSON", "{\"mol\":"]);
c$.jcampdxStartRecords =  Clazz_newArray(-1, ["Jcampdx", "##TITLE"]);
c$.jmoldataStartRecords =  Clazz_newArray(-1, ["JmolData", "REMARK   6 Jmol"]);
c$.pqrStartRecords =  Clazz_newArray(-1, ["Pqr", "REMARK   1 PQR", "REMARK    The B-factors"]);
c$.p2nStartRecords =  Clazz_newArray(-1, ["P2n", "REMARK   1 P2N"]);
c$.cif2StartRecords =  Clazz_newArray(-1, ["Cif2", "#\\#CIF_2", "\u00EF\u00BB\u00BF#\\#CIF_2"]);
c$.xmlStartRecords =  Clazz_newArray(-1, ["Xml", "<?xml"]);
c$.cfiStartRecords =  Clazz_newArray(-1, ["Input", "$CFI"]);
c$.fileStartsWithRecords =  Clazz_newArray(-1, [J.adapter.smarter.Resolver.xmlStartRecords, J.adapter.smarter.Resolver.sptRecords, J.adapter.smarter.Resolver.m3dStartRecords, J.adapter.smarter.Resolver.cubeFileStartRecords, J.adapter.smarter.Resolver.mol2Records, J.adapter.smarter.Resolver.webmoFileStartRecords, J.adapter.smarter.Resolver.moldenFileStartRecords, J.adapter.smarter.Resolver.dcdFileStartRecords, J.adapter.smarter.Resolver.tlsDataOnlyFileStartRecords, J.adapter.smarter.Resolver.inputFileStartRecords, J.adapter.smarter.Resolver.magresFileStartRecords, J.adapter.smarter.Resolver.pymolStartRecords, J.adapter.smarter.Resolver.janaStartRecords, J.adapter.smarter.Resolver.jsonStartRecords, J.adapter.smarter.Resolver.jcampdxStartRecords, J.adapter.smarter.Resolver.jmoldataStartRecords, J.adapter.smarter.Resolver.pqrStartRecords, J.adapter.smarter.Resolver.p2nStartRecords, J.adapter.smarter.Resolver.cif2StartRecords, J.adapter.smarter.Resolver.cfiStartRecords]);
c$.n =  Clazz_newIntArray (1, 0);
c$.mmcifLineStartRecords =  Clazz_newArray(-1, ["MMCif", "_entry.id", "_database_PDB_", "_pdbx_", "_chem_comp.pdbx_type", "_audit_author.name", "_atom_site."]);
c$.cifLineStartRecords =  Clazz_newArray(-1, ["Cif", "data_", "_publ"]);
c$.pdbLineStartRecords =  Clazz_newArray(-1, ["Pdb", "HEADER", "OBSLTE", "TITLE ", "CAVEAT", "COMPND", "SOURCE", "KEYWDS", "EXPDTA", "AUTHOR", "REVDAT", "SPRSDE", "JRNL  ", "REMARK ", "DBREF ", "SEQADV", "SEQRES", "MODRES", "HELIX ", "SHEET ", "TURN  ", "CRYST1", "ORIGX1", "ORIGX2", "ORIGX3", "SCALE1", "SCALE2", "SCALE3", "ATOM  ", "HETATM", "MODEL ", "LINK  ", "USER  MOD "]);
c$.cgdLineStartRecords =  Clazz_newArray(-1, ["Cgd", "EDGE ", "edge "]);
c$.shelxLineStartRecords =  Clazz_newArray(-1, ["Shelx", "TITL ", "ZERR ", "LATT ", "SYMM ", "CELL ", "TITL\t"]);
c$.ghemicalMMLineStartRecords =  Clazz_newArray(-1, ["GhemicalMM", "!Header mm1gp", "!Header gpr"]);
c$.jaguarLineStartRecords =  Clazz_newArray(-1, ["Jaguar", "  |  Jaguar version"]);
c$.mdlLineStartRecords =  Clazz_newArray(-1, ["Mol", "$MDL "]);
c$.spartanSmolLineStartRecords =  Clazz_newArray(-1, ["SpartanSmol", "INPUT="]);
c$.csfLineStartRecords =  Clazz_newArray(-1, ["Csf", "local_transform"]);
c$.mdTopLineStartRecords =  Clazz_newArray(-1, ["MdTop", "%FLAG TITLE"]);
c$.hyperChemLineStartRecords =  Clazz_newArray(-1, ["HyperChem", "mol 1"]);
c$.vaspOutcarLineStartRecords =  Clazz_newArray(-1, ["VaspOutcar", " vasp.", " INCAR:"]);
c$.orcaInputLineStartRecords =  Clazz_newArray(-1, ["Orca", "* xyz", "*xyz"]);
c$.lineStartsWithRecords =  Clazz_newArray(-1, [J.adapter.smarter.Resolver.mmcifLineStartRecords, J.adapter.smarter.Resolver.cifLineStartRecords, J.adapter.smarter.Resolver.pdbLineStartRecords, J.adapter.smarter.Resolver.cgdLineStartRecords, J.adapter.smarter.Resolver.shelxLineStartRecords, J.adapter.smarter.Resolver.ghemicalMMLineStartRecords, J.adapter.smarter.Resolver.jaguarLineStartRecords, J.adapter.smarter.Resolver.mdlLineStartRecords, J.adapter.smarter.Resolver.spartanSmolLineStartRecords, J.adapter.smarter.Resolver.csfLineStartRecords, J.adapter.smarter.Resolver.mol2Records, J.adapter.smarter.Resolver.mdTopLineStartRecords, J.adapter.smarter.Resolver.hyperChemLineStartRecords, J.adapter.smarter.Resolver.vaspOutcarLineStartRecords, J.adapter.smarter.Resolver.orcaInputLineStartRecords]);
c$.bilbaoContainsRecords =  Clazz_newArray(-1, ["Bilbao", ">Bilbao Crystallographic Server<"]);
c$.xmlContainsRecords =  Clazz_newArray(-1, ["Xml", "<?xml", "<atom", "<molecule", "<reaction", "<cml", "<bond", ".dtd\"", "<list>", "<entry", "<identifier", "http://www.xml-cml.org/schema/cml2/core"]);
c$.gaussianContainsRecords =  Clazz_newArray(-1, ["Gaussian", "Entering Gaussian System", "Entering Link 1", "1998 Gaussian, Inc."]);
c$.ampacContainsRecords =  Clazz_newArray(-1, ["Ampac", "AMPAC Version"]);
c$.mopacContainsRecords =  Clazz_newArray(-1, ["Mopac", "MOPAC 93 (c) Fujitsu", "MOPAC FOR LINUX (PUBLIC DOMAIN VERSION)", "MOPAC:  VERSION  6", "MOPAC   7", "MOPAC2", "MOPAC (PUBLIC", "MOPAC v"]);
c$.qchemContainsRecords =  Clazz_newArray(-1, ["Qchem", "Welcome to Q-Chem", "A Quantum Leap Into The Future Of Chemistry"]);
c$.gamessUKContainsRecords =  Clazz_newArray(-1, ["GamessUK", "GAMESS-UK", "G A M E S S - U K"]);
c$.gamessUSContainsRecords =  Clazz_newArray(-1, ["GamessUS", "GAMESS", "$CONTRL"]);
c$.spartanBinaryContainsRecords =  Clazz_newArray(-1, ["SpartanSmol", "|PropertyArchive", "_spartan", "spardir", "BEGIN Directory Entry Molecule"]);
c$.spartanContainsRecords =  Clazz_newArray(-1, ["Spartan", "Spartan", "converted archive file"]);
c$.adfContainsRecords =  Clazz_newArray(-1, ["Adf", "Amsterdam Density Functional"]);
c$.amsContainsRecords =  Clazz_newArray(-1, ["Ams", "Amsterdam Modeling Suite"]);
c$.psiContainsRecords =  Clazz_newArray(-1, ["Psi", "    PSI  3", "PSI3:"]);
c$.nwchemContainsRecords =  Clazz_newArray(-1, ["NWChem", " argument  1 = "]);
c$.uicrcifContainsRecords =  Clazz_newArray(-1, ["Cif", "Crystallographic Information File"]);
c$.dgridContainsRecords =  Clazz_newArray(-1, ["Dgrid", "BASISFILE   created by DGrid"]);
c$.crystalContainsRecords =  Clazz_newArray(-1, ["Crystal", "*                                CRYSTAL", "TORINO", "DOVESI"]);
c$.dmolContainsRecords =  Clazz_newArray(-1, ["Dmol", "DMol^3"]);
c$.gulpContainsRecords =  Clazz_newArray(-1, ["Gulp", "GENERAL UTILITY LATTICE PROGRAM"]);
c$.espressoContainsRecords =  Clazz_newArray(-1, ["Espresso", "Program PWSCF", "Program PHONON"]);
c$.siestaContainsRecords =  Clazz_newArray(-1, ["Siesta", "MD.TypeOfRun", "SolutionMethod", "MeshCutoff", "WELCOME TO SIESTA"]);
c$.xcrysDenContainsRecords =  Clazz_newArray(-1, ["Xcrysden", "PRIMVEC", "CONVVEC", "PRIMCOORD", "ANIMSTEP"]);
c$.mopacArchiveContainsRecords =  Clazz_newArray(-1, ["MopacArchive", "SUMMARY OF PM"]);
c$.abinitContainsRecords =  Clazz_newArray(-1, ["Abinit", "http://www.abinit.org", "Catholique", "Louvain"]);
c$.qcJsonContainsRecords =  Clazz_newArray(-1, ["QCJSON", "\"QCJSON"]);
c$.optimadeContainsRecords =  Clazz_newArray(-1, ["Optimade", "\"cartesian_site_positions\":", "\"api_version\":", "optimade"]);
c$.jsonArrayContainsRecords =  Clazz_newArray(-1, ["JSON", "\"atomArray\":[", "\"atomArray\" : ["]);
c$.orcaContainsRecords =  Clazz_newArray(-1, ["Orca", "* O   R   C   A *"]);
c$.gaussianFchkContainsRecords =  Clazz_newArray(-1, ["GaussianFchk", "Number of point charges in /Mol/"]);
c$.inputContainsRecords =  Clazz_newArray(-1, ["Input", " ATOMS cartesian", "$molecule", "&zmat", "geometry={", "$DATA", "%coords", "GEOM=PQS", "geometry units angstroms"]);
c$.aflowContainsRecords =  Clazz_newArray(-1, ["AFLOW", "/AFLOWDATA/"]);
c$.magCifContainsRecords =  Clazz_newArray(-1, ["MagCif", "_space_group_magn"]);
c$.headerContainsRecords =  Clazz_newArray(-1, [J.adapter.smarter.Resolver.sptRecords, J.adapter.smarter.Resolver.bilbaoContainsRecords, J.adapter.smarter.Resolver.xmlContainsRecords, J.adapter.smarter.Resolver.gaussianContainsRecords, J.adapter.smarter.Resolver.ampacContainsRecords, J.adapter.smarter.Resolver.mopacContainsRecords, J.adapter.smarter.Resolver.gamessUKContainsRecords, J.adapter.smarter.Resolver.gamessUSContainsRecords, J.adapter.smarter.Resolver.qchemContainsRecords, J.adapter.smarter.Resolver.spartanBinaryContainsRecords, J.adapter.smarter.Resolver.spartanContainsRecords, J.adapter.smarter.Resolver.mol2Records, J.adapter.smarter.Resolver.adfContainsRecords, J.adapter.smarter.Resolver.psiContainsRecords, J.adapter.smarter.Resolver.nwchemContainsRecords, J.adapter.smarter.Resolver.uicrcifContainsRecords, J.adapter.smarter.Resolver.dgridContainsRecords, J.adapter.smarter.Resolver.crystalContainsRecords, J.adapter.smarter.Resolver.dmolContainsRecords, J.adapter.smarter.Resolver.gulpContainsRecords, J.adapter.smarter.Resolver.espressoContainsRecords, J.adapter.smarter.Resolver.siestaContainsRecords, J.adapter.smarter.Resolver.xcrysDenContainsRecords, J.adapter.smarter.Resolver.mopacArchiveContainsRecords, J.adapter.smarter.Resolver.abinitContainsRecords, J.adapter.smarter.Resolver.gaussianFchkContainsRecords, J.adapter.smarter.Resolver.inputContainsRecords, J.adapter.smarter.Resolver.aflowContainsRecords, J.adapter.smarter.Resolver.magCifContainsRecords, J.adapter.smarter.Resolver.qcJsonContainsRecords, J.adapter.smarter.Resolver.optimadeContainsRecords, J.adapter.smarter.Resolver.orcaContainsRecords, J.adapter.smarter.Resolver.jsonArrayContainsRecords, J.adapter.smarter.Resolver.amsContainsRecords]);
c$.jsonContainsRecords =  Clazz_newArray(-1, [J.adapter.smarter.Resolver.optimadeContainsRecords]);
});
;//5.0.1-v7 Mon Aug 24 10:22:24 CDT 2026
Clazz_declarePackage("J.adapter.smarter");
Clazz_load(["J.api.JmolAdapter"], "J.adapter.smarter.SmarterJmolAdapter", ["java.io.BufferedReader", "$.StringReader", "java.util.Hashtable", "JU.PT", "$.Rdr", "J.adapter.smarter.AtomIterator", "$.AtomSetCollection", "$.BondIterator", "$.Resolver", "$.StructureIterator", "J.api.Interface", "JS.SV", "JU.BSUtil", "$.Logger"], function(){
var c$ = Clazz_declareType(J.adapter.smarter, "SmarterJmolAdapter", J.api.JmolAdapter);
Clazz_makeConstructor(c$, 
function(){
Clazz_superConstructor (this, J.adapter.smarter.SmarterJmolAdapter, []);
});
Clazz_overrideMethod(c$, "getFileTypeName", 
function(ascOrReader){
if ((typeof(ascOrReader)=='string')) return J.adapter.smarter.Resolver.getFileTypefromFilter(ascOrReader);
if (Clazz_instanceOf(ascOrReader,"J.adapter.smarter.AtomSetCollection")) {
return (ascOrReader).fileTypeName;
}if (Clazz_instanceOf(ascOrReader,"java.io.BufferedReader")) return J.adapter.smarter.Resolver.getFileType(ascOrReader);
if (Clazz_instanceOf(ascOrReader,"java.io.BufferedInputStream")) {
var type = J.adapter.smarter.Resolver.getBinaryType(ascOrReader);
if (type == null) try {
type = J.adapter.smarter.Resolver.getFileType(JU.Rdr.getBufferedReader(ascOrReader, null));
} catch (e) {
if (Clazz_exceptionOf(e, Exception)){
} else {
throw e;
}
}
return type;
}return null;
}, "~O");
Clazz_overrideMethod(c$, "getAtomSetCollectionReader", 
function(name, type, bufferedReader, htParams){
return J.adapter.smarter.SmarterJmolAdapter.staticGetAtomSetCollectionReader(name, type, bufferedReader, htParams);
}, "~S,~S,~O,java.util.Map");
c$.staticGetAtomSetCollectionReader = Clazz_defineMethod(c$, "staticGetAtomSetCollectionReader", 
function(name, type, bufferedReader, htParams){
if (htParams == null) htParams =  new java.util.Hashtable();
try {
var ret = J.adapter.smarter.Resolver.getAtomCollectionReader(name, type, bufferedReader, htParams, -1);
if ((typeof(ret)=='string')) {
try {
J.adapter.smarter.SmarterJmolAdapter.close(bufferedReader);
} catch (e) {
if (Clazz_exceptionOf(e, Exception)){
} else {
throw e;
}
}
} else {
(ret).setup(name, htParams, bufferedReader);
}return ret;
} catch (e) {
try {
J.adapter.smarter.SmarterJmolAdapter.close(bufferedReader);
} catch (ex) {
if (Clazz_exceptionOf(ex, Exception)){
} else {
throw ex;
}
}
bufferedReader = null;
JU.Logger.error("" + e);
return "" + e;
}
}, "~S,~S,~O,java.util.Map");
Clazz_overrideMethod(c$, "getAtomSetCollectionFromReader", 
function(fname, readerOrDocument, htParams){
var ret = J.adapter.smarter.Resolver.getAtomCollectionReader(fname, null, readerOrDocument, htParams, -1);
if (Clazz_instanceOf(ret,"J.adapter.smarter.AtomSetCollectionReader")) {
if (Clazz_instanceOf(readerOrDocument,"java.io.BufferedInputStream")) {
var bis = readerOrDocument;
if (J.adapter.smarter.Resolver.getBinaryType(bis) != null) {
readerOrDocument = (J.api.Interface.getInterface("JU.BinaryDocument", null, "JmolAdapter")).setStream(bis, false);
} else {
readerOrDocument = JU.Rdr.getBufferedReader(bis, null);
}}(ret).setup(fname, htParams, readerOrDocument);
return (ret).readData();
}return "" + ret;
}, "~S,~O,java.util.Map");
Clazz_overrideMethod(c$, "getAtomSetCollection", 
function(ascReader){
return J.adapter.smarter.SmarterJmolAdapter.staticGetAtomSetCollection(ascReader);
}, "~O");
c$.staticGetAtomSetCollection = Clazz_defineMethod(c$, "staticGetAtomSetCollection", 
function(a){
var br = null;
try {
br = a.reader;
var ret = a.readData();
if (!(Clazz_instanceOf(ret,"J.adapter.smarter.AtomSetCollection"))) return ret;
var asc = ret;
if (asc.errorMessage != null) return asc.errorMessage;
return asc;
} catch (e) {
try {
JU.Logger.info(e.toString());
} catch (ee) {
if (Clazz_exceptionOf(ee, Exception)){
JU.Logger.error(e.toString());
} else {
throw ee;
}
}
try {
br.close();
} catch (ex) {
if (Clazz_exceptionOf(ex, Exception)){
} else {
throw ex;
}
}
br = null;
JU.Logger.error("" + e);
return "" + e;
}
}, "J.adapter.smarter.AtomSetCollectionReader");
Clazz_overrideMethod(c$, "getAtomSetCollectionReaders", 
function(filesReader, names, types, htParams, getReadersOnly){
var vwr = htParams.get("vwr");
var size = names.length;
var reader = null;
if (htParams.containsKey("concatenate")) {
var s = "";
for (var i = 0; i < size; i++) {
var name = names[i];
var f = vwr.getFileAsString3(name, false, null);
if (i > 0 && size <= 3 && f.startsWith("{")) {
var type = (f.contains("version\":\"DSSR") ? "dssr" : f.contains("/outliers/") ? "validation" : "domains");
var x = vwr.parseJSONMap(f);
if (x != null) htParams.put(type, (type.equals("dssr") ? x : JS.SV.getVariableMap(x)));
continue;
}if (f.startsWith("java.net.")) System.err.println(f + " reading " + name);
if (name.indexOf("|") >= 0) name = JU.PT.rep(name, "_", "/");
if (i == 1) {
if (name.indexOf("/rna3dhub/") >= 0) {
s += "\n_rna3d \n;" + f + "\n;\n";
continue;
}if (name.indexOf("/dssr/") >= 0) {
s += "\n_dssr \n;" + f + "\n;\n";
continue;
}}s += f;
if (!s.endsWith("\n")) s += "\n";
}
size = 1;
reader = JU.Rdr.getBR(s);
}var readers = (getReadersOnly ?  new Array(size) : null);
var atomsets = (getReadersOnly ? null :  new Array(size));
var r = null;
for (var i = 0; i < size; i++) {
try {
htParams.put("vwr", vwr);
if (reader == null) reader = filesReader.getBufferedReaderOrBinaryDocument(i, false);
if (!(Clazz_instanceOf(reader,"java.io.BufferedReader") || Clazz_instanceOf(reader,"javajs.api.GenericBinaryDocument"))) return reader;
var fullPathName = names[i];
htParams.put("fullPathName", fullPathName);
var ret = J.adapter.smarter.Resolver.getAtomCollectionReader(names[i], (types == null ? null : types[i]), reader, htParams, i);
if (!(Clazz_instanceOf(ret,"J.adapter.smarter.AtomSetCollectionReader"))) return ret;
r = ret;
r.setup(null, null, null);
if (r.isBinary) {
r.setup(names[i], htParams, filesReader.getBufferedReaderOrBinaryDocument(i, true));
} else {
r.setup(names[i], htParams, reader);
}reader = null;
if (getReadersOnly) {
readers[i] = r;
} else {
ret = r.readData();
if (!(Clazz_instanceOf(ret,"J.adapter.smarter.AtomSetCollection"))) return ret;
atomsets[i] = ret;
if (atomsets[i].errorMessage != null) return atomsets[i].errorMessage;
}} catch (e) {
JU.Logger.error("" + e);
e.printStackTrace();
return "" + e;
}
}
if (getReadersOnly) return readers;
return this.getAtomSetCollectionFromSet(readers, atomsets, htParams);
}, "J.api.JmolFilesReaderInterface,~A,~A,java.util.Map,~B");
Clazz_overrideMethod(c$, "getAtomSetCollectionFromSet", 
function(readerSet, atomsets, htParams){
var readers = readerSet;
var asc = (atomsets == null ?  new Array(readers.length) : atomsets);
if (atomsets == null) {
for (var i = 0; i < readers.length; i++) {
if (readers[i] != null) try {
var ret = readers[i].readData();
if (!(Clazz_instanceOf(ret,"J.adapter.smarter.AtomSetCollection"))) return ret;
asc[i] = ret;
if (asc[i].errorMessage != null) return asc[i].errorMessage;
} catch (e) {
JU.Logger.error("" + e);
return "" + e;
}
}
}var result;
if (htParams.containsKey("trajectorySteps")) {
result = asc[0];
try {
if (asc.length > 1) asc[0].setInfo("ignoreUnitCell", asc[1].atomSetInfo.get("ignoreUnitCell"));
result.finalizeTrajectoryAs(htParams.get("trajectorySteps"), htParams.get("vibrationSteps"));
} catch (e) {
if (Clazz_exceptionOf(e, Exception)){
if (result.errorMessage == null) result.errorMessage = "" + e;
} else {
throw e;
}
}
} else if (asc[0].isTrajectory) {
result = asc[0];
for (var i = 1; i < asc.length; i++) asc[0].mergeTrajectories(asc[i]);

} else {
result = (asc.length == 1 ? asc[0] :  new J.adapter.smarter.AtomSetCollection("Array", null, asc, null));
}return (result.errorMessage == null ? result : result.errorMessage);
}, "~O,~O,java.util.Map");
Clazz_overrideMethod(c$, "getAtomSetCollectionFromDOM", 
function(DOMNode, htParams){
throw  new UnsupportedOperationException();
}, "~O,java.util.Map");
Clazz_overrideMethod(c$, "finish", 
function(asc){
(asc).finish();
}, "~O");
Clazz_overrideMethod(c$, "getAtomSetCollectionName", 
function(asc){
return (asc).collectionName;
}, "~O");
Clazz_overrideMethod(c$, "getAtomSetCollectionAuxiliaryInfo", 
function(asc){
return (asc).atomSetInfo;
}, "~O");
Clazz_overrideMethod(c$, "getAtomSetCount", 
function(asc){
return (asc).atomSetCount;
}, "~O");
Clazz_overrideMethod(c$, "getAtomSetNumber", 
function(asc, atomSetIndex){
return (asc).getAtomSetNumber(atomSetIndex);
}, "~O,~N");
Clazz_overrideMethod(c$, "getAtomSetName", 
function(asc, atomSetIndex){
return (asc).getAtomSetName(atomSetIndex);
}, "~O,~N");
Clazz_overrideMethod(c$, "getAtomSetAuxiliaryInfo", 
function(asc, atomSetIndex){
return (asc).getAtomSetAuxiliaryInfo(atomSetIndex);
}, "~O,~N");
Clazz_overrideMethod(c$, "getHydrogenAtomCount", 
function(asc){
return (asc).getHydrogenAtomCount();
}, "~O");
Clazz_overrideMethod(c$, "getBondList", 
function(asc){
return (asc).getBondList();
}, "~O");
Clazz_overrideMethod(c$, "getAtomCount", 
function(asc, atomSetIndex){
var a = asc;
if (atomSetIndex < 0) return (a.bsAtoms == null ? a.ac : a.bsAtoms.cardinality());
if (a.bsAtoms == null) return a.getAtomSetAtomCount(atomSetIndex);
var b = JU.BSUtil.copy(a.bsAtoms);
var i0 = a.getAtomSetAtomIndex(atomSetIndex);
b.and(JU.BSUtil.newBitSet2(i0, i0 + a.getAtomSetAtomCount(atomSetIndex)));
return b.cardinality();
}, "~O,~N");
Clazz_overrideMethod(c$, "coordinatesAreFractional", 
function(asc){
return (asc).coordinatesAreFractional;
}, "~O");
Clazz_overrideMethod(c$, "getAtomIterator", 
function(asc){
return  new J.adapter.smarter.AtomIterator(asc);
}, "~O");
Clazz_overrideMethod(c$, "getBondIterator", 
function(asc){
return ((asc).bondCount == 0 ? null :  new J.adapter.smarter.BondIterator(asc));
}, "~O");
Clazz_overrideMethod(c$, "getStructureIterator", 
function(asc){
return (asc).structureCount == 0 ? null :  new J.adapter.smarter.StructureIterator(asc);
}, "~O");
c$.close = Clazz_defineMethod(c$, "close", 
function(bufferedReader){
if (Clazz_instanceOf(bufferedReader,"java.io.BufferedReader")) (bufferedReader).close();
 else (bufferedReader).close();
}, "~O");
Clazz_overrideMethod(c$, "getAtomSetCollectionInline", 
function(molData, htParams){
var r = null;
try {
if ((typeof(molData)=='string')) {
r =  new java.io.BufferedReader( new java.io.StringReader(molData));
} else if (Clazz_instanceOf(molData,"java.io.InputStream")) {
r = molData;
} else {
return null;
}var atomSetReader = this.getAtomSetCollectionReader("String", null, r, null);
if ((typeof(atomSetReader)=='string')) {
return atomSetReader;
}return this.getAtomSetCollection(atomSetReader);
} finally {
try {
if (Clazz_instanceOf(r,"java.io.BufferedReader")) {
(r).close();
} else {
(r).close();
}} catch (e) {
if (Clazz_exceptionOf(e,"java.io.IOException")){
} else {
throw e;
}
}
}
}, "~O,java.util.Map");
c$.PATH_SEPARATOR = System.getProperty("path.separator", "/");
});
;//5.0.1-v7 Mon Aug 24 10:01:38 CDT 2026
Clazz_declarePackage("J.adapter.smarter");
Clazz_load(["J.api.JmolAdapterStructureIterator"], "J.adapter.smarter.StructureIterator", ["J.api.JmolAdapter"], function(){
var c$ = Clazz_decorateAsClass(function(){
this.structureCount = 0;
this.structures = null;
this.structure = null;
this.istructure = 0;
this.bsModelsDefined = null;
Clazz_instantialize(this, arguments);}, J.adapter.smarter, "StructureIterator", J.api.JmolAdapterStructureIterator);
Clazz_makeConstructor(c$, 
function(asc){
Clazz_superConstructor (this, J.adapter.smarter.StructureIterator, []);
this.structureCount = asc.structureCount;
this.structures = asc.structures;
this.istructure = 0;
this.bsModelsDefined = asc.bsStructuredModels;
}, "J.adapter.smarter.AtomSetCollection");
Clazz_overrideMethod(c$, "hasNext", 
function(){
if (this.istructure == this.structureCount) return false;
this.structure = this.structures[this.istructure++];
return true;
});
Clazz_overrideMethod(c$, "getStructureType", 
function(){
return this.structure.structureType;
});
Clazz_overrideMethod(c$, "getSubstructureType", 
function(){
return this.structure.substructureType;
});
Clazz_overrideMethod(c$, "getStructureID", 
function(){
return this.structure.structureID;
});
Clazz_overrideMethod(c$, "getStrandID", 
function(){
return this.structure.strandID;
});
Clazz_overrideMethod(c$, "getStartChainID", 
function(){
return this.structure.startChainID;
});
Clazz_overrideMethod(c$, "getStartSequenceNumber", 
function(){
return this.structure.startSequenceNumber;
});
Clazz_overrideMethod(c$, "getStartInsertionCode", 
function(){
return J.api.JmolAdapter.canonizeInsertionCode(this.structure.startInsertionCode);
});
Clazz_overrideMethod(c$, "getEndChainID", 
function(){
return this.structure.endChainID;
});
Clazz_overrideMethod(c$, "getEndSequenceNumber", 
function(){
return this.structure.endSequenceNumber;
});
Clazz_overrideMethod(c$, "getEndInsertionCode", 
function(){
return this.structure.endInsertionCode;
});
Clazz_overrideMethod(c$, "getStrandCount", 
function(){
return this.structure.strandCount;
});
Clazz_overrideMethod(c$, "getStructuredModels", 
function(){
return this.bsModelsDefined;
});
Clazz_overrideMethod(c$, "getAtomIndices", 
function(){
return this.structure.atomStartEnd;
});
Clazz_overrideMethod(c$, "getModelIndices", 
function(){
return this.structure.modelStartEnd;
});
Clazz_overrideMethod(c$, "getBSAll", 
function(){
return this.structure.bsAll;
});
});
;//5.0.1-v7 Mon Aug 17 10:07:10 MDT 2026
Clazz_declarePackage("J.api");
Clazz_declareInterface(J.api, "AtomIndexIterator");
;//5.0.1-v7 Mon Aug 24 09:54:36 CDT 2026
Clazz_declarePackage("J.api");
Clazz_load(null, "J.api.Interface", ["JU.Logger"], function(){
var c$ = Clazz_declareType(J.api, "Interface", null);
c$.getInstance = Clazz_defineMethod(c$, "getInstance", 
function(name, isQuiet){
return J.api.Interface.getInterface(name, null, "");
}, "~S,~B");
c$.getInterface = Clazz_defineMethod(c$, "getInterface", 
function(name, vwr, state){
try {
var x = Clazz._4Name(name);
return (x == null ? null : x.newInstance());
} catch (e) {
if (Clazz_exceptionOf(e, Exception)){
JU.Logger.error("Interface.java Error creating instance for " + name + ": \n" + e);
return null;
} else {
throw e;
}
}
}, "~S,JV.Viewer,~S");
c$.getOption = Clazz_defineMethod(c$, "getOption", 
function(className, vwr, state){
return J.api.Interface.getInterface("J." + className, vwr, state);
}, "~S,JV.Viewer,~S");
c$.getUtil = Clazz_defineMethod(c$, "getUtil", 
function(name, vwr, state){
return J.api.Interface.getInterface("JU." + name, vwr, state);
}, "~S,JV.Viewer,~S");
c$.getSymmetry = Clazz_defineMethod(c$, "getSymmetry", 
function(vwr, state){
return (J.api.Interface.getInterface("JS.Symmetry", vwr, state)).setViewer(vwr, state);
}, "JV.Viewer,~S");
});
;//5.0.1-v7 Mon Aug 24 10:01:38 CDT 2026
Clazz_declarePackage("J.api");
Clazz_load(null, "J.api.JmolAdapter", ["JU.PT", "J.api.JmolViewer", "JU.Elements"], function(){
var c$ = Clazz_declareType(J.api, "JmolAdapter", null);
c$.getElementSymbol = Clazz_defineMethod(c$, "getElementSymbol", 
function(elementNumber){
return JU.Elements.elementSymbolFromNumber(elementNumber);
}, "~N");
c$.getElementNumber = Clazz_defineMethod(c$, "getElementNumber", 
function(elementSymbol){
return JU.Elements.elementNumberFromSymbol(elementSymbol, false);
}, "~S");
c$.getNaturalIsotope = Clazz_defineMethod(c$, "getNaturalIsotope", 
function(elementNumber){
return JU.Elements.getNaturalIsotope(elementNumber);
}, "~N");
c$.getBondingRadius = Clazz_defineMethod(c$, "getBondingRadius", 
function(atomicNumberWithIsotope, charge){
return JU.Elements.getBondingRadius(atomicNumberWithIsotope, charge);
}, "~N,~N");
Clazz_defineMethod(c$, "getAtomSetCollectionFromReaderType", 
function(name, type, bufferedReader, htParams){
var a = this.getAtomSetCollectionReader(name, type, bufferedReader, (J.api.JmolViewer.allocateViewer(null, this)).setLoadParameters(htParams, false));
if ((typeof(a)=='string')) return a;
return this.getAtomSetCollection(a);
}, "~S,~S,~O,java.util.Map");
Clazz_defineMethod(c$, "openBufferedReader", 
function(name, bufferedReader){
return this.getAtomSetCollectionFromReaderType(name, null, bufferedReader, null);
}, "~S,java.io.BufferedReader");
Clazz_defineMethod(c$, "openBufferedReader", 
function(name, bufferedReader, htParams){
return this.getAtomSetCollectionFromReaderType(name, null, bufferedReader, htParams);
}, "~S,java.io.BufferedReader,java.util.Map");
Clazz_defineMethod(c$, "openBufferedReader", 
function(name, type, bufferedReader){
return this.getAtomSetCollectionFromReaderType(name, type, bufferedReader, null);
}, "~S,~S,java.io.BufferedReader");
c$.canonizeAlphaDigit = Clazz_defineMethod(c$, "canonizeAlphaDigit", 
function(ch){
return (JU.PT.isLetterOrDigit(ch) ? ch : '\0');
}, "~S");
c$.canonizeInsertionCode = Clazz_defineMethod(c$, "canonizeInsertionCode", 
function(insertionCode){
return J.api.JmolAdapter.canonizeAlphaDigit(insertionCode);
}, "~S");
c$.canonizeAlternateLocationID = Clazz_defineMethod(c$, "canonizeAlternateLocationID", 
function(altLoc){
return J.api.JmolAdapter.canonizeAlphaDigit(altLoc);
}, "~S");
c$.cellParamNames =  Clazz_newArray(-1, ["_cell_length_a", "_cell_length_b", "_cell_length_c", "_cell_angle_alpha", "_cell_angle_beta", "_cell_angle_gamma"]);
});
;//5.0.1-v7 Mon Aug 24 10:01:38 CDT 2026
Clazz_declarePackage("J.api");
Clazz_declareInterface(J.api, "JmolAdapterAtomIterator");
;//5.0.1-v7 Mon Aug 17 10:07:10 MDT 2026
Clazz_declarePackage("J.api");
(function(){
var c$ = Clazz_declareType(J.api, "JmolAdapterBondIterator", null);
})();
;//5.0.1-v7 Mon Aug 17 10:07:10 MDT 2026
Clazz_declarePackage("J.api");
(function(){
var c$ = Clazz_declareType(J.api, "JmolAdapterStructureIterator", null);
})();
;//5.0.1-v7 Mon Aug 17 10:07:10 MDT 2026
Clazz_declarePackage("J.api");
Clazz_declareInterface(J.api, "JmolAppConsoleInterface");
;//5.0.1-v7 Mon Aug 24 10:01:38 CDT 2026
Clazz_declarePackage("J.api");
Clazz_declareInterface(J.api, "JmolAppletInterface", J.api.JmolSyncInterface);
;//5.0.1-v7 Mon Aug 17 10:07:10 MDT 2026
Clazz_declarePackage("J.api");
Clazz_declareInterface(J.api, "JmolCallbackListener");
;//5.0.1-v7 Mon Aug 17 10:07:10 MDT 2026
Clazz_declarePackage("J.api");
Clazz_declareInterface(J.api, "JmolAnnotationParser");
;//5.0.1-v7 Mon Aug 24 10:01:38 CDT 2026
Clazz_declarePackage("J.api");
Clazz_declareInterface(J.api, "JmolGraphicsInterface");
;//5.0.1-v7 Mon Aug 17 10:07:10 MDT 2026
Clazz_declarePackage("J.api");
Clazz_declareInterface(J.api, "JmolMeasurementClient");
;//5.0.1-v7 Mon Aug 17 10:07:10 MDT 2026
Clazz_declarePackage("J.api");
Clazz_declareInterface(J.api, "JmolModulationSet");
;//5.0.1-v7 Mon Aug 17 10:07:10 MDT 2026
Clazz_declarePackage("J.api");
Clazz_declareInterface(J.api, "JmolNavigatorInterface", Runnable);
;//5.0.1-v7 Mon Aug 24 10:01:38 CDT 2026
Clazz_declarePackage("J.api");
Clazz_declareInterface(J.api, "JmolRendererInterface", J.api.JmolGraphicsInterface);
;//5.0.1-v7 Mon Aug 24 10:01:38 CDT 2026
Clazz_declarePackage("J.api");
Clazz_declareInterface(J.api, "JmolRepaintManager");
;//5.0.1-v7 Mon Aug 24 10:01:38 CDT 2026
Clazz_declarePackage("J.api");
Clazz_declareInterface(J.api, "JmolStatusListener", J.api.JmolCallbackListener);
;//5.0.1-v7 Mon Aug 17 10:07:10 MDT 2026
Clazz_declarePackage("J.api");
Clazz_declareInterface(J.api, "JmolSyncInterface");
;//5.0.1-v7 Mon Aug 17 10:07:10 MDT 2026
Clazz_declarePackage("J.api");
Clazz_load(null, "J.api.JmolViewer", ["java.util.Hashtable", "JV.JC"], function(){
var c$ = Clazz_decorateAsClass(function(){
this.menuStructure = null;
this.apiPlatform = null;
Clazz_instantialize(this, arguments);}, J.api, "JmolViewer", null);
c$.allocateViewer = Clazz_defineMethod(c$, "allocateViewer", 
function(display, modelAdapter, fullName, documentBase, codeBase, commandOptions, statusListener, implementedPlatform){
var info =  new java.util.Hashtable();
if (display != null) info.put("display", display);
if (modelAdapter != null) info.put("adapter", modelAdapter);
if (statusListener != null) info.put("statuslistener", statusListener);
if (implementedPlatform != null) info.put("platform", implementedPlatform);
if (commandOptions != null) info.put("options", commandOptions);
if (fullName != null) info.put("fullname", fullName);
if (documentBase != null) info.put("documentbase", documentBase);
if (codeBase != null) info.put("codebase", codeBase);
info.put("isApp", Boolean.TRUE);
return  new JV.Viewer(info);
}, "~O,J.api.JmolAdapter,~S,java.net.URL,java.net.URL,~S,J.api.JmolStatusListener,J.api.GenericPlatform");
c$.allocateViewer = Clazz_defineMethod(c$, "allocateViewer", 
function(container, jmolAdapter){
return J.api.JmolViewer.allocateViewer(container, jmolAdapter, null, null, null, null, null, null);
}, "~O,J.api.JmolAdapter");
c$.allocateViewer = Clazz_defineMethod(c$, "allocateViewer", 
function(display, modelAdapter, fullName, documentBase, codeBase, commandOptions, statusListener){
return J.api.JmolViewer.allocateViewer(display, modelAdapter, fullName, documentBase, codeBase, commandOptions, statusListener, null);
}, "~O,J.api.JmolAdapter,~S,java.net.URL,java.net.URL,~S,J.api.JmolStatusListener");
Clazz_defineMethod(c$, "setConsole", 
function(console){
this.getProperty("DATA_API", "getAppConsole", console);
}, "J.api.JmolAppConsoleInterface");
c$.getJmolVersion = Clazz_defineMethod(c$, "getJmolVersion", 
function(){
return JV.Viewer.getJmolVersion();
});
c$.getJmolVersionNoDate = Clazz_defineMethod(c$, "getJmolVersionNoDate", 
function(){
return JV.JC.version;
});
Clazz_defineMethod(c$, "openReader", 
function(fullPathName, reader){
return this.openReader(fullPathName == null ? "String" : fullPathName, null, reader);
}, "~S,~O");
Clazz_defineMethod(c$, "openFileAsync", 
function(fileName){
this.openFileAsyncSpecial(fileName, 0);
}, "~S");
Clazz_defineMethod(c$, "renderScreenImage", 
function(g, currentSize, rectClip){
this.apiPlatform.renderScreenImage(g, currentSize);
}, "~O,~O,~O");
Clazz_defineMethod(c$, "runScriptCautiously", 
function(script){
return null;
}, "~S");
Clazz_defineMethod(c$, "dispose", 
function(){
});
{
}{
}});
;//5.0.1-v7 Mon Aug 24 10:01:38 CDT 2026
Clazz_declarePackage("J.api");
Clazz_declareInterface(J.api, "SymmetryInterface");
;//5.0.1-v7 Mon Aug 24 10:01:38 CDT 2026
Clazz_declarePackage("J.api");
Clazz_declareInterface(J.api, "Translator");
;//5.0.1-v7 Mon Aug 17 10:07:10 MDT 2026
Clazz_declarePackage("J.appletjs");
Clazz_load(["JU.GenericApplet"], "J.appletjs.Jmol", ["java.util.Hashtable"], function(){
var c$ = Clazz_declareType(J.appletjs, "Jmol", JU.GenericApplet);
Clazz_makeConstructor(c$, 
function(vwrOptions){
Clazz_superConstructor (this, J.appletjs.Jmol, []);
this.htParams =  new java.util.Hashtable();
if (vwrOptions == null) vwrOptions =  new java.util.Hashtable();
this.vwrOptions = vwrOptions;
for (var entry, $entry = vwrOptions.entrySet().iterator (); $entry.hasNext()&& ((entry = $entry.next ()) || true);) this.htParams.put(entry.getKey().toLowerCase(), entry.getValue());

this.documentBase = "" + vwrOptions.get("documentBase");
this.codeBase = "" + vwrOptions.get("codePath");
JU.GenericApplet.isJS = true;
this.init(this);
}, "java.util.Map");
});
;//5.0.1-v7 Mon Aug 17 10:07:10 MDT 2026
Clazz_declarePackage("J.atomdata");
Clazz_load(null, "J.atomdata.AtomData", ["JU.P3", "JU.BSUtil"], function(){
var c$ = Clazz_decorateAsClass(function(){
this.programInfo = null;
this.fileName = null;
this.modelName = null;
this.modelIndex = 0;
this.bsSelected = null;
this.bsIgnored = null;
this.bsMolecules = null;
this.radiusData = null;
this.firstAtomIndex = 0;
this.firstModelIndex = 0;
this.lastModelIndex = 0;
this.hAtomRadius = 0;
this.atomIndex = null;
this.atoms = null;
this.xyz = null;
this.atomRadius = null;
this.atomicNumber = null;
this.atomMolecule = null;
this.hAtoms = null;
this.ac = 0;
this.hydrogenAtomCount = 0;
this.adpMode = 0;
Clazz_instantialize(this, arguments);}, J.atomdata, "AtomData", null);
/*LV!1824 unnec constructor*/Clazz_defineMethod(c$, "transformXYZ", 
function(mat, bs){
var p =  new Array(this.xyz.length);
if (bs == null) bs = JU.BSUtil.newBitSet2(0, this.xyz.length);
for (var i = bs.nextSetBit(0); i >= 0; i = bs.nextSetBit(i + 1)) {
if (this.xyz[i] == null) continue;
p[i] = JU.P3.newP(this.xyz[i]);
mat.rotTrans(p[i]);
}
this.xyz = p;
}, "JU.M4,JU.BS");
});
;//5.0.1-v7 Mon Aug 17 10:07:10 MDT 2026
Clazz_declarePackage("J.atomdata");
Clazz_declareInterface(J.atomdata, "AtomDataServer");
;//5.0.1-v7 Mon Aug 17 10:07:10 MDT 2026
Clazz_declarePackage("J.atomdata");
Clazz_load(["java.lang.Enum", "J.c.VDW"], "J.atomdata.RadiusData", ["JU.SB"], function(){
var c$ = Clazz_decorateAsClass(function(){
this.info = null;
this.factorType = null;
this.vdwType = null;
this.value = NaN;
this.valueExtended = 0;
this.values = null;
Clazz_instantialize(this, arguments);}, J.atomdata, "RadiusData", null);
Clazz_prepareFields (c$, function(){
this.factorType = J.atomdata.RadiusData.EnumType.ABSOLUTE;
this.vdwType = J.c.VDW.AUTO;
});
Clazz_makeConstructor(c$, 
function(values, value, factorType, vdwType){
if (values != null) {
this.values = values;
this.value = 2147483647;
return;
}if (factorType == null) return;
this.factorType = factorType;
this.value = value;
if (vdwType != null) this.vdwType = vdwType;
}, "~A,~N,J.atomdata.RadiusData.EnumType,J.c.VDW");
Clazz_overrideMethod(c$, "toString", 
function(){
if (Float.isNaN(this.value)) return "";
var sb =  new JU.SB();
switch (this.factorType) {
case J.atomdata.RadiusData.EnumType.ABSOLUTE:
sb.appendF(this.value);
break;
case J.atomdata.RadiusData.EnumType.OFFSET:
sb.append(this.value > 0 ? "+" : "").appendF(this.value);
break;
case J.atomdata.RadiusData.EnumType.FACTOR:
sb.appendI(Clazz_floatToInt(this.value * 100)).append("%");
if (this.vdwType !== J.c.VDW.AUTO) sb.append(this.vdwType.getVdwLabel());
break;
case J.atomdata.RadiusData.EnumType.SCREEN:
sb.appendI(Clazz_floatToInt(this.value));
}
return sb.toString();
});
/*if2*/;(function(){
var c$ = Clazz_declareType(J.atomdata.RadiusData, "EnumType", Enum);
Clazz_defineEnumConstant(c$, "ABSOLUTE", 0, []);
Clazz_defineEnumConstant(c$, "OFFSET", 1, []);
Clazz_defineEnumConstant(c$, "FACTOR", 2, []);
Clazz_defineEnumConstant(c$, "SCREEN", 3, []);
/*eoif2*/})();
});
;//5.0.1-v7 Mon Aug 17 10:07:10 MDT 2026
Clazz_declarePackage("J.awtjs");
Clazz_load(["J.awtjs2d.Platform"], "J.awtjs.Platform", null, function(){
var c$ = Clazz_declareType(J.awtjs, "Platform", J.awtjs2d.Platform);
Clazz_overrideMethod(c$, "drawImage", 
function(g, img, x, y, width, height, isDTI){
}, "~O,~O,~N,~N,~N,~N,~B");
Clazz_overrideMethod(c$, "getTextPixels", 
function(text, font3d, gObj, image, width, height, ascent){
return null;
}, "~S,JU.Font,~O,~O,~N,~N,~N");
Clazz_overrideMethod(c$, "getGraphics", 
function(image){
return null;
}, "~O");
Clazz_overrideMethod(c$, "getStaticGraphics", 
function(image, backgroundTransparent){
return null;
}, "~O,~B");
Clazz_overrideMethod(c$, "newBufferedImage", 
function(image, w, h){
return null;
}, "~O,~N,~N");
Clazz_overrideMethod(c$, "newOffScreenImage", 
function(w, h){
return null;
}, "~N,~N");
});
;//5.0.1-v7 Mon Aug 17 10:07:10 MDT 2026
Clazz_declarePackage("J.awtjs2d");
Clazz_load(null, "J.awtjs2d.Display", ["JU.PT"], function(){
var c$ = Clazz_declareType(J.awtjs2d, "Display", null);
c$.getFullScreenDimensions = Clazz_defineMethod(c$, "getFullScreenDimensions", 
function(canvas, widthHeight){
{
widthHeight[0] = canvas.width;
widthHeight[1] = canvas.height;
}}, "~O,~A");
c$.hasFocus = Clazz_defineMethod(c$, "hasFocus", 
function(canvas){
{
}return true;
}, "~O");
c$.requestFocusInWindow = Clazz_defineMethod(c$, "requestFocusInWindow", 
function(canvas){
{
}}, "~O");
c$.renderScreenImage = Clazz_defineMethod(c$, "renderScreenImage", 
function(vwr, g, size){
{
}}, "J.api.PlatformViewer,~O,~O");
c$.prompt = Clazz_defineMethod(c$, "prompt", 
function(vwr, label, data, list, asButtons){
if (!asButtons) {
{
var s = (data == null ? alert(label) : prompt(label, data));
return "" + s;
}}if (data != null) list = JU.PT.split(data, "|");
var option = (vwr).eval.promptAsync(label, list);
if (option != null) {
if (data == null) {
for (var i = 0; i < list.length; i++) if (list[i].equals(data)) return "" + i;

}return option;
}return "null";
}, "J.api.PlatformViewer,~S,~S,~A,~B");
c$.convertPointFromScreen = Clazz_defineMethod(c$, "convertPointFromScreen", 
function(canvas, ptTemp){
{
}}, "~O,JU.P3");
c$.drawImage = Clazz_defineMethod(c$, "drawImage", 
function(context, canvas, x, y, width, height, isDTI){
{
var buf8 = canvas.buf8;
var buf32 = canvas.buf32;
var n = canvas.width * canvas.height;
var di = 1;
if (isDTI) {
var diw = width % 2;
width = Math.floor(width/2);
di = Math.floor(canvas.width/width);
}
var dw = (canvas.width - width || x) * 4;
for (var i = 0, p = 0, j = x * 4; i < n;) {
buf8[j++] = (buf32[i] >> 16) & 0xFF;
buf8[j++] = (buf32[i] >> 8) & 0xFF;
buf8[j++] = buf32[i] & 0xFF;
buf8[j++] = 0xFF;
i += di;
if (++p%width==0) {
if (diw) {
i += 1;
buf8[j] = 0;
buf8[j+1] = 0;
buf8[j+2] = 0;
buf8[j+3] = 0;
}
j += dw;
}
}
context.putImageData(canvas.imgdata,0,0);
}}, "~O,~O,~N,~N,~N,~N,~B");
});
;//5.0.1-v7 Mon Aug 24 10:01:38 CDT 2026
Clazz_declarePackage("J.awtjs2d");
Clazz_load(null, "J.awtjs2d.Image", ["J.awtjs2d.Platform"], function(){
var c$ = Clazz_declareType(J.awtjs2d, "Image", null);
c$.getWidth = Clazz_defineMethod(c$, "getWidth", 
function(canvas){
{
return (canvas.imageWidth ? canvas.imageWidth : canvas.width);
}}, "~O");
c$.getHeight = Clazz_defineMethod(c$, "getHeight", 
function(canvas){
{
return (canvas.imageHeight ? canvas.imageHeight : canvas.height);
}}, "~O");
c$.grabPixels = Clazz_defineMethod(c$, "grabPixels", 
function(context, width, height){
var data = null;
{
data = context.getImageData(0, 0, width, height).data;
}return J.awtjs2d.Image.toIntARGB(data);
}, "~O,~N,~N");
c$.toIntARGB = Clazz_defineMethod(c$, "toIntARGB", 
function(imgData){
var n = Clazz_doubleToInt(imgData.length / 4);
var iData =  Clazz_newIntArray (n, 0);
for (var i = 0, j = 0; i < n; ) {
iData[i++] = (imgData[j++] << 16) | (imgData[j++] << 8) | imgData[j++] | (imgData[j++] << 24);
}
return iData;
}, "~A");
c$.getTextPixels = Clazz_defineMethod(c$, "getTextPixels", 
function(text, font3d, context, width, height, ascent){
{
context.fillStyle = "#000000";
context.fillRect(0, 0, width, height);
context.fillStyle = "#FFFFFF";
context.font = font3d.font;
context.fillText(text, 0, ascent);
}return J.awtjs2d.Image.grabPixels(context, width, height);
}, "~S,JU.Font,~O,~N,~N,~N");
c$.allocateRgbImage = Clazz_defineMethod(c$, "allocateRgbImage", 
function(windowWidth, windowHeight, pBuffer, windowSize, backgroundTransparent, canvas){
{
if (canvas == null)
canvas = {width:windowWidth,height:windowHeight};
canvas.buf32 = pBuffer;
}return canvas;
}, "~N,~N,~A,~N,~B,~O");
c$.getImageDialog = Clazz_defineMethod(c$, "getImageDialog", 
function(vwr, title, imageMap){
return J.awtjs2d.Platform.Jmol().consoleGetImageDialog(vwr, title, imageMap);
}, "JV.Viewer,~S,java.util.Map");
});
;//5.0.1-v7 Mon Aug 24 10:01:38 CDT 2026
Clazz_declarePackage("J.awtjs2d");
Clazz_load(["J.api.GenericFileInterface"], "J.awtjs2d.JSFile", ["JU.OC", "$.PT", "JV.Viewer"], function(){
var c$ = Clazz_decorateAsClass(function(){
this.name = null;
this.fullName = null;
Clazz_instantialize(this, arguments);}, J.awtjs2d, "JSFile", null, J.api.GenericFileInterface);
Clazz_makeConstructor(c$, 
function(name){
this.name = name.$replace('\\', '/');
this.fullName = name;
if (!this.fullName.startsWith("/") && JU.OC.urlTypeIndex(name) < 0) this.fullName = JV.Viewer.jsDocumentBase + "/" + this.fullName;
this.fullName = JU.PT.rep(this.fullName, "/./", "/");
name = name.substring(name.lastIndexOf("/") + 1);
}, "~S");
c$.newFile = Clazz_defineMethod(c$, "newFile", 
function(name){
return  new J.awtjs2d.JSFile(name);
}, "~S");
Clazz_overrideMethod(c$, "getParentAsFile", 
function(){
var pt = this.fullName.lastIndexOf("/");
return (pt < 0 ? null :  new J.awtjs2d.JSFile(this.fullName.substring(0, pt)));
});
Clazz_overrideMethod(c$, "getFullPath", 
function(){
return this.fullName;
});
Clazz_overrideMethod(c$, "getName", 
function(){
return this.name;
});
Clazz_overrideMethod(c$, "isDirectory", 
function(){
return this.fullName.endsWith("/");
});
Clazz_overrideMethod(c$, "length", 
function(){
return 0;
});
c$.getURLContents = Clazz_defineMethod(c$, "getURLContents", 
function(url, outputBytes, post){
try {
var conn = url.openConnection();
if (outputBytes != null) conn.outputBytes(outputBytes);
 else if (post != null) conn.outputString(post);
return conn.getContents();
} catch (e) {
if (Clazz_exceptionOf(e, Exception)){
return e.toString();
} else {
throw e;
}
}
}, "java.net.URL,~A,~S");
Clazz_overrideMethod(c$, "toString", 
function(){
return this.fullName;
});
});
;//5.0.1-v7 Mon Aug 24 10:01:38 CDT 2026
Clazz_declarePackage("J.awtjs2d");
(function(){
var c$ = Clazz_declareType(J.awtjs2d, "JSFont", null);
c$.newFont = Clazz_defineMethod(c$, "newFont", 
function(fontFace, isBold, isItalic, fontSize, type){
fontFace = (fontFace.equals("Monospaced") ? "Courier" : fontFace.startsWith("Sans") ? "Helvetica Neue, Sans-serif" : "Serif");
return (isBold ? "bold " : "") + (isItalic ? "italic " : "") + fontSize + type + " " + fontFace;
}, "~S,~B,~B,~N,~S");
c$.getFontMetrics = Clazz_defineMethod(c$, "getFontMetrics", 
function(font, context){
{
if (context.font != font.font) {
context.font = font.font;
font.font = context.font;
context._fontAscent = Math.ceil(font.fontSize); //pt, not px
// the descent is actually (px - pt)
// but I know of no way of getting access to the drawn height
context._fontDescent = Math.ceil(font.fontSize * 0.25);//approx
}
}return context;
}, "JU.Font,~O");
c$.getAscent = Clazz_defineMethod(c$, "getAscent", 
function(context){
{
return Math.ceil(context._fontAscent);
}}, "~O");
c$.getDescent = Clazz_defineMethod(c$, "getDescent", 
function(context){
{
return Math.ceil(context._fontDescent);
}}, "~O");
c$.stringWidth = Clazz_defineMethod(c$, "stringWidth", 
function(font, context, text){
{
context.font = font.font;
return Math.ceil(context.measureText(text).width);
}}, "JU.Font,~O,~S");
})();
;//5.0.1-v7 Mon Aug 17 10:07:10 MDT 2026
Clazz_declarePackage("J.awtjs2d");
Clazz_load(["J.api.GenericMouseInterface"], "J.awtjs2d.Mouse", ["JU.PT", "$.V3", "JU.Logger"], function(){
var c$ = Clazz_decorateAsClass(function(){
this.vwr = null;
this.manager = null;
this.keyBuffer = "";
this.isMouseDown = false;
this.wheeling = false;
this.modifiersDown = 0;
this.xWhenPressed = 0;
this.yWhenPressed = 0;
this.modifiersWhenPressed10 = 0;
Clazz_instantialize(this, arguments);}, J.awtjs2d, "Mouse", null, J.api.GenericMouseInterface);
Clazz_makeConstructor(c$, 
function(privateKey, vwr, display){
this.vwr = vwr;
this.manager = this.vwr.acm;
}, "~N,JV.Viewer,~O");
Clazz_overrideMethod(c$, "clear", 
function(){
});
Clazz_overrideMethod(c$, "dispose", 
function(){
});
Clazz_overrideMethod(c$, "processEvent", 
function(id, x, y, modifiers, time){
if (id != 507) modifiers = J.awtjs2d.Mouse.applyLeftMouse(modifiers);
switch (id) {
case 507:
this.wheeled(time, x, modifiers);
break;
case 501:
this.xWhenPressed = x;
this.yWhenPressed = y;
this.modifiersWhenPressed10 = modifiers;
this.pressed(time, x, y, modifiers, false);
break;
case 506:
this.dragged(time, x, y);
break;
case 504:
this.entry(time, x, y, false);
break;
case 505:
this.entry(time, x, y, true);
break;
case 503:
this.moved(time, x, y, modifiers);
break;
case 502:
this.released(time, x, y, modifiers);
if (x == this.xWhenPressed && y == this.yWhenPressed && modifiers == this.modifiersWhenPressed10) {
this.clicked(time, x, y, modifiers, 1);
}break;
default:
return false;
}
return true;
}, "~N,~N,~N,~N,~N");
Clazz_overrideMethod(c$, "processTwoPointGesture", 
function(touches){
if (touches[0].length < 2) return;
var t1 = touches[0];
var t2 = touches[1];
var t1first = t1[0];
var t1last = t1[t2.length - 1];
var x1first = t1first[0];
var x1last = t1last[0];
var dx1 = x1last - x1first;
var y1first = t1first[1];
var y1last = t1last[1];
var dy1 = y1last - y1first;
var v1 = JU.V3.new3(dx1, dy1, 0);
var d1 = v1.length();
var t2first = t2[0];
var t2last = t2[t2.length - 1];
var x2first = t2first[0];
var x2last = t2last[0];
var dx2 = x2last - x2first;
var y2first = t2first[1];
var y2last = t2last[1];
var dy2 = y2last - y2first;
var v2 = JU.V3.new3(dx2, dy2, 0);
var d2 = v2.length();
if (d1 < 1 || d2 < 1) return;
v1.normalize();
v2.normalize();
var cos12 = (v1.dot(v2));
if (cos12 > 0.8) {
var deltaX = Clazz_floatToInt(x1last - t1[t1.length - 2][0]);
var deltaY = Clazz_floatToInt(y1last - t1[t1.length - 2][1]);
this.vwr.translateXYBy(deltaX, deltaY);
} else if (cos12 < -0.8) {
v1 = JU.V3.new3(x2first - x1first, y2first - y1first, 0);
v2 = JU.V3.new3(x2last - x1last, y2last - y1last, 0);
var dx = v2.length() - v1.length();
this.wheeled(System.currentTimeMillis(), dx < 0 ? -1 : 1, 32);
}}, "~A");
Clazz_defineMethod(c$, "mouseClicked", 
function(e){
this.clicked(e.getWhen(), e.getX(), e.getY(), e.getModifiers(), e.getClickCount());
}, "java.awt.event.MouseEvent");
Clazz_defineMethod(c$, "mouseEntered", 
function(e){
this.entry(e.getWhen(), e.getX(), e.getY(), false);
}, "java.awt.event.MouseEvent");
Clazz_defineMethod(c$, "mouseExited", 
function(e){
this.entry(e.getWhen(), e.getX(), e.getY(), true);
}, "java.awt.event.MouseEvent");
Clazz_defineMethod(c$, "mousePressed", 
function(e){
this.pressed(e.getWhen(), e.getX(), e.getY(), e.getModifiers(), e.isPopupTrigger());
}, "java.awt.event.MouseEvent");
Clazz_defineMethod(c$, "mouseReleased", 
function(e){
this.released(e.getWhen(), e.getX(), e.getY(), e.getModifiers());
}, "java.awt.event.MouseEvent");
Clazz_defineMethod(c$, "mouseDragged", 
function(e){
var modifiers = e.getModifiers();
if ((modifiers & 28) == 0) modifiers |= 16;
this.dragged(e.getWhen(), e.getX(), e.getY());
}, "java.awt.event.MouseEvent");
Clazz_defineMethod(c$, "mouseMoved", 
function(e){
this.moved(e.getWhen(), e.getX(), e.getY(), e.getModifiers());
}, "java.awt.event.MouseEvent");
Clazz_defineMethod(c$, "mouseWheelMoved", 
function(e){
e.consume();
this.wheeled(e.getWhen(), e.getWheelRotation(), e.getModifiers());
}, "java.awt.event.MouseWheelEvent");
Clazz_defineMethod(c$, "keyTyped", 
function(ke){
ke.consume();
if (!this.vwr.menuEnabled()) return;
var ch = ke.getKeyChar();
var modifiers = ke.getModifiers();
if (JU.Logger.debuggingHigh) JU.Logger.debug("MouseManager keyTyped: " + ch + " " + (0 + ch.charCodeAt(0)) + " " + modifiers);
if (modifiers != 0 && modifiers != 1) {
switch ((ch).charCodeAt(0)) {
case String.fromCharCode(11):
case 107:
var isON = !this.vwr.getBooleanProperty("allowKeyStrokes");
switch (modifiers) {
case 2:
this.vwr.setBooleanProperty("allowKeyStrokes", isON);
this.vwr.setBooleanProperty("showKeyStrokes", true);
break;
case 10:
case 1:
this.vwr.setBooleanProperty("allowKeyStrokes", isON);
this.vwr.setBooleanProperty("showKeyStrokes", false);
break;
}
this.clearKeyBuffer();
this.vwr.refresh(3, "showkey");
break;
case 22:
case 118:
switch (modifiers) {
case 2:
break;
}
break;
case 26:
case 122:
switch (modifiers) {
case 2:
this.vwr.undoMoveAction(4165, 1);
break;
case 3:
this.vwr.undoMoveAction(4140, 1);
break;
}
break;
case 25:
case 121:
switch (modifiers) {
case 2:
this.vwr.undoMoveAction(4140, 1);
break;
}
break;
}
return;
}if (!this.vwr.getBooleanProperty("allowKeyStrokes")) return;
this.addKeyBuffer(ke.getModifiers() == 1 ? Character.toUpperCase(ch) : ch);
}, "java.awt.event.KeyEvent");
Clazz_defineMethod(c$, "keyPressed", 
function(ke){
if (this.vwr.isApplet) ke.consume();
this.manager.keyPressed(ke.getKeyCode(), ke.getModifiers());
}, "java.awt.event.KeyEvent");
Clazz_defineMethod(c$, "keyReleased", 
function(ke){
ke.consume();
this.manager.keyReleased(ke.getKeyCode());
}, "java.awt.event.KeyEvent");
Clazz_defineMethod(c$, "clearKeyBuffer", 
function(){
if (this.keyBuffer.length == 0) return;
this.keyBuffer = "";
if (this.vwr.getBooleanProperty("showKeyStrokes")) this.vwr.evalStringQuietSync("!set echo _KEYSTROKES; set echo bottom left;echo \"\"", true, true);
});
Clazz_defineMethod(c$, "addKeyBuffer", 
function(ch){
if (ch.charCodeAt(0) == 10) {
this.sendKeyBuffer();
return;
}if (ch.charCodeAt(0) == 8) {
if (this.keyBuffer.length > 0) this.keyBuffer = this.keyBuffer.substring(0, this.keyBuffer.length - 1);
} else {
this.keyBuffer += ch;
}if (this.vwr.getBooleanProperty("showKeyStrokes")) this.vwr.evalStringQuietSync("!set echo _KEYSTROKES; set echo bottom left;echo " + JU.PT.esc("\1" + this.keyBuffer), true, true);
}, "~S");
Clazz_defineMethod(c$, "sendKeyBuffer", 
function(){
var kb = this.keyBuffer;
if (this.vwr.getBooleanProperty("showKeyStrokes")) this.vwr.evalStringQuietSync("!set echo _KEYSTROKES; set echo bottom left;echo " + JU.PT.esc(this.keyBuffer), true, true);
this.clearKeyBuffer();
this.vwr.evalStringQuietSync(kb, false, true);
});
Clazz_defineMethod(c$, "entry", 
function(time, x, y, isExit){
this.wheeling = false;
this.isMouseDown = false;
this.modifiersDown = 0;
this.manager.mouseEnterExit(time, x, y, isExit);
}, "~N,~N,~N,~B");
Clazz_defineMethod(c$, "clicked", 
function(time, x, y, modifiers, clickCount){
this.clearKeyBuffer();
this.manager.mouseAction(2, time, x, y, 1, modifiers);
}, "~N,~N,~N,~N,~N");
Clazz_defineMethod(c$, "moved", 
function(time, x, y, modifiers){
this.clearKeyBuffer();
if (this.isMouseDown) this.manager.mouseAction(1, time, x, y, 0, this.modifiersDown);
 else this.manager.mouseAction(0, time, x, y, 0, modifiers);
}, "~N,~N,~N,~N");
Clazz_defineMethod(c$, "wheeled", 
function(time, rotation, modifiers){
this.clearKeyBuffer();
this.wheeling = true;
this.manager.mouseAction(3, time, 0, rotation, 0, modifiers & -29 | 32);
}, "~N,~N,~N");
Clazz_defineMethod(c$, "pressed", 
function(time, x, y, modifiers, isPopupTrigger){
this.clearKeyBuffer();
this.isMouseDown = true;
this.modifiersDown = modifiers;
this.wheeling = false;
this.manager.mouseAction(4, time, x, y, 0, modifiers);
}, "~N,~N,~N,~N,~B");
Clazz_defineMethod(c$, "released", 
function(time, x, y, modifiers){
this.isMouseDown = false;
this.modifiersDown = 0;
this.wheeling = false;
this.manager.mouseAction(5, time, x, y, 0, modifiers);
}, "~N,~N,~N,~N");
Clazz_defineMethod(c$, "dragged", 
function(time, x, y){
if (this.wheeling) return;
if ((this.modifiersDown & 20) == 20) this.modifiersDown = this.modifiersDown & -5 | 2;
this.manager.mouseAction(1, time, x, y, 0, this.modifiersDown);
}, "~N,~N,~N");
c$.applyLeftMouse = Clazz_defineMethod(c$, "applyLeftMouse", 
function(modifiers){
return ((modifiers & 28) == 0) ? (modifiers | 16) : modifiers;
}, "~N");
Clazz_overrideMethod(c$, "processKeyEvent", 
function(event){
var e = event;
switch (e.getID()) {
case 401:
this.keyPressed(e);
break;
case 402:
this.keyReleased(e);
break;
case 400:
this.keyTyped(e);
break;
}
}, "~O");
});
;//5.0.1-v7 Mon Aug 24 10:01:38 CDT 2026
Clazz_declarePackage("J.awtjs2d");
Clazz_load(["J.api.GenericPlatform"], "J.awtjs2d.Platform", ["java.net.URL", "java.util.Date", "JU.AjaxURLStreamHandlerFactory", "$.Rdr", "J.api.Interface", "J.awtjs2d.Display", "$.Image", "$.JSFile", "$.JSFont", "$.Mouse"], function(){
var c$ = Clazz_decorateAsClass(function(){
this.canvas = null;
this.vwr = null;
this.context = null;
Clazz_instantialize(this, arguments);}, J.awtjs2d, "Platform", null, J.api.GenericPlatform);
Clazz_overrideMethod(c$, "setViewer", 
function(vwr, canvas){
{
this.vwr = vwr;
if (canvas == null) {
canvas = document.createElement('canvas');
this.context = canvas.getContext("2d");
} else {
this.context = canvas.getContext("2d");
canvas.imgdata = this.context.getImageData(0, 0, canvas.width, canvas.height);
canvas.buf8 = canvas.imgdata.data;
}
}this.canvas = canvas;
try {
java.net.URL.setURLStreamHandlerFactory( new JU.AjaxURLStreamHandlerFactory());
} catch (e) {
}
}, "J.api.PlatformViewer,~O");
Clazz_overrideMethod(c$, "isSingleThreaded", 
function(){
return true;
});
Clazz_overrideMethod(c$, "getJsObjectInfo", 
function(jsObject, method, args){
{
return (method == null ? null : method == "localName" ? jsObject[0]["nodeName"] : args == null ? jsObject[0][method] : jsObject[0][method](args[0]));
}}, "~A,~S,~A");
Clazz_overrideMethod(c$, "isHeadless", 
function(){
return false;
});
Clazz_overrideMethod(c$, "getMouseManager", 
function(privateKey, display){
return  new J.awtjs2d.Mouse(privateKey, this.vwr, display);
}, "~N,~O");
Clazz_overrideMethod(c$, "convertPointFromScreen", 
function(canvas, ptTemp){
J.awtjs2d.Display.convertPointFromScreen(canvas, ptTemp);
}, "~O,JU.P3");
Clazz_overrideMethod(c$, "getFullScreenDimensions", 
function(canvas, widthHeight){
J.awtjs2d.Display.getFullScreenDimensions(canvas, widthHeight);
}, "~O,~A");
Clazz_overrideMethod(c$, "getMenuPopup", 
function(menuStructure, type){
var c = (type == 'j' ? "awtjs2d.JSJmolPopup" : "awtjs2d.JSModelKitPopup");
var jmolpopup = J.api.Interface.getOption(c, this.vwr, "popup");
try {
if (jmolpopup != null) jmolpopup.jpiInitialize(this.vwr, menuStructure);
} catch (e) {
if (Clazz_exceptionOf(e, Exception)){
c = "Exception creating " + c + ":" + e;
System.out.println(c);
return null;
} else {
throw e;
}
}
return jmolpopup;
}, "~S,~S");
Clazz_overrideMethod(c$, "hasFocus", 
function(canvas){
return J.awtjs2d.Display.hasFocus(canvas);
}, "~O");
Clazz_overrideMethod(c$, "prompt", 
function(label, data, list, asButtons){
return J.awtjs2d.Display.prompt(this.vwr, label, data, list, asButtons);
}, "~S,~S,~A,~B");
Clazz_overrideMethod(c$, "renderScreenImage", 
function(context, size){
J.awtjs2d.Display.renderScreenImage(this.vwr, context, size);
}, "~O,~O");
Clazz_overrideMethod(c$, "drawImage", 
function(context, canvas, x, y, width, height, isDTI){
J.awtjs2d.Display.drawImage(context, canvas, x, y, width, height, isDTI);
}, "~O,~O,~N,~N,~N,~N,~B");
Clazz_overrideMethod(c$, "requestFocusInWindow", 
function(canvas){
J.awtjs2d.Display.requestFocusInWindow(canvas);
}, "~O");
Clazz_overrideMethod(c$, "repaint", 
function(canvas){
var jmol = null;
{
jmol = (self.Jmol && Jmol.repaint ? Jmol : null);
}if (jmol != null) jmol.repaint((this.vwr).html5Applet, true);
}, "~O");
Clazz_overrideMethod(c$, "setTransparentCursor", 
function(canvas){
}, "~O");
Clazz_overrideMethod(c$, "setCursor", 
function(c, canvas){
J.awtjs2d.Platform.Jmol().setCursor((this.vwr).html5Applet, c);
}, "~N,~O");
Clazz_overrideMethod(c$, "allocateRgbImage", 
function(windowWidth, windowHeight, pBuffer, windowSize, backgroundTransparent, isImageWrite){
if (pBuffer == null) {
pBuffer = this.grabPixels(null, 0, 0, null);
{
windowWidth = this.canvas.width;
windowHeight = this.canvas.height;
}}return J.awtjs2d.Image.allocateRgbImage(windowWidth, windowHeight, pBuffer, windowSize, backgroundTransparent, (isImageWrite ? null : this.canvas));
}, "~N,~N,~A,~N,~B,~B");
Clazz_overrideMethod(c$, "notifyEndOfRendering", 
function(){
});
Clazz_overrideMethod(c$, "disposeGraphics", 
function(gOffscreen){
}, "~O");
Clazz_overrideMethod(c$, "grabPixels", 
function(canvas, width, height, pixels){
var context2d = null;
var isWebGL = (canvas == null);
{
if(isWebGL) { this.canvas = canvas =
Jmol.loadImage(this,"webgl",""
+System.currentTimeMillis(),this
.vwr.html5Applet._canvas.toDataURL(),null,null); width =
canvas.imageWidth; height = canvas.imageHeight;
canvas.imageWidth = 0; }
if (canvas.image && (width != canvas.width || height !=
canvas.height)) Jmol.setCanvasImage(canvas, width, height);
if (canvas.buf32) return canvas.buf32; context2d =
canvas.getContext('2d');
}var buf = J.awtjs2d.Image.grabPixels(context2d, width, height);
{
canvas.buf32 = buf;
}if (isWebGL) for (var i = buf.length; --i >= 0; ) if (buf[i] == 0) buf[i] = -1;

return buf;
}, "~O,~N,~N,~A");
Clazz_overrideMethod(c$, "drawImageToBuffer", 
function(gOffscreen, imageOffscreen, canvas, width, height, bgcolor){
return this.grabPixels(canvas, width, height, null);
}, "~O,~O,~O,~N,~N,~N");
Clazz_overrideMethod(c$, "getTextPixels", 
function(text, font3d, context, image, width, height, ascent){
return J.awtjs2d.Image.getTextPixels(text, font3d, context, width, height, ascent);
}, "~S,JU.Font,~O,~O,~N,~N,~N");
Clazz_overrideMethod(c$, "flushImage", 
function(imagePixelBuffer){
}, "~O");
Clazz_overrideMethod(c$, "getGraphics", 
function(canvas){
{
return (canvas == null ? this.context : canvas.getContext("2d"));
}}, "~O");
Clazz_overrideMethod(c$, "getImageHeight", 
function(canvas){
return (canvas == null ? -1 : J.awtjs2d.Image.getHeight(canvas));
}, "~O");
Clazz_overrideMethod(c$, "getImageWidth", 
function(canvas){
return (canvas == null ? -1 : J.awtjs2d.Image.getWidth(canvas));
}, "~O");
Clazz_overrideMethod(c$, "getStaticGraphics", 
function(image, backgroundTransparent){
return this.getGraphics(image);
}, "~O,~B");
Clazz_overrideMethod(c$, "newBufferedImage", 
function(image, w, h){
return J.awtjs2d.Platform.Jmol().getHiddenCanvas((this.vwr).html5Applet, "stereoImage", w, h);
}, "~O,~N,~N");
Clazz_overrideMethod(c$, "newOffScreenImage", 
function(w, h){
return J.awtjs2d.Platform.Jmol().getHiddenCanvas((this.vwr).html5Applet, "textImage", w, h);
}, "~N,~N");
Clazz_overrideMethod(c$, "waitForDisplay", 
function(echoNameAndPath, zipBytes){
return false;
}, "~O,~O");
Clazz_overrideMethod(c$, "createImage", 
function(name_path_bytes){
var echoName = (name_path_bytes)[0];
var path = (name_path_bytes)[1];
var bytes = (name_path_bytes)[2];
var vwr = this.vwr;
var sc = (bytes == null ? vwr.getEvalContextAndHoldQueue(vwr.eval) : null);
var f = null;
{
f = function(canvas, pathOrError) { vwr.loadImageData(canvas, pathOrError, echoName, sc) };
}return J.awtjs2d.Platform.Jmol().loadImage(this, echoName, path, bytes, f);
}, "~O");
Clazz_overrideMethod(c$, "fontStringWidth", 
function(font, text){
return J.awtjs2d.JSFont.stringWidth(font, this.context, text);
}, "JU.Font,~S");
Clazz_overrideMethod(c$, "getFontAscent", 
function(context){
return J.awtjs2d.JSFont.getAscent(context);
}, "~O");
Clazz_overrideMethod(c$, "getFontDescent", 
function(context){
return J.awtjs2d.JSFont.getDescent(context);
}, "~O");
Clazz_overrideMethod(c$, "getFontMetrics", 
function(font, context){
return J.awtjs2d.JSFont.getFontMetrics(font, context == null ? this.context : context);
}, "JU.Font,~O");
Clazz_overrideMethod(c$, "newFont", 
function(fontFace, isBold, isItalic, fontSize){
return J.awtjs2d.JSFont.newFont(fontFace, isBold, isItalic, fontSize, "px");
}, "~S,~B,~B,~N");
Clazz_overrideMethod(c$, "getDateFormat", 
function(isoType){
if (isoType != null && isoType.contains("32000")) {
return "D:" + this.getDateFormat("8224") + "'00'";
}var d =  new java.util.Date();
{
if (isoType == null) {
} else if (isoType.indexOf("8601") >= 0){
var x = d.toString().split(" ");
// Firefox now doing this?
if (x.length == 1)
return x;
var MM = "0" + (1 + d.getMonth()); MM = MM.substring(MM.length - 2);
var dd = "0" + d.getDate(); dd = dd.substring(dd.length - 2);
return x[3] + '-' + MM + '-' + dd + 'T' + x[4]
} else if (isoType.indexOf("8824") >= 0) {
var x = d.toString().split(" ");
var MM = "0" + (1 + d.getMonth()); MM = MM.substring(MM.length - 2);
var dd = "0" + d.getDate(); dd = dd.substring(dd.length - 2);
return x[3] + MM + dd + x[4].replace(/\:/g,"") + x[5].substring(3,6) + "'" + x[5].substring(6,8) + "'"
}
return d.toUTCString();
}}, "~S");
Clazz_overrideMethod(c$, "newFile", 
function(name){
return  new J.awtjs2d.JSFile(name);
}, "~S");
Clazz_overrideMethod(c$, "getBufferedFileInputStream", 
function(name){
return null;
}, "~S");
Clazz_overrideMethod(c$, "getURLContents", 
function(url, outputBytes, post, asString){
return J.awtjs2d.Platform.getURLContentsStatic(url, outputBytes, post, asString);
}, "java.net.URL,~A,~S,~B");
c$.getURLContentsStatic = Clazz_defineMethod(c$, "getURLContentsStatic", 
function(url, outputBytes, post, asString){
var ret = J.awtjs2d.JSFile.getURLContents(url, outputBytes, post);
try {
return (!asString ? ret : (typeof(ret)=='string') ? ret : Clazz_instanceOf(ret,"JU.SB") ? (ret).toString() : Clazz_instanceOf(ret,Array) ?  String.instantialize(ret) :  String.instantialize(JU.Rdr.getStreamAsBytes(ret, null)));
} catch (e) {
if (Clazz_exceptionOf(e, Exception)){
return "" + e;
} else {
throw e;
}
}
}, "java.net.URL,~A,~S,~B");
Clazz_overrideMethod(c$, "getLocalUrl", 
function(fileName){
return null;
}, "~S");
Clazz_overrideMethod(c$, "getImageDialog", 
function(title, imageMap){
return J.awtjs2d.Image.getImageDialog(this.vwr, title, imageMap);
}, "~S,java.util.Map");
c$.Jmol = Clazz_defineMethod(c$, "Jmol", 
function(){
{
return Jmol;
}});
Clazz_overrideMethod(c$, "forceAsyncLoad", 
function(filename){
return J.awtjs2d.Platform.Jmol().isBinaryUrl(filename);
}, "~S");
Clazz_overrideMethod(c$, "getInChI", 
function(){
return (J.awtjs2d.Platform.inchi == null ? (J.awtjs2d.Platform.inchi = J.api.Interface.getInterface("J.inchi.InChIJS", this.vwr, "platform")) : J.awtjs2d.Platform.inchi);
});
Clazz_overrideMethod(c$, "confirm", 
function(msg, msgNo){
var ok = false;
if (ok) return 0;
if (msgNo != null) ok = false;
return (ok ? 1 : 2);
}, "~S,~S");
c$.inchi = null;
});
;//5.0.1-v7 Mon Aug 24 10:01:38 CDT 2026
Clazz_declarePackage("J.bspt");
Clazz_load(null, "J.bspt.Bspf", ["JU.AU", "J.bspt.Bspt"], function(){
var c$ = Clazz_decorateAsClass(function(){
this.dimMax = 0;
this.bspts = null;
this.isValid = false;
this.bsptsValid = null;
this.cubeIterators = null;
Clazz_instantialize(this, arguments);}, J.bspt, "Bspf", null);
Clazz_makeConstructor(c$, 
function(dimMax){
this.dimMax = dimMax;
this.bspts =  new Array(1);
this.bsptsValid =  Clazz_newBooleanArray(1, false);
this.cubeIterators =  new Array(0);
}, "~N");
Clazz_defineMethod(c$, "validateModel", 
function(i, isValid){
this.bsptsValid[i] = isValid;
}, "~N,~B");
Clazz_defineMethod(c$, "isInitializedIndex", 
function(bsptIndex){
return this.bspts.length > bsptIndex && this.bspts[bsptIndex] != null && this.bsptsValid[bsptIndex];
}, "~N");
Clazz_defineMethod(c$, "addTuple", 
function(bsptIndex, tuple){
if (bsptIndex >= this.bspts.length) {
this.bspts = JU.AU.arrayCopyObject(this.bspts, bsptIndex + 1);
this.bsptsValid = JU.AU.arrayCopyBool(this.bsptsValid, bsptIndex + 1);
}var bspt = this.bspts[bsptIndex];
if (bspt == null) {
bspt = this.bspts[bsptIndex] =  new J.bspt.Bspt(this.dimMax, bsptIndex);
}bspt.addTuple(tuple);
}, "~N,JU.P3");
Clazz_defineMethod(c$, "stats", 
function(){
for (var i = 0; i < this.bspts.length; ++i) if (this.bspts[i] != null) this.bspts[i].stats();

});
Clazz_defineMethod(c$, "getCubeIterator", 
function(bsptIndex){
if (bsptIndex < 0) return this.getNewCubeIterator(-1 - bsptIndex);
if (bsptIndex >= this.cubeIterators.length) this.cubeIterators = JU.AU.arrayCopyObject(this.cubeIterators, bsptIndex + 1);
if (this.cubeIterators[bsptIndex] == null && this.bspts[bsptIndex] != null) this.cubeIterators[bsptIndex] = this.getNewCubeIterator(bsptIndex);
this.cubeIterators[bsptIndex].set(this.bspts[bsptIndex]);
return this.cubeIterators[bsptIndex];
}, "~N");
Clazz_defineMethod(c$, "getNewCubeIterator", 
function(bsptIndex){
return this.bspts[bsptIndex].allocateCubeIterator();
}, "~N");
Clazz_defineMethod(c$, "initialize", 
function(modelIndex, atoms, modelAtomBitSet){
if (this.bspts[modelIndex] != null) this.bspts[modelIndex].reset();
for (var i = modelAtomBitSet.nextSetBit(0); i >= 0; i = modelAtomBitSet.nextSetBit(i + 1)) this.addTuple(modelIndex, atoms[i]);

this.bsptsValid[modelIndex] = true;
}, "~N,~A,JU.BS");
});
;//5.0.1-v7 Mon Aug 17 10:07:10 MDT 2026
Clazz_declarePackage("J.bspt");
Clazz_load(null, "J.bspt.Bspt", ["J.bspt.CubeIterator", "$.Leaf"], function(){
var c$ = Clazz_decorateAsClass(function(){
this.treeDepth = 0;
this.dimMax = 0;
this.index = 0;
this.eleRoot = null;
Clazz_instantialize(this, arguments);}, J.bspt, "Bspt", null);
Clazz_makeConstructor(c$, 
function(dimMax, index){
this.dimMax = dimMax;
this.index = index;
this.reset();
}, "~N,~N");
Clazz_defineMethod(c$, "reset", 
function(){
this.eleRoot =  new J.bspt.Leaf(this, null, 0);
this.treeDepth = 1;
});
Clazz_defineMethod(c$, "addTuple", 
function(tuple){
this.eleRoot = this.eleRoot.addTuple(0, tuple);
}, "JU.T3");
Clazz_defineMethod(c$, "stats", 
function(){
});
Clazz_defineMethod(c$, "allocateCubeIterator", 
function(){
return  new J.bspt.CubeIterator(this);
});
});
;//5.0.1-v7 Mon Aug 17 10:07:10 MDT 2026
Clazz_declarePackage("J.bspt");
(function(){
var c$ = Clazz_decorateAsClass(function(){
this.bspt = null;
this.stack = null;
this.sp = 0;
this.leafIndex = 0;
this.leaf = null;
this.radius = 0;
this.cx = 0;
this.cy = 0;
this.cz = 0;
this.dx = 0;
this.dy = 0;
this.dz = 0;
this.tHemisphere = false;
Clazz_instantialize(this, arguments);}, J.bspt, "CubeIterator", null);
Clazz_makeConstructor(c$, 
function(bspt){
this.set(bspt);
}, "J.bspt.Bspt");
Clazz_defineMethod(c$, "set", 
function(bspt){
this.bspt = bspt;
this.stack =  new Array(bspt.treeDepth);
}, "J.bspt.Bspt");
Clazz_defineMethod(c$, "initialize", 
function(center, radius, hemisphereOnly){
this.radius = radius;
this.tHemisphere = false;
this.cx = center.x;
this.cy = center.y;
this.cz = center.z;
this.leaf = null;
if (this.stack.length < this.bspt.treeDepth) this.set(this.bspt);
this.stack[0] = this.bspt.eleRoot;
this.sp = 1;
this.findLeftLeaf();
this.tHemisphere = hemisphereOnly;
}, "JU.T3,~N,~B");
Clazz_defineMethod(c$, "release", 
function(){
this.set(this.bspt);
});
Clazz_defineMethod(c$, "hasMoreElements", 
function(){
while (this.leaf != null) {
for (; this.leafIndex < this.leaf.count; ++this.leafIndex) if (this.isWithinRadius(this.leaf.tuples[this.leafIndex])) return true;

this.findLeftLeaf();
}
return false;
});
Clazz_defineMethod(c$, "nextElement", 
function(){
return this.leaf.tuples[this.leafIndex++];
});
Clazz_defineMethod(c$, "foundDistance2", 
function(){
return this.dx * this.dx + this.dy * this.dy + this.dz * this.dz;
});
Clazz_defineMethod(c$, "findLeftLeaf", 
function(){
this.leaf = null;
if (this.sp == 0) return;
var ele = this.stack[--this.sp];
while (Clazz_instanceOf(ele,"J.bspt.Node")) {
var node = ele;
var minValue;
switch (node.dim) {
case 0:
minValue = this.cx;
break;
case 1:
minValue = this.cy;
break;
case 2:
default:
minValue = this.cz;
break;
}
var maxValue = minValue + this.radius;
if (!this.tHemisphere || node.dim != 0) minValue -= this.radius;
if (minValue <= node.maxLeft && maxValue >= node.minLeft) {
if (maxValue >= node.minRight && minValue <= node.maxRight) {
this.stack[this.sp++] = node.eleRight;
}ele = node.eleLeft;
} else if (maxValue >= node.minRight && minValue <= node.maxRight) {
ele = node.eleRight;
} else {
if (this.sp == 0) return;
ele = this.stack[--this.sp];
}}
this.leaf = ele;
this.leafIndex = 0;
});
Clazz_defineMethod(c$, "isWithinRadius", 
function(t){
this.dx = t.x - this.cx;
return ((!this.tHemisphere || this.dx >= 0) && (this.dx = Math.abs(this.dx)) <= this.radius && (this.dy = Math.abs(t.y - this.cy)) <= this.radius && (this.dz = Math.abs(t.z - this.cz)) <= this.radius);
}, "JU.T3");
})();
;//5.0.1-v7 Mon Aug 17 10:07:10 MDT 2026
Clazz_declarePackage("J.bspt");
(function(){
var c$ = Clazz_decorateAsClass(function(){
this.bspt = null;
this.count = 0;
Clazz_instantialize(this, arguments);}, J.bspt, "Element", null);
})();
;//5.0.1-v7 Mon Aug 17 10:07:10 MDT 2026
Clazz_declarePackage("J.bspt");
Clazz_load(["J.bspt.Element"], "J.bspt.Leaf", ["J.bspt.Node"], function(){
var c$ = Clazz_decorateAsClass(function(){
this.tuples = null;
Clazz_instantialize(this, arguments);}, J.bspt, "Leaf", J.bspt.Element);
Clazz_makeConstructor(c$, 
function(bspt, leaf, countToKeep){
this.bspt = bspt;
this.count = 0;
this.tuples =  new Array(2);
if (leaf == null) return;
for (var i = countToKeep; i < 2; ++i) {
this.tuples[this.count++] = leaf.tuples[i];
leaf.tuples[i] = null;
}
leaf.count = countToKeep;
}, "J.bspt.Bspt,J.bspt.Leaf,~N");
Clazz_defineMethod(c$, "sort", 
function(dim){
for (var i = this.count; --i > 0; ) {
var champion = this.tuples[i];
var championValue = J.bspt.Node.getDimensionValue(champion, dim);
for (var j = i; --j >= 0; ) {
var challenger = this.tuples[j];
var challengerValue = J.bspt.Node.getDimensionValue(challenger, dim);
if (challengerValue > championValue) {
this.tuples[i] = challenger;
this.tuples[j] = champion;
champion = challenger;
championValue = challengerValue;
}}
}
}, "~N");
Clazz_overrideMethod(c$, "addTuple", 
function(level, tuple){
if (this.count < 2) {
this.tuples[this.count++] = tuple;
return this;
}var node =  new J.bspt.Node(this.bspt, level, this);
return node.addTuple(level, tuple);
}, "~N,JU.T3");
});
;//5.0.1-v7 Mon Aug 17 10:07:10 MDT 2026
Clazz_declarePackage("J.bspt");
Clazz_load(["J.bspt.Element"], "J.bspt.Node", ["J.bspt.Leaf"], function(){
var c$ = Clazz_decorateAsClass(function(){
this.dim = 0;
this.minLeft = 0;
this.maxLeft = 0;
this.eleLeft = null;
this.minRight = 0;
this.maxRight = 0;
this.eleRight = null;
Clazz_instantialize(this, arguments);}, J.bspt, "Node", J.bspt.Element);
Clazz_makeConstructor(c$, 
function(bspt, level, leafLeft){
this.bspt = bspt;
if (level == bspt.treeDepth) {
bspt.treeDepth = level + 1;
}if (leafLeft.count != 2) throw  new NullPointerException();
this.dim = level % bspt.dimMax;
leafLeft.sort(this.dim);
var leafRight =  new J.bspt.Leaf(bspt, leafLeft, 1);
this.minLeft = J.bspt.Node.getDimensionValue(leafLeft.tuples[0], this.dim);
this.maxLeft = J.bspt.Node.getDimensionValue(leafLeft.tuples[leafLeft.count - 1], this.dim);
this.minRight = J.bspt.Node.getDimensionValue(leafRight.tuples[0], this.dim);
this.maxRight = J.bspt.Node.getDimensionValue(leafRight.tuples[leafRight.count - 1], this.dim);
this.eleLeft = leafLeft;
this.eleRight = leafRight;
this.count = 2;
}, "J.bspt.Bspt,~N,J.bspt.Leaf");
Clazz_defineMethod(c$, "addTuple", 
function(level, tuple){
var dimValue = J.bspt.Node.getDimensionValue(tuple, this.dim);
++this.count;
var addLeft;
if (dimValue < this.maxLeft) {
addLeft = true;
} else if (dimValue > this.minRight) {
addLeft = false;
} else if (dimValue == this.maxLeft) {
if (dimValue == this.minRight) {
if (this.eleLeft.count < this.eleRight.count) addLeft = true;
 else addLeft = false;
} else {
addLeft = true;
}} else if (dimValue == this.minRight) {
addLeft = false;
} else {
if (this.eleLeft.count < this.eleRight.count) addLeft = true;
 else addLeft = false;
}if (addLeft) {
if (dimValue < this.minLeft) this.minLeft = dimValue;
 else if (dimValue > this.maxLeft) this.maxLeft = dimValue;
this.eleLeft = this.eleLeft.addTuple(level + 1, tuple);
} else {
if (dimValue < this.minRight) this.minRight = dimValue;
 else if (dimValue > this.maxRight) this.maxRight = dimValue;
this.eleRight = this.eleRight.addTuple(level + 1, tuple);
}return this;
}, "~N,JU.T3");
c$.getDimensionValue = Clazz_defineMethod(c$, "getDimensionValue", 
function(pt, dim){
if (pt == null) System.out.println("bspt.Node ???");
switch (dim) {
case 0:
return pt.x;
case 1:
return pt.y;
default:
return pt.z;
}
}, "JU.T3,~N");
});
;//5.0.1-v7 Mon Aug 17 10:07:10 MDT 2026
Clazz_declarePackage("J.c");
Clazz_load(["java.lang.Enum"], "J.c.CBK", ["JU.SB"], function(){
var c$ = Clazz_declareType(J.c, "CBK", Enum);
c$.getCallback = Clazz_defineMethod(c$, "getCallback", 
function(name){
name = name.toUpperCase();
var pt = name.indexOf("CALLBACK");
if (pt > 0) name = name.substring(0, pt);
for (var item, $item = 0, $$item = J.c.CBK.values(); $item < $$item.length && ((item = $$item[$item]) || true); $item++) if (item.name().equalsIgnoreCase(name)) return item;

return null;
}, "~S");
c$.getNameList = Clazz_defineMethod(c$, "getNameList", 
function(){
if (J.c.CBK.nameList == null) {
var names =  new JU.SB();
for (var item, $item = 0, $$item = J.c.CBK.values(); $item < $$item.length && ((item = $$item[$item]) || true); $item++) names.append(item.name().toLowerCase()).append("Callback;");

J.c.CBK.nameList = names.toString();
}return J.c.CBK.nameList;
});
c$.nameList = null;
Clazz_defineEnumConstant(c$, "ANIMFRAME", 0, []);
Clazz_defineEnumConstant(c$, "APPLETREADY", 1, []);
Clazz_defineEnumConstant(c$, "ATOMMOVED", 2, []);
Clazz_defineEnumConstant(c$, "AUDIO", 3, []);
Clazz_defineEnumConstant(c$, "CALCULATION", 4, []);
Clazz_defineEnumConstant(c$, "CLICK", 5, []);
Clazz_defineEnumConstant(c$, "DRAGDROP", 6, []);
Clazz_defineEnumConstant(c$, "ECHO", 7, []);
Clazz_defineEnumConstant(c$, "ERROR", 8, []);
Clazz_defineEnumConstant(c$, "EVAL", 9, []);
Clazz_defineEnumConstant(c$, "HOVER", 10, []);
Clazz_defineEnumConstant(c$, "IMAGE", 11, []);
Clazz_defineEnumConstant(c$, "LOADSTRUCT", 12, []);
Clazz_defineEnumConstant(c$, "MEASURE", 13, []);
Clazz_defineEnumConstant(c$, "MESSAGE", 14, []);
Clazz_defineEnumConstant(c$, "MINIMIZATION", 15, []);
Clazz_defineEnumConstant(c$, "MODELKIT", 16, []);
Clazz_defineEnumConstant(c$, "PICK", 17, []);
Clazz_defineEnumConstant(c$, "RESIZE", 18, []);
Clazz_defineEnumConstant(c$, "SCRIPT", 19, []);
Clazz_defineEnumConstant(c$, "SELECT", 20, []);
Clazz_defineEnumConstant(c$, "SERVICE", 21, []);
Clazz_defineEnumConstant(c$, "STRUCTUREMODIFIED", 22, []);
Clazz_defineEnumConstant(c$, "SYNC", 23, []);
});
;//5.0.1-v7 Mon Aug 17 10:07:10 MDT 2026
Clazz_declarePackage("J.c");
Clazz_load(["java.lang.Enum"], "J.c.FIL", null, function(){
var c$ = Clazz_decorateAsClass(function(){
this.code = 0;
Clazz_instantialize(this, arguments);}, J.c, "FIL", Enum);
Clazz_defineMethod(c$, "getCode", 
function(){
return this.code;
});
Clazz_makeConstructor(c$, 
function(code){
this.code = code;
}, "~N");
Clazz_defineEnumConstant(c$, "DELETED", 0, [5]);
Clazz_defineEnumConstant(c$, "CREATED", 1, [3]);
Clazz_defineEnumConstant(c$, "CREATING_MODELSET", 2, [2]);
Clazz_defineEnumConstant(c$, "ZAPPED", 3, [0]);
Clazz_defineEnumConstant(c$, "NOT_LOADED", 4, [-1]);
});
;//5.0.1-v7 Mon Aug 17 10:07:10 MDT 2026
Clazz_declarePackage("J.c");
Clazz_load(["java.lang.Enum"], "J.c.PAL", null, function(){
var c$ = Clazz_decorateAsClass(function(){
this.$$name = null;
this.id = 0;
Clazz_instantialize(this, arguments);}, J.c, "PAL", Enum);
Clazz_makeConstructor(c$, 
function(name, id){
this.$$name = name;
this.id = id;
}, "~S,~N");
c$.pidOf = Clazz_defineMethod(c$, "pidOf", 
function(value){
return (Clazz_instanceOf(value,"J.c.PAL") ? (value).id : Clazz_instanceOf(value, Byte) ? (value).byteValue() : J.c.PAL.UNKNOWN.id);
}, "~O");
c$.isPaletteVariable = Clazz_defineMethod(c$, "isPaletteVariable", 
function(pid){
return ((pid & 64) != 0);
}, "~N");
c$.getPalette = Clazz_defineMethod(c$, "getPalette", 
function(paletteName){
if (paletteName.indexOf('_') < 0) for (var item, $item = 0, $$item = J.c.PAL.values(); $item < $$item.length && ((item = $$item[$item]) || true); $item++) if (paletteName.equalsIgnoreCase(item.$$name)) return item;

return (paletteName.indexOf("property_") == 0 ? J.c.PAL.PROPERTY : J.c.PAL.UNKNOWN);
}, "~S");
c$.getPaletteID = Clazz_defineMethod(c$, "getPaletteID", 
function(paletteName){
if (paletteName.indexOf('_') < 0) for (var item, $item = 0, $$item = J.c.PAL.values(); $item < $$item.length && ((item = $$item[$item]) || true); $item++) if (paletteName.equalsIgnoreCase(item.$$name)) return item.id;

return (paletteName.indexOf("property_") == 0 ? J.c.PAL.PROPERTY.id : J.c.PAL.UNKNOWN.id);
}, "~S");
c$.getPaletteName = Clazz_defineMethod(c$, "getPaletteName", 
function(pid){
for (var item, $item = 0, $$item = J.c.PAL.values(); $item < $$item.length && ((item = $$item[$item]) || true); $item++) if (item.id == pid) return item.$$name;

return null;
}, "~N");
c$.PALETTE_VOLATILE = 0x40;
c$.PALETTE_NONE = 0;
c$.PALETTE_CPK = 1;
c$.PALETTE_PARTIAL_CHARGE = 2;
c$.PALETTE_FORMAL_CHARGE = 3;
c$.PALETTE_TEMP = 68;
c$.PALETTE_FIXEDTEMP = 5;
c$.PALETTE_SURFACE = 70;
c$.PALETTE_STRUCTURE = 7;
c$.PALETTE_DSSR_BASEPAIR = 8;
c$.PALETTE_AMINO = 9;
c$.PALETTE_SHAPELY = 10;
c$.PALETTE_CHAIN = 11;
c$.PALETTE_GROUP = 76;
c$.PALETTE_MONOMER = 77;
c$.PALETTE_MOLECULE = 78;
c$.PALETTE_ALTLOC = 15;
c$.PALETTE_INSERTION = 16;
c$.PALETTE_JMOL = 17;
c$.PALETTE_RASMOL = 18;
c$.PALETTE_TYPE = 19;
c$.PALETTE_ENERGY = 20;
c$.PALETTE_PROPERTY = 85;
c$.PALETTE_VARIABLE = 86;
c$.PALETTE_STRAIGHTNESS = 87;
c$.PALETTE_POLYMER = 88;
c$.PALETTE_NUCLEIC = 25;
c$.argbsCpkRasmol =  Clazz_newIntArray(-1, [16716947, 33554431, 50315467, 62005794, 83951360, 113821896, 126849023, 149946368, 165324064, 184549631, 203590434, 226525328, 249210144, 268412160, 285198386, 285277952, 343965840, 377520272, 411074704, 427851920, 452961536, 480586282, 497363498, 514140714, 598026794, 796950672, 899686640, 956278016, 1339729184]);
c$.argbsCpk =  Clazz_newIntArray(-1, [0xFFFF1493, 0xFFFFFFFF, 0xFFD9FFFF, 0xFFCC80FF, 0xFFC2FF00, 0xFFFFB5B5, 0xFF909090, 0xFF3050F8, 0xFFFF0D0D, 0xFF90E050, 0xFFB3E3F5, 0xFFAB5CF2, 0xFF8AFF00, 0xFFBFA6A6, 0xFFF0C8A0, 0xFFFF8000, 0xFFFFFF30, 0xFF1FF01F, 0xFF80D1E3, 0xFF8F40D4, 0xFF3DFF00, 0xFFE6E6E6, 0xFFBFC2C7, 0xFFA6A6AB, 0xFF8A99C7, 0xFF9C7AC7, 0xFFE06633, 0xFFF090A0, 0xFF50D050, 0xFFC88033, 0xFF7D80B0, 0xFFC28F8F, 0xFF668F8F, 0xFFBD80E3, 0xFFFFA100, 0xFFA62929, 0xFF5CB8D1, 0xFF702EB0, 0xFF00FF00, 0xFF94FFFF, 0xFF94E0E0, 0xFF73C2C9, 0xFF54B5B5, 0xFF3B9E9E, 0xFF248F8F, 0xFF0A7D8C, 0xFF006985, 0xFFC0C0C0, 0xFFFFD98F, 0xFFA67573, 0xFF668080, 0xFF9E63B5, 0xFFD47A00, 0xFF940094, 0xFF429EB0, 0xFF57178F, 0xFF00C900, 0xFF70D4FF, 0xFFFFFFC7, 0xFFD9FFC7, 0xFFC7FFC7, 0xFFA3FFC7, 0xFF8FFFC7, 0xFF61FFC7, 0xFF45FFC7, 0xFF30FFC7, 0xFF1FFFC7, 0xFF00FF9C, 0xFF00E675, 0xFF00D452, 0xFF00BF38, 0xFF00AB24, 0xFF4DC2FF, 0xFF4DA6FF, 0xFF2194D6, 0xFF267DAB, 0xFF266696, 0xFF175487, 0xFFD0D0E0, 0xFFFFD123, 0xFFB8B8D0, 0xFFA6544D, 0xFF575961, 0xFF9E4FB5, 0xFFAB5C00, 0xFF754F45, 0xFF428296, 0xFF420066, 0xFF007D00, 0xFF70ABFA, 0xFF00BAFF, 0xFF00A1FF, 0xFF008FFF, 0xFF0080FF, 0xFF006BFF, 0xFF545CF2, 0xFF785CE3, 0xFF8A4FE3, 0xFFA136D4, 0xFFB31FD4, 0xFFB31FBA, 0xFFB30DA6, 0xFFBD0D87, 0xFFC70066, 0xFFCC0059, 0xFFD1004F, 0xFFD90045, 0xFFE00038, 0xFFE6002E, 0xFFEB0026]);
Clazz_defineEnumConstant(c$, "UNKNOWN", 0, [null, 0xFF]);
Clazz_defineEnumConstant(c$, "NONE", 1, ["none", 0]);
Clazz_defineEnumConstant(c$, "CPK", 2, ["cpk", 1]);
Clazz_defineEnumConstant(c$, "PARTIAL_CHARGE", 3, ["partialcharge", 2]);
Clazz_defineEnumConstant(c$, "FORMAL_CHARGE", 4, ["formalcharge", 3]);
Clazz_defineEnumConstant(c$, "TEMP", 5, ["temperature", 68]);
Clazz_defineEnumConstant(c$, "FIXEDTEMP", 6, ["fixedtemperature", 5]);
Clazz_defineEnumConstant(c$, "SURFACE", 7, ["surfacedistance", 70]);
Clazz_defineEnumConstant(c$, "STRUCTURE", 8, ["structure", 7]);
Clazz_defineEnumConstant(c$, "DSSR_BASEPAIR", 9, ["basepairtype", 8]);
Clazz_defineEnumConstant(c$, "AMINO", 10, ["amino", 9]);
Clazz_defineEnumConstant(c$, "SHAPELY", 11, ["shapely", 10]);
Clazz_defineEnumConstant(c$, "CHAIN", 12, ["chain", 11]);
Clazz_defineEnumConstant(c$, "GROUP", 13, ["group", 76]);
Clazz_defineEnumConstant(c$, "MONOMER", 14, ["monomer", 77]);
Clazz_defineEnumConstant(c$, "MOLECULE", 15, ["molecule", 78]);
Clazz_defineEnumConstant(c$, "ALTLOC", 16, ["altloc", 15]);
Clazz_defineEnumConstant(c$, "INSERTION", 17, ["insertion", 16]);
Clazz_defineEnumConstant(c$, "JMOL", 18, ["jmol", 17]);
Clazz_defineEnumConstant(c$, "RASMOL", 19, ["rasmol", 18]);
Clazz_defineEnumConstant(c$, "TYPE", 20, ["type", 19]);
Clazz_defineEnumConstant(c$, "ENERGY", 21, ["energy", 20]);
Clazz_defineEnumConstant(c$, "PROPERTY", 22, ["property", 85]);
Clazz_defineEnumConstant(c$, "VARIABLE", 23, ["variable", 86]);
Clazz_defineEnumConstant(c$, "STRAIGHTNESS", 24, ["straightness", 87]);
Clazz_defineEnumConstant(c$, "POLYMER", 25, ["polymer", 88]);
Clazz_defineEnumConstant(c$, "NUCLEIC", 26, ["nucleic", 25]);
});
;//5.0.1-v7 Mon Aug 17 10:07:10 MDT 2026
Clazz_declarePackage("J.c");
Clazz_load(["java.lang.Enum"], "J.c.STER", null, function(){
var c$ = Clazz_decorateAsClass(function(){
this.$$name = null;
this.$isBiColor = false;
Clazz_instantialize(this, arguments);}, J.c, "STER", Enum);
Clazz_makeConstructor(c$, 
function(name, isBiColor){
this.$$name = name;
this.$isBiColor = isBiColor;
}, "~S,~B");
Clazz_defineMethod(c$, "getName", 
function(){
return this.$$name;
});
Clazz_defineMethod(c$, "isBiColor", 
function(){
return this.$isBiColor;
});
c$.getStereoMode = Clazz_defineMethod(c$, "getStereoMode", 
function(id){
for (var item, $item = 0, $$item = J.c.STER.values(); $item < $$item.length && ((item = $$item[$item]) || true); $item++) if (item.$$name.equalsIgnoreCase(id)) return item;

return null;
}, "~S");
Clazz_defineEnumConstant(c$, "NONE", 0, ["OFF", false]);
Clazz_defineEnumConstant(c$, "DOUBLE", 1, ["", false]);
Clazz_defineEnumConstant(c$, "REDCYAN", 2, ["REDCYAN", true]);
Clazz_defineEnumConstant(c$, "REDBLUE", 3, ["REDBLUE", true]);
Clazz_defineEnumConstant(c$, "REDGREEN", 4, ["REDGREEN", true]);
Clazz_defineEnumConstant(c$, "DTI", 5, ["DTI", false]);
Clazz_defineEnumConstant(c$, "CUSTOM", 6, ["", true]);
});
;//5.0.1-v7 Mon Aug 17 10:07:10 MDT 2026
Clazz_declarePackage("J.c");
Clazz_load(["java.lang.Enum"], "J.c.STR", null, function(){
var c$ = Clazz_decorateAsClass(function(){
this.id = 0;
this.color = 0;
Clazz_instantialize(this, arguments);}, J.c, "STR", Enum);
Clazz_makeConstructor(c$, 
function(id, color){
this.id = id;
this.color = color;
}, "~N,~N");
Clazz_defineMethod(c$, "getId", 
function(){
return this.id;
});
Clazz_defineMethod(c$, "getColor", 
function(){
return this.color;
});
c$.getProteinStructureType = Clazz_defineMethod(c$, "getProteinStructureType", 
function(name){
for (var item, $item = 0, $$item = J.c.STR.values(); $item < $$item.length && ((item = $$item[$item]) || true); $item++) if (name.equalsIgnoreCase(item.name())) return (item.isProtein() ? item : J.c.STR.NOT);

return J.c.STR.NOT;
}, "~S");
Clazz_defineMethod(c$, "getBioStructureTypeName", 
function(isGeneric){
return (this.id < 0 ? "" : isGeneric && this.isProtein() ? "protein" : this.name());
}, "~B");
Clazz_defineMethod(c$, "isProtein", 
function(){
return this.id >= 0 && this.id <= 3 || this.id >= 7;
});
Clazz_defineEnumConstant(c$, "NOT", 0, [-1, 0xFF808080]);
Clazz_defineEnumConstant(c$, "NONE", 1, [0, 0xFFFFFFFF]);
Clazz_defineEnumConstant(c$, "TURN", 2, [1, 0xFF6080FF]);
Clazz_defineEnumConstant(c$, "SHEET", 3, [2, 0xFFFFC800]);
Clazz_defineEnumConstant(c$, "HELIX", 4, [3, 0xFFFF0080]);
Clazz_defineEnumConstant(c$, "DNA", 5, [4, 0xFFAE00FE]);
Clazz_defineEnumConstant(c$, "RNA", 6, [5, 0xFFFD0162]);
Clazz_defineEnumConstant(c$, "CARBOHYDRATE", 7, [6, 0xFFA6A6FA]);
Clazz_defineEnumConstant(c$, "HELIX310", 8, [7, 0xFFA00080]);
Clazz_defineEnumConstant(c$, "HELIXALPHA", 9, [8, 0xFFFF0080]);
Clazz_defineEnumConstant(c$, "HELIXPI", 10, [9, 0xFF600080]);
Clazz_defineEnumConstant(c$, "DSSRINTERNALLOOP", 11, [10, 0xD0B0F0]);
Clazz_defineEnumConstant(c$, "DSSRHAIRPINLOOP", 12, [11, 0x00A0F0]);
Clazz_defineEnumConstant(c$, "DSSRBULGELOOP", 13, [12, 0x00F0F0]);
Clazz_defineEnumConstant(c$, "DSSRJUNCTIONLOOP", 14, [13, 0xA0A0F0]);
Clazz_defineEnumConstant(c$, "DSSRSTEM", 15, [14, 0xFFFF00]);
Clazz_defineEnumConstant(c$, "ANNOTATION", 16, [-2, 0]);
});
;//5.0.1-v7 Mon Aug 17 10:07:10 MDT 2026
Clazz_declarePackage("J.c");
Clazz_load(["java.lang.Enum"], "J.c.VDW", null, function(){
var c$ = Clazz_decorateAsClass(function(){
this.pt = 0;
this.type = null;
this.type2 = null;
Clazz_instantialize(this, arguments);}, J.c, "VDW", Enum);
Clazz_makeConstructor(c$, 
function(pt, type, type2){
this.pt = pt;
this.type = type;
this.type2 = type2;
}, "~N,~S,~S");
Clazz_defineMethod(c$, "getVdwLabel", 
function(){
return (this.type == null ? this.type2 : this.type);
});
c$.getVdwType = Clazz_defineMethod(c$, "getVdwType", 
function(label){
if (label != null) for (var item, $item = 0, $$item = J.c.VDW.values(); $item < $$item.length && ((item = $$item[$item]) || true); $item++) if (label.equalsIgnoreCase(item.type)) return item;

return null;
}, "~S");
c$.getVdwType2 = Clazz_defineMethod(c$, "getVdwType2", 
function(label){
if (label != null) for (var item, $item = 0, $$item = J.c.VDW.values(); $item < $$item.length && ((item = $$item[$item]) || true); $item++) if (label.equalsIgnoreCase(item.type2)) return item;

return null;
}, "~S");
Clazz_defineEnumConstant(c$, "JMOL", 0, [0, "Jmol", null]);
Clazz_defineEnumConstant(c$, "BABEL", 1, [1, "Babel", null]);
Clazz_defineEnumConstant(c$, "RASMOL", 2, [2, "RasMol", null]);
Clazz_defineEnumConstant(c$, "BABEL21", 3, [3, "Babel21", null]);
Clazz_defineEnumConstant(c$, "AUTO_JMOL", 4, [0, null, "Jmol"]);
Clazz_defineEnumConstant(c$, "AUTO_BABEL", 5, [1, null, "Babel"]);
Clazz_defineEnumConstant(c$, "AUTO_RASMOL", 6, [2, null, "RasMol"]);
Clazz_defineEnumConstant(c$, "AUTO", 7, [0, "Auto", null]);
Clazz_defineEnumConstant(c$, "USER", 8, [-1, "User", null]);
Clazz_defineEnumConstant(c$, "ADPMAX", 9, [-1, null, "adpmax"]);
Clazz_defineEnumConstant(c$, "ADPMIN", 10, [-1, null, "adpmin"]);
Clazz_defineEnumConstant(c$, "HYDRO", 11, [-1, null, "hydrophobic"]);
Clazz_defineEnumConstant(c$, "BONDING", 12, [-1, null, "bondingradius"]);
Clazz_defineEnumConstant(c$, "TEMP", 13, [-1, null, "temperature"]);
Clazz_defineEnumConstant(c$, "NOJMOL", 14, [-1, null, null]);
Clazz_defineEnumConstant(c$, "NADA", 15, [-1, null, null]);
});
;//5.0.1-v7 Mon Aug 17 10:07:10 MDT 2026
Clazz_declarePackage("J.g3d");
Clazz_load(["JU.P3i"], "J.g3d.CylinderRenderer", ["JU.AU", "$.P3"], function(){
var c$ = Clazz_decorateAsClass(function(){
this.g3d = null;
this.line3d = null;
this.shader = null;
this.colixA = 0;
this.colixB = 0;
this.shadesA = null;
this.shadesB = null;
this.xA = 0;
this.yA = 0;
this.zA = 0;
this.xAend = 0;
this.yAend = 0;
this.zAend = 0;
this.dxB = 0;
this.dyB = 0;
this.dzB = 0;
this.xAf = 0;
this.yAf = 0;
this.zAf = 0;
this.dxBf = 0;
this.dyBf = 0;
this.dzBf = 0;
this.tEvenDiameter = false;
this.diameter = 0;
this.endcaps = 0;
this.endCapHidden = false;
this.xEndcap = 0;
this.yEndcap = 0;
this.zEndcap = 0;
this.argbEndcap = 0;
this.colixEndcap = 0;
this.endcapShadeIndex = 0;
this.radius = 0;
this.radius2 = 0;
this.cosTheta = 0;
this.cosPhi = 0;
this.sinPhi = 0;
this.clipped = false;
this.rasterCount = 0;
this.xyztRaster = null;
this.xyzfRaster = null;
this.ptA0 = null;
this.ptB0 = null;
this.ptA0i = null;
this.ptB0i = null;
this.xTip = 0;
this.yTip = 0;
this.zTip = 0;
Clazz_instantialize(this, arguments);}, J.g3d, "CylinderRenderer", null);
Clazz_prepareFields (c$, function(){
this.xyztRaster =  Clazz_newArray(-1, [ Clazz_newFloatArray (32, 0),  Clazz_newFloatArray (32, 0),  Clazz_newFloatArray (32, 0),  Clazz_newFloatArray (32, 0)]);
this.xyzfRaster =  Clazz_newArray(-1, [ Clazz_newIntArray (32, 0),  Clazz_newIntArray (32, 0),  Clazz_newIntArray (32, 0),  Clazz_newIntArray (32, 0)]);
this.ptA0i =  new JU.P3i();
this.ptB0i =  new JU.P3i();
});
Clazz_makeConstructor(c$, 
function(g3d){
this.g3d = g3d;
this.line3d = g3d.line3d;
this.shader = g3d.shader;
}, "J.g3d.Graphics3D");
Clazz_defineMethod(c$, "renderOld", 
function(colixA, colixB, screen, endcaps, diameter, xa, ya, za, xb, yb, zb){
var r = Clazz_doubleToInt(diameter / 2) + 1;
var g = this.g3d;
var codeMinA = g.clipCode3(xa - r, ya - r, za - r);
var codeMaxA = g.clipCode3(xa + r, ya + r, za + r);
var codeMinB = g.clipCode3(xb - r, yb - r, zb - r);
var codeMaxB = g.clipCode3(xb + r, yb + r, zb + r);
var c = (codeMinA | codeMaxA | codeMinB | codeMaxB);
this.clipped = (c != 0);
if (c == -1 || (codeMinA & codeMaxB & codeMaxA & codeMinB) != 0) return;
this.dxB = xb - xa;
this.dyB = yb - ya;
this.dzB = zb - za;
if (diameter <= 1) {
this.line3d.plotLineDeltaOld(g.getColorArgbOrGray(colixA), g.getColorArgbOrGray(colixB), xa, ya, za, this.dxB, this.dyB, this.dzB, this.clipped);
return;
}var drawBackside = (screen == 0 && (this.clipped || endcaps == 2 || endcaps == 0));
this.diameter = diameter;
this.xA = xa;
this.yA = ya;
this.zA = za;
this.endcaps = endcaps;
this.shadesA = g.getShades(this.colixA = colixA);
this.shadesB = g.getShades(this.colixB = colixB);
this.calcArgbEndcap(true, false);
this.calcCosSin(this.dxB, this.dyB, this.dzB);
this.calcPoints(3, false);
this.interpolate(0, 1, this.xyzfRaster, this.xyztRaster);
this.interpolate(1, 2, this.xyzfRaster, this.xyztRaster);
var xyzf = this.xyzfRaster;
if (endcaps == 2) this.renderFlatEndcap(true, false, xyzf);
g.setZMargin(5);
var width = g.width;
var zbuf = g.zbuf;
var xr = xyzf[0];
var yr = xyzf[1];
var zr = xyzf[2];
var fr = xyzf[3];
var p = g.pixel;
for (var i = this.rasterCount; --i >= 0; ) {
var fpz = fr[i] >> (8);
var fpzBack = fpz >> 1;
var x = xr[i];
var y = yr[i];
var z = zr[i];
if (this.endCapHidden && this.argbEndcap != 0) {
if (this.clipped) {
g.plotPixelClippedArgb(this.argbEndcap, this.xEndcap + x, this.yEndcap + y, this.zEndcap - z - 1, width, zbuf, p);
g.plotPixelClippedArgb(this.argbEndcap, this.xEndcap - x, this.yEndcap - y, this.zEndcap + z - 1, width, zbuf, p);
} else {
g.plotPixelUnclipped(this.argbEndcap, this.xEndcap + x, this.yEndcap + y, this.zEndcap - z - 1, width, zbuf, p);
g.plotPixelUnclipped(this.argbEndcap, this.xEndcap - x, this.yEndcap - y, this.zEndcap + z - 1, width, zbuf, p);
}}this.line3d.plotLineDeltaAOld(this.shadesA, this.shadesB, screen, fpz, this.xA + x, this.yA + y, this.zA - z, this.dxB, this.dyB, this.dzB, this.clipped);
if (drawBackside) {
this.line3d.plotLineDeltaOld(this.shadesA[fpzBack], this.shadesB[fpzBack], this.xA - x, this.yA - y, this.zA + z, this.dxB, this.dyB, this.dzB, this.clipped);
}}
g.setZMargin(0);
if (endcaps == 3) this.renderSphericalEndcaps();
}, "~N,~N,~N,~N,~N,~N,~N,~N,~N,~N,~N");
Clazz_defineMethod(c$, "renderBitsFloat", 
function(colixA, colixB, screen, endcaps, diameter, ptA, ptB){
var g = this.g3d;
if (this.ptA0 == null) {
this.ptA0 =  new JU.P3();
this.ptB0 =  new JU.P3();
}this.ptA0.setT(ptA);
var r = Clazz_doubleToInt(diameter / 2) + 1;
var ixA = Math.round(ptA.x);
var iyA = Math.round(ptA.y);
var izA = Math.round(ptA.z);
var ixB = Math.round(ptB.x);
var iyB = Math.round(ptB.y);
var izB = Math.round(ptB.z);
var codeMinA = g.clipCode3(ixA - r, iyA - r, izA - r);
var codeMaxA = g.clipCode3(ixA + r, iyA + r, izA + r);
var codeMinB = g.clipCode3(ixB - r, iyB - r, izB - r);
var codeMaxB = g.clipCode3(ixB + r, iyB + r, izB + r);
var c = (codeMinA | codeMaxA | codeMinB | codeMaxB);
this.clipped = (c != 0);
if (c == -1 || (codeMinA & codeMaxB & codeMaxA & codeMinB) != 0) return;
this.dxBf = ptB.x - ptA.x;
this.dyBf = ptB.y - ptA.y;
this.dzBf = ptB.z - ptA.z;
if (diameter > 0) {
this.diameter = diameter;
this.xAf = ptA.x;
this.yAf = ptA.y;
this.zAf = ptA.z;
}var drawBackside = (screen == 0 && (this.clipped || endcaps == 2 || endcaps == 0));
this.xA = Clazz_floatToInt(this.xAf);
this.yA = Clazz_floatToInt(this.yAf);
this.zA = Clazz_floatToInt(this.zAf);
this.dxB = Clazz_floatToInt(this.dxBf);
this.dyB = Clazz_floatToInt(this.dyBf);
this.dzB = Clazz_floatToInt(this.dzBf);
this.shadesA = g.getShades(this.colixA = colixA);
this.shadesB = g.getShades(this.colixB = colixB);
this.endcaps = endcaps;
this.calcArgbEndcap(true, true);
var xyzf = this.xyzfRaster;
if (diameter > 0) this.generateBaseEllipsePrecisely(false);
if (endcaps == 2) this.renderFlatEndcap(true, true, xyzf);
this.line3d.setLineBits(this.dxBf, this.dyBf);
g.setZMargin(5);
var p = g.pixel;
var width = g.width;
var zbuf = g.zbuf;
var xr = xyzf[0];
var yr = xyzf[1];
var zr = xyzf[2];
var fr = xyzf[3];
for (var i = this.rasterCount; --i >= 0; ) {
var fpz = fr[i] >> (8);
var fpzBack = fpz >> 1;
var x = xr[i];
var y = yr[i];
var z = zr[i];
if (this.endCapHidden && this.argbEndcap != 0) {
if (this.clipped) {
g.plotPixelClippedArgb(this.argbEndcap, this.xEndcap + x, this.yEndcap + y, this.zEndcap - z - 1, width, zbuf, p);
g.plotPixelClippedArgb(this.argbEndcap, this.xEndcap - x, this.yEndcap - y, this.zEndcap + z - 1, width, zbuf, p);
} else {
g.plotPixelUnclipped(this.argbEndcap, this.xEndcap + x, this.yEndcap + y, this.zEndcap - z - 1, width, zbuf, p);
g.plotPixelUnclipped(this.argbEndcap, this.xEndcap - x, this.yEndcap - y, this.zEndcap + z - 1, width, zbuf, p);
}}this.ptA0.set(this.xA + x, this.yA + y, this.zA - z);
this.ptB0.setT(this.ptA0);
this.ptB0.x += this.dxB;
this.ptB0.y += this.dyB;
this.ptB0.z += this.dzB;
this.line3d.plotLineDeltaABitsFloat(this.shadesA, this.shadesB, fpz, this.ptA0, this.ptB0, screen, this.clipped);
if (drawBackside) {
this.ptA0.set(this.xA - x, this.yA - y, this.zA + z);
this.ptB0.setT(this.ptA0);
this.ptB0.x += this.dxB;
this.ptB0.y += this.dyB;
this.ptB0.z += this.dzB;
this.line3d.plotLineDeltaABitsFloat(this.shadesA, this.shadesB, fpzBack, this.ptA0, this.ptB0, screen, this.clipped);
}}
g.setZMargin(0);
if (endcaps == 3) this.renderSphericalEndcaps();
this.xAf += this.dxBf;
this.yAf += this.dyBf;
this.zAf += this.dzBf;
}, "~N,~N,~N,~N,~N,JU.P3,JU.P3");
Clazz_defineMethod(c$, "renderBits", 
function(colixA, colixB, screen, endcaps, diameter, ptA, ptB){
var g = this.g3d;
if (diameter == 0 || diameter == 1) {
this.line3d.plotLineBits(g.getColorArgbOrGray(colixA), g.getColorArgbOrGray(colixB), ptA, ptB, 0, 0, false);
return;
}this.ptA0i.setT(ptA);
var r = Clazz_doubleToInt(diameter / 2) + 1;
var ixA = ptA.x;
var iyA = ptA.y;
var izA = ptA.z;
var ixB = ptB.x;
var iyB = ptB.y;
var izB = ptB.z;
var codeMinA = g.clipCode3(ixA - r, iyA - r, izA - r);
var codeMaxA = g.clipCode3(ixA + r, iyA + r, izA + r);
var codeMinB = g.clipCode3(ixB - r, iyB - r, izB - r);
var codeMaxB = g.clipCode3(ixB + r, iyB + r, izB + r);
var c = (codeMinA | codeMaxA | codeMinB | codeMaxB);
this.clipped = (c != 0);
if (c == -1 || (codeMinA & codeMaxB & codeMaxA & codeMinB) != 0) return;
this.dxBf = ptB.x - ptA.x;
this.dyBf = ptB.y - ptA.y;
this.dzBf = ptB.z - ptA.z;
if (diameter > 0) {
this.diameter = diameter;
this.xAf = ptA.x;
this.yAf = ptA.y;
this.zAf = ptA.z;
}var drawBackside = (screen == 0 && (this.clipped || endcaps == 2 || endcaps == 0));
this.xA = Clazz_floatToInt(this.xAf);
this.yA = Clazz_floatToInt(this.yAf);
this.zA = Clazz_floatToInt(this.zAf);
this.dxB = Clazz_floatToInt(this.dxBf);
this.dyB = Clazz_floatToInt(this.dyBf);
this.dzB = Clazz_floatToInt(this.dzBf);
this.shadesA = g.getShades(this.colixA = colixA);
this.shadesB = g.getShades(this.colixB = colixB);
this.endcaps = endcaps;
this.calcArgbEndcap(true, true);
var xyzf = this.xyzfRaster;
if (diameter > 0) this.generateBaseEllipsePrecisely(false);
if (endcaps == 2) this.renderFlatEndcap(true, true, xyzf);
this.line3d.setLineBits(this.dxBf, this.dyBf);
g.setZMargin(5);
var p = g.pixel;
var width = g.width;
var zbuf = g.zbuf;
var xr = xyzf[0];
var yr = xyzf[1];
var zr = xyzf[2];
var fr = xyzf[3];
for (var i = this.rasterCount; --i >= 0; ) {
var fpz = fr[i] >> (8);
var fpzBack = fpz >> 1;
var x = xr[i];
var y = yr[i];
var z = zr[i];
if (this.endCapHidden && this.argbEndcap != 0) {
if (this.clipped) {
g.plotPixelClippedArgb(this.argbEndcap, this.xEndcap + x, this.yEndcap + y, this.zEndcap - z - 1, width, zbuf, p);
g.plotPixelClippedArgb(this.argbEndcap, this.xEndcap - x, this.yEndcap - y, this.zEndcap + z - 1, width, zbuf, p);
} else {
g.plotPixelUnclipped(this.argbEndcap, this.xEndcap + x, this.yEndcap + y, this.zEndcap - z - 1, width, zbuf, p);
g.plotPixelUnclipped(this.argbEndcap, this.xEndcap - x, this.yEndcap - y, this.zEndcap + z - 1, width, zbuf, p);
}}this.ptA0i.set(this.xA + x, this.yA + y, this.zA - z);
this.ptB0i.setT(this.ptA0i);
this.ptB0i.x += this.dxB;
this.ptB0i.y += this.dyB;
this.ptB0i.z += this.dzB;
this.line3d.plotLineDeltaABitsInt(this.shadesA, this.shadesB, fpz, this.ptA0i, this.ptB0i, screen, this.clipped);
if (drawBackside) {
this.ptA0i.set(this.xA - x, this.yA - y, this.zA + z);
this.ptB0i.setT(this.ptA0i);
this.ptB0i.x += this.dxB;
this.ptB0i.y += this.dyB;
this.ptB0i.z += this.dzB;
this.line3d.plotLineDeltaABitsInt(this.shadesA, this.shadesB, fpzBack, this.ptA0i, this.ptB0i, screen, this.clipped);
}}
g.setZMargin(0);
if (endcaps == 3) this.renderSphericalEndcaps();
this.xAf += this.dxBf;
this.yAf += this.dyBf;
this.zAf += this.dzBf;
}, "~N,~N,~N,~N,~N,JU.P3i,JU.P3i");
Clazz_defineMethod(c$, "renderConeOld", 
function(colix, endcap, diameter, xa, ya, za, xtip, ytip, ztip, doFill, isBarb){
this.dxBf = (xtip) - (this.xAf = xa);
this.dyBf = (ytip) - (this.yAf = ya);
this.dzBf = (ztip) - (this.zAf = za);
this.xA = Clazz_doubleToInt(Math.floor(this.xAf));
this.yA = Clazz_doubleToInt(Math.floor(this.yAf));
this.zA = Clazz_doubleToInt(Math.floor(this.zAf));
this.dxB = Clazz_doubleToInt(Math.floor(this.dxBf));
this.dyB = Clazz_doubleToInt(Math.floor(this.dyBf));
this.dzB = Clazz_doubleToInt(Math.floor(this.dzBf));
this.xTip = xtip;
this.yTip = ytip;
this.zTip = ztip;
this.shadesA = this.g3d.getShades(this.colixA = colix);
var shadeIndexTip = this.shader.getShadeIndex(this.dxB, this.dyB, -this.dzB);
var g3d = this.g3d;
var p = g3d.pixel;
var width = g3d.width;
var zbuf = g3d.zbuf;
g3d.plotPixelClippedArgb(this.shadesA[shadeIndexTip], Clazz_floatToInt(xtip), Clazz_floatToInt(ytip), Clazz_floatToInt(ztip), width, zbuf, p);
this.diameter = diameter;
if (diameter <= 1) {
if (diameter == 1) this.line3d.plotLineDeltaOld(this.colixA, this.colixA, this.xA, this.yA, this.zA, this.dxB, this.dyB, this.dzB, this.clipped);
return;
}this.endcaps = endcap;
this.calcArgbEndcap(false, true);
this.generateBaseEllipsePrecisely(isBarb);
if (!isBarb && this.endcaps == 2) this.renderFlatEndcap(false, true, this.xyzfRaster);
g3d.setZMargin(5);
var xr = this.xyztRaster[0];
var yr = this.xyztRaster[1];
var zr = this.xyztRaster[2];
var fr = this.xyzfRaster[3];
var sA = this.shadesA;
var doOpen = (this.endCapHidden && this.argbEndcap != 0);
for (var i = this.rasterCount; --i >= 0; ) {
var x = xr[i];
var y = yr[i];
var z = zr[i];
var fpz = fr[i] >> (8);
var xUp = this.xAf + x;
var yUp = this.yAf + y;
var zUp = this.zAf - z;
var xDn = this.xAf - x;
var yDn = this.yAf - y;
var zDn = this.zAf + z;
var argb = sA[0];
if (doOpen) {
g3d.plotPixelClippedArgb(this.argbEndcap, Clazz_floatToInt(xUp), Clazz_floatToInt(yUp), Clazz_floatToInt(zUp), width, zbuf, p);
g3d.plotPixelClippedArgb(this.argbEndcap, Clazz_floatToInt(xDn), Clazz_floatToInt(yDn), Clazz_floatToInt(zDn), width, zbuf, p);
}if (argb != 0) {
this.line3d.plotLineDeltaAOld(sA, sA, 0, fpz, Clazz_floatToInt(xUp), Clazz_floatToInt(yUp), Clazz_floatToInt(zUp), Clazz_doubleToInt(Math.ceil(this.xTip - xUp)), Clazz_doubleToInt(Math.ceil(this.yTip - yUp)), Clazz_doubleToInt(Math.ceil(this.zTip - zUp)), true);
if (doFill) {
this.line3d.plotLineDeltaAOld(sA, sA, 0, fpz, Clazz_floatToInt(xUp), Clazz_floatToInt(yUp) + 1, Clazz_floatToInt(zUp), Clazz_doubleToInt(Math.ceil(this.xTip - xUp)), Clazz_doubleToInt(Math.ceil(this.yTip - yUp)) + 1, Clazz_doubleToInt(Math.ceil(this.zTip - zUp)), true);
this.line3d.plotLineDeltaAOld(sA, sA, 0, fpz, Clazz_floatToInt(xUp) + 1, Clazz_floatToInt(yUp), Clazz_floatToInt(zUp), Clazz_doubleToInt(Math.ceil(this.xTip - xUp)) + 1, Clazz_doubleToInt(Math.ceil(this.yTip - yUp)), Clazz_doubleToInt(Math.ceil(this.zTip - zUp)), true);
}if (!isBarb && !(this.endcaps != 2 && this.dzB > 0)) {
this.line3d.plotLineDeltaOld(argb, argb, Clazz_floatToInt(xDn), Clazz_floatToInt(yDn), Clazz_floatToInt(zDn), Clazz_doubleToInt(Math.ceil(this.xTip - xDn)), Clazz_doubleToInt(Math.ceil(this.yTip - yDn)), Clazz_doubleToInt(Math.ceil(this.zTip - zDn)), true);
}}}
g3d.setZMargin(0);
}, "~N,~N,~N,~N,~N,~N,~N,~N,~N,~B,~B");
Clazz_defineMethod(c$, "generateBaseEllipsePrecisely", 
function(isBarb){
this.calcCosSin(this.dxBf, this.dyBf, this.dzBf);
this.calcPoints(isBarb ? 2 : 3, true);
this.interpolatePrecisely(0, 1, this.xyzfRaster, this.xyztRaster);
if (!isBarb) this.interpolatePrecisely(1, 2, this.xyzfRaster, this.xyztRaster);
for (var i = 3; --i >= 0; ) for (var j = this.rasterCount; --j >= 0; ) this.xyzfRaster[i][j] = Clazz_doubleToInt(Math.floor(this.xyztRaster[i][j]));


}, "~B");
Clazz_defineMethod(c$, "calcPoints", 
function(count, isPrecise){
this.calcRotatedPoint(0, 0, isPrecise, this.xyzfRaster, this.xyztRaster);
this.calcRotatedPoint(0.5, 1, isPrecise, this.xyzfRaster, this.xyztRaster);
if ((this.rasterCount = count) == 3) this.calcRotatedPoint(1, 2, isPrecise, this.xyzfRaster, this.xyztRaster);
}, "~N,~B");
Clazz_defineMethod(c$, "calcCosSin", 
function(dx, dy, dz){
var mag2d2 = dx * dx + dy * dy;
if (mag2d2 == 0) {
this.cosTheta = 1;
this.cosPhi = 1;
this.sinPhi = 0;
} else {
var mag2d = Math.sqrt(mag2d2);
var mag3d = Math.sqrt(mag2d2 + dz * dz);
this.cosTheta = dz / mag3d;
this.cosPhi = dx / mag2d;
this.sinPhi = dy / mag2d;
}}, "~N,~N,~N");
Clazz_defineMethod(c$, "calcRotatedPoint", 
function(t, i, isPrecision, xyzf, xyzt){
xyzt[3][i] = t;
var tPI = t * 3.141592653589793;
var xT = Math.sin(tPI) * this.cosTheta;
var yT = Math.cos(tPI);
var xR = this.radius * (xT * this.cosPhi - yT * this.sinPhi);
var yR = this.radius * (xT * this.sinPhi + yT * this.cosPhi);
var z2 = this.radius2 - (xR * xR + yR * yR);
var zR = (z2 > 0 ? Math.sqrt(z2) : 0);
if (isPrecision) {
xyzt[0][i] = xR;
xyzt[1][i] = yR;
xyzt[2][i] = zR;
} else if (this.tEvenDiameter) {
xyzf[0][i] = Clazz_doubleToInt(xR - 0.5);
xyzf[1][i] = Clazz_doubleToInt(yR - 0.5);
xyzf[2][i] = Clazz_doubleToInt(zR + 0.5);
} else {
xyzf[0][i] = Clazz_doubleToInt(xR);
xyzf[1][i] = Clazz_doubleToInt(yR);
xyzf[2][i] = Clazz_doubleToInt(zR + 0.5);
}xyzf[3][i] = this.shader.getShadeFp8(xR, yR, zR);
}, "~N,~N,~B,~A,~A");
Clazz_defineMethod(c$, "allocRaster", 
function(isPrecision, xyzf, xyzt){
if (this.rasterCount >= xyzf[0].length) while (this.rasterCount >= xyzf[0].length) {
for (var i = 4; --i >= 0; ) xyzf[i] = JU.AU.doubleLengthI(xyzf[i]);

xyzt[3] = JU.AU.doubleLengthF(xyzt[3]);
}
if (isPrecision) while (this.rasterCount >= xyzt[0].length) {
for (var i = 3; --i >= 0; ) xyzt[i] = JU.AU.doubleLengthF(xyzt[i]);

}
return this.rasterCount++;
}, "~B,~A,~A");
Clazz_defineMethod(c$, "interpolate", 
function(iLower, iUpper, xyzf, xyzt){
var x = xyzf[0];
var y = xyzf[1];
var dx = x[iUpper] - x[iLower];
if (dx < 0) dx = -dx;
var dy = y[iUpper] - y[iLower];
if (dy < 0) dy = -dy;
if ((dx + dy) <= 1) return;
var iMid = this.allocRaster(false, xyzf, xyzt);
x = xyzf[0];
y = xyzf[1];
var f = xyzf[3];
var tLower = xyzt[3][iLower];
var tUpper = xyzt[3][iUpper];
for (var j = 4; --j >= 0; ) {
var tMid = (tLower + tUpper) / 2;
this.calcRotatedPoint(tMid, iMid, false, xyzf, xyzt);
if ((x[iMid] == x[iLower]) && (y[iMid] == y[iLower])) {
f[iLower] = (f[iLower] + f[iMid]) >>> 1;
tLower = tMid;
} else if ((x[iMid] == x[iUpper]) && (y[iMid] == y[iUpper])) {
f[iUpper] = (f[iUpper] + f[iMid]) >>> 1;
tUpper = tMid;
} else {
this.interpolate(iLower, iMid, xyzf, xyzt);
this.interpolate(iMid, iUpper, xyzf, xyzt);
return;
}}
x[iMid] = x[iLower];
y[iMid] = y[iUpper];
}, "~N,~N,~A,~A");
Clazz_defineMethod(c$, "interpolatePrecisely", 
function(iLower, iUpper, xyzf, xyzt){
var x = xyzt[0];
var y = xyzt[1];
var dx = Clazz_doubleToInt(Math.floor(x[iUpper])) - Clazz_doubleToInt(Math.floor(x[iLower]));
if (dx < 0) dx = -dx;
var dy = Clazz_doubleToInt(Math.floor(y[iUpper])) - Clazz_doubleToInt(Math.floor(y[iLower]));
if (dy < 0) dy = -dy;
if ((dx + dy) <= 1) return;
var t = xyzt[3];
var tLower = t[iLower];
var tUpper = t[iUpper];
var iMid = this.allocRaster(true, xyzf, xyzt);
x = xyzt[0];
y = xyzt[1];
t = xyzt[3];
var f = xyzf[3];
for (var j = 4; --j >= 0; ) {
var tMid = (tLower + tUpper) / 2;
this.calcRotatedPoint(tMid, iMid, true, xyzf, xyzt);
if ((Clazz_doubleToInt(Math.floor(x[iMid])) == Clazz_doubleToInt(Math.floor(x[iLower]))) && (Clazz_doubleToInt(Math.floor(y[iMid])) == Clazz_doubleToInt(Math.floor(y[iLower])))) {
f[iLower] = (f[iLower] + f[iMid]) >>> 1;
tLower = tMid;
} else if ((Clazz_doubleToInt(Math.floor(x[iMid])) == Clazz_doubleToInt(Math.floor(x[iUpper]))) && (Clazz_doubleToInt(Math.floor(y[iMid])) == Clazz_doubleToInt(Math.floor(y[iUpper])))) {
f[iUpper] = (f[iUpper] + f[iMid]) >>> 1;
tUpper = tMid;
} else {
this.interpolatePrecisely(iLower, iMid, xyzf, xyzt);
this.interpolatePrecisely(iMid, iUpper, xyzf, xyzt);
return;
}}
x[iMid] = x[iLower];
y[iMid] = y[iUpper];
}, "~N,~N,~A,~A");
Clazz_defineMethod(c$, "renderFlatEndcap", 
function(isCylinder, isPrecise, xyzf){
var xT;
var yT;
var zT;
if (isPrecise) {
if (this.dzBf == 0 || this.colixEndcap == 0 || !this.g3d.setC(this.colixEndcap)) return;
var xTf = this.xAf;
var yTf = this.yAf;
var zTf = this.zAf;
if (isCylinder && this.dzBf < 0) {
xTf += this.dxBf;
yTf += this.dyBf;
zTf += this.dzBf;
}xT = Clazz_floatToInt(xTf);
yT = Clazz_floatToInt(yTf);
zT = Clazz_floatToInt(zTf);
} else {
if (this.dzB == 0 || this.colixEndcap == 0 || !this.g3d.setC(this.colixEndcap)) return;
xT = this.xAend;
yT = this.yAend;
zT = this.zAend;
if (isCylinder && this.dzB < 0) {
xT += this.dxB;
yT += this.dyB;
zT += this.dzB;
}}var yMin = xyzf[1][0];
var yMax = xyzf[1][0];
var zXMin = 0;
var zXMax = 0;
var xr = xyzf[0];
var yr = xyzf[1];
var zr = xyzf[2];
for (var i = this.rasterCount; --i > 0; ) {
var y = yr[i];
if (y < yMin) yMin = y;
 else if (y > yMax) yMax = y;
 else {
y = -y;
if (y < yMin) yMin = y;
 else if (y > yMax) yMax = y;
}}
for (var y = yMin; y <= yMax; ++y) {
var xMin = 2147483647;
var xMax = -2147483648;
for (var i = this.rasterCount; --i >= 0; ) {
if (yr[i] == y) {
var x = xr[i];
if (x < xMin) {
xMin = x;
zXMin = zr[i];
}if (x > xMax) {
xMax = x;
zXMax = zr[i];
}}if (yr[i] == -y) {
var x = -xr[i];
if (x < xMin) {
xMin = x;
zXMin = -zr[i];
}if (x > xMax) {
xMax = x;
zXMax = -zr[i];
}}}
var count = xMax - xMin + 1;
this.g3d.setColorNoisy(this.endcapShadeIndex);
this.g3d.plotPixelsClippedRaster(count, xT + xMin, yT + y, zT - zXMin - 1, zT - zXMax - 1, null, null);
}
}, "~B,~B,~A");
Clazz_defineMethod(c$, "renderSphericalEndcaps", 
function(){
if (this.colixA != 0 && this.g3d.setC(this.colixA)) this.g3d.fillSphereXYZ(this.diameter, this.xA, this.yA, this.zA + 1);
if (this.colixB != 0 && this.g3d.setC(this.colixB)) this.g3d.fillSphereXYZ(this.diameter, this.xA + this.dxB, this.yA + this.dyB, this.zA + this.dzB + 1);
});
Clazz_defineMethod(c$, "calcArgbEndcap", 
function(tCylinder, isFloat){
this.tEvenDiameter = ((this.diameter & 1) == 0);
this.radius = this.diameter / 2.0;
this.radius2 = this.radius * this.radius;
this.endCapHidden = false;
var dzf = (isFloat ? this.dzBf : this.dzB);
if (this.endcaps == 3 || dzf == 0) return;
this.xEndcap = this.xAend = this.xA;
this.yEndcap = this.yAend = this.yA;
this.zEndcap = this.zAend = this.zA;
var shadesEndcap;
var dxf = (isFloat ? this.dxBf : this.dxB);
var dyf = (isFloat ? this.dyBf : this.dyB);
if (dzf >= 0 || !tCylinder) {
this.endcapShadeIndex = this.shader.getShadeIndex(-dxf, -dyf, dzf);
if (this.colixA == 0) {
this.xAend += Clazz_doubleToInt(this.dxB / 2);
this.yAend += Clazz_doubleToInt(this.dyB / 2);
this.zAend += Clazz_doubleToInt(this.dzB / 2);
this.colixEndcap = this.colixB;
} else {
this.colixEndcap = this.colixA;
}} else {
this.endcapShadeIndex = this.shader.getShadeIndex(dxf, dyf, -dzf);
if (this.colixB == 0) {
this.colixEndcap = this.colixA;
this.xAend -= Clazz_doubleToInt(this.dxB / 2);
this.yAend -= Clazz_doubleToInt(this.dyB / 2);
this.zAend -= Clazz_doubleToInt(this.dzB / 2);
} else {
this.colixEndcap = this.colixB;
this.xEndcap += this.dxB;
this.yEndcap += this.dyB;
this.zEndcap += this.dzB;
}}shadesEndcap = (this.colixEndcap == this.colixA ? this.shadesA : this.shadesB);
if (this.endcapShadeIndex > 56) this.endcapShadeIndex = 56;
this.argbEndcap = shadesEndcap[this.endcapShadeIndex];
this.endCapHidden = (this.endcaps == 1);
}, "~B,~B");
});
;//5.0.1-v7 Mon Aug 17 10:07:10 MDT 2026
Clazz_declarePackage("J.g3d");
Clazz_declareInterface(J.g3d, "G3DRenderer");
;//5.0.1-v7 Mon Aug 17 10:07:10 MDT 2026
Clazz_declarePackage("J.g3d");
Clazz_load(["J.api.JmolRendererInterface", "JU.GData", "JU.P3i", "$.V3"], "J.g3d.Graphics3D", ["java.util.Arrays", "JU.AU", "J.api.Interface", "J.c.STER", "J.g3d.CylinderRenderer", "$.LineRenderer", "$.Pixelator", "$.PixelatorScreened", "$.PixelatorShaded", "$.PixelatorT", "$.Platform3D", "$.SphereRenderer", "$.TextRenderer", "$.TextString", "JU.C", "$.Normix"], function(){
var c$ = Clazz_decorateAsClass(function(){
this.platform = null;
this.line3d = null;
this.sphere3d = null;
this.cylinder3d = null;
this.triangle3d = null;
this.circle3d = null;
this.hermite3d = null;
this.isFullSceneAntialiasingEnabled = false;
this.antialias2 = false;
this.strings = null;
this.stringCount = 0;
this.anaglyphChannelBytes = null;
this.twoPass = false;
this.$haveTranslucentObjects = false;
this.pbuf = null;
this.pbufT = null;
this.zbuf = null;
this.zbufT = null;
this.translucencyMask = 0;
this.renderLow = false;
this.shadesCurrent = null;
this.anaglyphLength = 0;
this.pixel = null;
this.pixel0 = null;
this.pixelT0 = null;
this.pixelScreened = null;
this.pixelShaded = null;
this.zMargin = 0;
this.aobuf = null;
this.currentShadeIndex = 0;
this.lastRawColor = 0;
this.translucencyLog = 0;
this.wasScreened = false;
this.saveAmbient = 0;
this.saveDiffuse = 0;
this.sA = null;
this.sB = null;
this.sC = null;
this.vectorAB = null;
this.vectorAC = null;
this.vectorNormal = null;
this.shadeIndexes = null;
this.shadeIndexes2Sided = null;
this.pass2Flag01 = 0;
Clazz_instantialize(this, arguments);}, J.g3d, "Graphics3D", JU.GData, J.api.JmolRendererInterface);
Clazz_prepareFields (c$, function(){
this.sA =  new JU.P3i();
this.sB =  new JU.P3i();
this.sC =  new JU.P3i();
this.vectorAB =  new JU.V3();
this.vectorAC =  new JU.V3();
this.vectorNormal =  new JU.V3();
this.shadeIndexes =  Clazz_newByteArray (JU.GData.normixCount, 0);
this.shadeIndexes2Sided =  Clazz_newByteArray (JU.GData.normixCount, 0);
});
Clazz_makeConstructor(c$, 
function(){
Clazz_superConstructor (this, J.g3d.Graphics3D, []);
for (var i = JU.GData.normixCount; --i >= 0; ) this.transformedVectors[i] =  new JU.V3();

});
Clazz_overrideMethod(c$, "isWebGL", 
function(){
return false;
});
Clazz_overrideMethod(c$, "clear", 
function(){
this.stringCount = 0;
this.strings = null;
J.g3d.TextRenderer.clearFontCache();
});
Clazz_overrideMethod(c$, "destroy", 
function(){
this.releaseBuffers();
this.platform = null;
this.pixel = this.pixel0 = this.pixelShaded = null;
this.pixelT0 = null;
this.pixelScreened = null;
this.graphicsForMetrics = null;
});
Clazz_defineMethod(c$, "setZMargin", 
function(dz){
this.zMargin = dz;
}, "~N");
Clazz_overrideMethod(c$, "initialize", 
function(vwr, apiPlatform){
this.vwr = vwr;
this.apiPlatform = apiPlatform;
this.platform =  new J.g3d.Platform3D(apiPlatform);
this.pixel = this.pixel0 =  new J.g3d.Pixelator(this);
this.graphicsForMetrics = this.platform.getGraphicsForMetrics();
this.line3d =  new J.g3d.LineRenderer(this);
this.sphere3d =  new J.g3d.SphereRenderer(this);
this.cylinder3d =  new J.g3d.CylinderRenderer(this);
}, "JV.Viewer,J.api.GenericPlatform");
Clazz_overrideMethod(c$, "addRenderer", 
function(tok){
switch (tok) {
case 1073741880:
if (this.circle3d == null) this.circle3d = this.getRenderer("Circle");
break;
case 553648143:
if (this.hermite3d == null) this.hermite3d = this.getRenderer("Hermite");
case 1073742182:
if (this.triangle3d == null) {
this.triangle3d = this.getRenderer("Triangle");
(this.triangle3d).isOrthographic = !this.vwr.tm.perspectiveDepth;
}break;
}
}, "~N");
Clazz_defineMethod(c$, "getRenderer", 
function(type){
var r = (J.api.Interface.getOption("g3d." + type + "Renderer", this.vwr, "render"));
if (r == null) throw  new NullPointerException("Interface");
r.set(this, this);
return r;
}, "~S");
Clazz_overrideMethod(c$, "setWindowParameters", 
function(width, height, antialias){
this.setWinParams(width, height, antialias);
if (this.currentlyRendering) this.endRendering();
}, "~N,~N,~B");
Clazz_overrideMethod(c$, "checkTranslucent", 
function(isAlphaTranslucent){
if (isAlphaTranslucent) this.$haveTranslucentObjects = true;
return (!this.twoPass || this.twoPass && (this.isPass2 == isAlphaTranslucent));
}, "~B");
Clazz_overrideMethod(c$, "beginRendering", 
function(rotationMatrix, translucentMode, isImageWrite, renderLow){
if (this.currentlyRendering) this.endRendering();
this.renderLow = renderLow;
if (this.windowWidth != this.newWindowWidth || this.windowHeight != this.newWindowHeight || this.newAntialiasing != this.isFullSceneAntialiasingEnabled) {
this.windowWidth = this.newWindowWidth;
this.windowHeight = this.newWindowHeight;
this.isFullSceneAntialiasingEnabled = this.newAntialiasing;
this.releaseBuffers();
}this.setRotationMatrix(rotationMatrix);
(this.line3d).isOrthographic = !this.vwr.tm.perspectiveDepth;
if (this.triangle3d != null) (this.triangle3d).isOrthographic = !this.vwr.tm.perspectiveDepth;
this.antialiasEnabled = this.antialiasThisFrame = this.newAntialiasing;
this.currentlyRendering = true;
if (this.strings != null) for (var i = Math.min(this.strings.length, this.stringCount); --i >= 0; ) this.strings[i] = null;

this.stringCount = 0;
this.twoPass = true;
this.isPass2 = false;
this.pass2Flag01 = 0;
this.colixCurrent = 0;
this.$haveTranslucentObjects = this.wasScreened = false;
this.pixel = this.pixel0;
this.pixel.bgcolor = this.bgcolor;
this.contrastColix = JU.C.getBgContrast(this.bgcolor);
this.translucentCoverOnly = !translucentMode;
if (this.pbuf == null) {
this.platform.allocateBuffers(this.windowWidth, this.windowHeight, this.antialiasThisFrame, isImageWrite);
this.pbuf = this.platform.pBuffer;
this.zbuf = this.platform.zBuffer;
this.aobuf = null;
this.pixel0.setBuf();
if (this.pixelT0 != null) this.pixelT0.setBuf();
if (this.pixelShaded != null) this.pixelShaded.setBuf();
}this.setWidthHeight(this.antialiasThisFrame);
if (this.pixelScreened != null) this.pixelScreened.width = this.width;
this.platform.clearBuffer();
if (this.backgroundImage != null) this.plotImage(-2147483648, 0, -2147483648, this.backgroundImage, null, 0, 0, 0);
this.textY = 0;
}, "JU.M3,~B,~B,~B");
Clazz_overrideMethod(c$, "setBackgroundTransparent", 
function(TF){
if (this.platform != null) this.platform.setBackgroundTransparent(TF);
}, "~B");
Clazz_defineMethod(c$, "releaseBuffers", 
function(){
this.pbuf = null;
this.zbuf = null;
this.pbufT = null;
this.zbufT = null;
this.aobuf = null;
this.platform.releaseBuffers();
this.line3d.clearLineCache();
});
Clazz_overrideMethod(c$, "setPass2", 
function(antialiasTranslucent){
if (!this.$haveTranslucentObjects || !this.currentlyRendering) return false;
this.isPass2 = true;
this.pass2Flag01 = 1;
this.colixCurrent = 0;
if (this.pbufT == null || this.antialias2 != antialiasTranslucent) {
this.platform.allocateTBuffers(antialiasTranslucent);
this.pbufT = this.platform.pBufferT;
this.zbufT = this.platform.zBufferT;
}this.antialias2 = antialiasTranslucent;
if (this.antialiasThisFrame && !this.antialias2) this.downsampleFullSceneAntialiasing(true);
this.platform.clearTBuffer();
if (this.pixelT0 == null) this.pixelT0 =  new J.g3d.PixelatorT(this);
if (this.pixel.p0 == null) this.pixel = this.pixelT0;
 else this.pixel.p0 = this.pixelT0;
return true;
}, "~B");
Clazz_overrideMethod(c$, "endRendering", 
function(){
if (!this.currentlyRendering) return;
if (this.pbuf != null) {
if (this.isPass2 && this.pbufT != null) for (var offset = this.pbufT.length; --offset >= 0; ) this.pbuf[offset] = J.g3d.Graphics3D.mergeBufferPixel(this.pbuf[offset], this.pbufT[offset], this.bgcolor);

if (this.pixel === this.pixelShaded && this.pixelShaded.zShadePower == 0) this.pixelShaded.showZBuffer();
if (this.antialiasThisFrame) this.downsampleFullSceneAntialiasing(false);
}this.platform.setBackgroundColor(this.bgcolor);
this.platform.notifyEndOfRendering();
this.currentlyRendering = this.isPass2 = false;
});
c$.mergeBufferPixel = Clazz_defineMethod(c$, "mergeBufferPixel", 
function(argbA, argbB, bgcolor){
if (argbB == 0 || argbA == argbB) return argbA;
if (argbA == 0) argbA = bgcolor;
var rbA = (argbA & 0x00FF00FF);
var gA = (argbA & 0x0000FF00);
var rbB = (argbB & 0x00FF00FF);
var gB = (argbB & 0x0000FF00);
var logAlpha = (argbB >> 24) & 0xF;
switch (logAlpha) {
case 0:
rbA = rbB;
gA = gB;
break;
case 1:
rbA = (((rbB << 2) + (rbB << 1) + rbB + rbA) >> 3) & 0x00FF00FF;
gA = (((gB << 2) + +(gB << 1) + gB + gA) >> 3) & 0x0000FF00;
break;
case 2:
rbA = (((rbB << 1) + rbB + rbA) >> 2) & 0x00FF00FF;
gA = (((gB << 1) + gB + gA) >> 2) & 0x0000FF00;
break;
case 3:
rbA = (((rbB << 2) + rbB + (rbA << 1) + rbA) >> 3) & 0x00FF00FF;
gA = (((gB << 2) + gB + (gA << 1) + gA) >> 3) & 0x0000FF00;
break;
case 4:
rbA = ((rbA + rbB) >> 1) & 0x00FF00FF;
gA = ((gA + gB) >> 1) & 0x0000FF00;
break;
case 5:
rbA = (((rbB << 1) + rbB + (rbA << 2) + rbA) >> 3) & 0x00FF00FF;
gA = (((gB << 1) + gB + (gA << 2) + gA) >> 3) & 0x0000FF00;
break;
case 6:
rbA = (((rbA << 1) + rbA + rbB) >> 2) & 0x00FF00FF;
gA = (((gA << 1) + gA + gB) >> 2) & 0x0000FF00;
break;
case 7:
rbA = (((rbA << 2) + (rbA << 1) + rbA + rbB) >> 3) & 0x00FF00FF;
gA = (((gA << 2) + (gA << 1) + gA + gB) >> 3) & 0x0000FF00;
break;
}
return 0xFF000000 | rbA | gA;
}, "~N,~N,~N");
Clazz_overrideMethod(c$, "getScreenImage", 
function(isImageWrite){
{
var obj = this.platform.bufferedImage; if (isImageWrite) {
this.releaseBuffers(); } return obj;
}}, "~B");
Clazz_overrideMethod(c$, "applyAnaglygh", 
function(stereoMode, stereoColors){
switch (stereoMode) {
case J.c.STER.REDCYAN:
for (var i = this.anaglyphLength; --i >= 0; ) {
var blue = this.anaglyphChannelBytes[i] & 0x000000FF;
var cyan = (blue << 8) | blue;
this.pbuf[i] = this.pbuf[i] & 0xFFFF0000 | cyan;
}
break;
case J.c.STER.CUSTOM:
var color1 = stereoColors[0];
var color2 = stereoColors[1] & 0x00FFFFFF;
for (var i = this.anaglyphLength; --i >= 0; ) {
var a = this.anaglyphChannelBytes[i] & 0x000000FF;
a = (a | ((a | (a << 8)) << 8)) & color2;
this.pbuf[i] = (this.pbuf[i] & color1) | a;
}
break;
case J.c.STER.REDBLUE:
for (var i = this.anaglyphLength; --i >= 0; ) {
var blue = this.anaglyphChannelBytes[i] & 0x000000FF;
this.pbuf[i] = (this.pbuf[i] & 0xFFFF0000) | blue;
}
break;
case J.c.STER.REDGREEN:
for (var i = this.anaglyphLength; --i >= 0; ) {
var green = (this.anaglyphChannelBytes[i] & 0x000000FF) << 8;
this.pbuf[i] = (this.pbuf[i] & 0xFFFF0000) | green;
}
break;
case J.c.STER.DTI:
case J.c.STER.DOUBLE:
case J.c.STER.NONE:
break;
}
}, "J.c.STER,~A");
Clazz_overrideMethod(c$, "snapshotAnaglyphChannelBytes", 
function(){
if (this.currentlyRendering) throw  new NullPointerException();
this.anaglyphLength = this.windowWidth * this.windowHeight;
if (this.anaglyphChannelBytes == null || this.anaglyphChannelBytes.length != this.anaglyphLength) this.anaglyphChannelBytes =  Clazz_newByteArray (this.anaglyphLength, 0);
for (var i = this.anaglyphLength; --i >= 0; ) this.anaglyphChannelBytes[i] = this.pbuf[i];

});
Clazz_overrideMethod(c$, "releaseScreenImage", 
function(){
this.platform.clearScreenBufferThreaded();
});
Clazz_overrideMethod(c$, "haveTranslucentObjects", 
function(){
return this.$haveTranslucentObjects;
});
Clazz_overrideMethod(c$, "setSlabAndZShade", 
function(slabValue, depthValue, zSlab, zDepth, zShadePower){
this.setSlab(slabValue);
this.setDepth(depthValue);
if (zSlab < zDepth) {
if (this.pixelShaded == null) this.pixelShaded =  new J.g3d.PixelatorShaded(this);
this.pixel = this.pixelShaded.set(zSlab, zDepth, zShadePower);
} else {
this.pixel = this.pixel0;
}}, "~N,~N,~N,~N,~N");
Clazz_defineMethod(c$, "downsampleFullSceneAntialiasing", 
function(downsampleZBuffer){
var bgcheck = this.bgcolor;
if (downsampleZBuffer) bgcheck += ((bgcheck & 0xFF) == 0xFF ? -1 : 1);
J.g3d.Graphics3D.downsample2d(this.pbuf, this.windowWidth, this.windowHeight, bgcheck);
if (downsampleZBuffer) {
J.g3d.Graphics3D.downsample2dZ(this.pbuf, this.zbuf, this.windowWidth, this.windowHeight, bgcheck);
this.antialiasThisFrame = false;
this.setWidthHeight(false);
}}, "~B");
c$.downsample2d = Clazz_defineMethod(c$, "downsample2d", 
function(pbuf, width, height, bgcheck){
var width4 = width << 1;
if (bgcheck != 0) {
bgcheck &= 0xFFFFFF;
for (var i = pbuf.length; --i >= 0; ) if (pbuf[i] == 0) pbuf[i] = bgcheck;

}var bg0 = ((bgcheck >> 2) & 0x3F3F3F3F) << 2;
bg0 += (bg0 & 0xC0C0C0C0) >> 6;
var offset1 = 0;
var offset4 = 0;
for (var i = height; --i >= 0; offset4 += width4) for (var j = width; --j >= 0; ++offset1) {
var argb = ((pbuf[offset4] >> 2) & 0x3F3F3F3F) + ((pbuf[offset4++ + width4] >> 2) & 0x3F3F3F3F) + ((pbuf[offset4] >> 2) & 0x3F3F3F3F) + ((pbuf[offset4++ + width4] >> 2) & 0x3F3F3F3F);
argb += (argb & 0xC0C0C0C0) >> 6;
if (argb == bg0) argb = bgcheck;
{
pbuf[offset1] = argb & 0x00FFFFFF | 0xFF000000;
}}

}, "~A,~N,~N,~N");
c$.downsample2dZ = Clazz_defineMethod(c$, "downsample2dZ", 
function(pbuf, zbuf, width, height, bgcheck){
var width4 = width << 1;
var offset1 = 0;
var offset4 = 0;
for (var i = height; --i >= 0; offset4 += width4) for (var j = width; --j >= 0; ++offset1, ++offset4) {
var z = Math.min(zbuf[offset4], zbuf[offset4 + width4]);
z = Math.min(z, zbuf[++offset4]);
z = Math.min(z, zbuf[offset4 + width4]);
if (z != 2147483647) z >>= 1;
zbuf[offset1] = (pbuf[offset1] == bgcheck ? 2147483647 : z);
}

}, "~A,~A,~N,~N,~N");
Clazz_defineMethod(c$, "hasContent", 
function(){
return this.platform.hasContent();
});
Clazz_overrideMethod(c$, "setC", 
function(colix){
var isLast = JU.C.isColixLastAvailable(colix);
if (!isLast && colix == this.colixCurrent && this.currentShadeIndex == -1) return true;
var mask = colix & 30720;
if (mask == 16384) return false;
if (this.renderLow) mask = 0;
var isTranslucent = (mask != 0);
var isScreened = (isTranslucent && mask == 30720);
this.setScreened(isScreened);
if (!this.checkTranslucent(isTranslucent && !isScreened)) return false;
if (this.isPass2) {
this.translucencyMask = (mask << 13) | 0xFFFFFF;
this.translucencyLog = mask >> 11;
} else {
this.translucencyLog = 0;
}this.colixCurrent = colix;
if (isLast) {
if (this.argbCurrent != this.lastRawColor) {
if (this.argbCurrent == 0) this.argbCurrent = 0xFFFFFFFF;
this.lastRawColor = this.argbCurrent;
this.shader.setLastColix(this.argbCurrent, this.inGreyscaleMode);
}}this.shadesCurrent = this.getShades(colix);
this.currentShadeIndex = -1;
this.setColor(this.getColorArgbOrGray(colix));
return true;
}, "~N");
Clazz_defineMethod(c$, "setScreened", 
function(isScreened){
if (this.wasScreened != isScreened) {
this.wasScreened = isScreened;
if (isScreened) {
if (this.pixelScreened == null) this.pixelScreened =  new J.g3d.PixelatorScreened(this, this.pixel0);
if (this.pixel.p0 == null) this.pixel = this.pixelScreened;
 else this.pixel.p0 = this.pixelScreened;
} else if (this.pixel.p0 == null || this.pixel === this.pixelScreened) {
this.pixel = (this.isPass2 ? this.pixelT0 : this.pixel0);
} else {
this.pixel.p0 = (this.isPass2 ? this.pixelT0 : this.pixel0);
}}return this.pixel;
}, "~B");
Clazz_overrideMethod(c$, "drawFilledCircle", 
function(colixRing, colixFill, diameter, x, y, z){
if (this.isClippedZ(z)) return;
var r = Clazz_doubleToInt((diameter + 1) / 2);
var isClipped = x < r || x + r >= this.width || y < r || y + r >= this.height;
if (isClipped && this.isClippedXY(diameter, x, y)) return;
if (colixRing != 0 && this.setC(colixRing)) {
if (isClipped) {
if (!this.isClippedXY(diameter, x, y)) (this.circle3d).plotCircleCenteredClipped(x, y, z, diameter);
} else {
(this.circle3d).plotCircleCenteredUnclipped(x, y, z, diameter);
}}if (colixFill != 0 && this.setC(colixFill)) {
if (isClipped) (this.circle3d).plotFilledCircleCenteredClipped(x, y, z, diameter);
 else (this.circle3d).plotFilledCircleCenteredUnclipped(x, y, z, diameter);
}}, "~N,~N,~N,~N,~N,~N");
Clazz_overrideMethod(c$, "volumeRender4", 
function(diameter, x, y, z){
if (diameter == 1) {
this.plotPixelClippedArgb(this.argbCurrent, x, y, z, this.width, this.zbuf, this.pixel);
return;
}if (this.isClippedZ(z)) return;
var r = Clazz_doubleToInt((diameter + 1) / 2);
var isClipped = x < r || x + r >= this.width || y < r || y + r >= this.height;
if (isClipped && this.isClippedXY(diameter, x, y)) return;
if (isClipped) (this.circle3d).plotFilledCircleCenteredClipped(x, y, z, diameter);
 else (this.circle3d).plotFilledCircleCenteredUnclipped(x, y, z, diameter);
}, "~N,~N,~N,~N");
Clazz_overrideMethod(c$, "fillSphereXYZ", 
function(diameter, x, y, z){
switch (diameter) {
case 1:
this.plotPixelClippedArgb(this.argbCurrent, x, y, z, this.width, this.zbuf, this.pixel);
return;
case 0:
return;
}
if (diameter <= (this.antialiasThisFrame ? 2000 : 1000)) this.sphere3d.render(this.shadesCurrent, diameter, x, y, z, null, null, null, -1, null);
}, "~N,~N,~N,~N");
Clazz_overrideMethod(c$, "volumeRender", 
function(TF){
if (TF) {
this.saveAmbient = this.getAmbientPercent();
this.saveDiffuse = this.getDiffusePercent();
this.setAmbientPercent(100);
this.setDiffusePercent(0);
this.addRenderer(1073741880);
} else {
this.setAmbientPercent(this.saveAmbient);
this.setDiffusePercent(this.saveDiffuse);
}}, "~B");
Clazz_overrideMethod(c$, "fillSphereI", 
function(diameter, center){
this.fillSphereXYZ(diameter, center.x, center.y, center.z);
}, "~N,JU.P3i");
Clazz_overrideMethod(c$, "fillSphereBits", 
function(diameter, center){
this.fillSphereXYZ(diameter, Math.round(center.x), Math.round(center.y), Math.round(center.z));
}, "~N,JU.P3");
Clazz_overrideMethod(c$, "fillEllipsoid", 
function(center, points, x, y, z, diameter, mToEllipsoidal, coef, mDeriv, selectedOctant, octantPoints){
switch (diameter) {
case 1:
this.plotPixelClippedArgb(this.argbCurrent, x, y, z, this.width, this.zbuf, this.pixel);
return;
case 0:
return;
}
if (diameter <= (this.antialiasThisFrame ? 2000 : 1000)) this.sphere3d.render(this.shadesCurrent, diameter, x, y, z, mToEllipsoidal, coef, mDeriv, selectedOctant, octantPoints);
}, "JU.P3,~A,~N,~N,~N,~N,JU.M3,~A,JU.M4,~N,~A");
Clazz_overrideMethod(c$, "drawRect", 
function(x, y, z, zSlab, rWidth, rHeight){
if (zSlab != 0 && this.isClippedZ(zSlab)) return;
var w = rWidth - 1;
var h = rHeight - 1;
var xRight = x + w;
var yBottom = y + h;
if (y >= 0 && y < this.height) this.drawHLine(x, y, z, w);
if (yBottom >= 0 && yBottom < this.height) this.drawHLine(x, yBottom, z, w);
if (x >= 0 && x < this.width) this.drawVLine(x, y, z, h);
if (xRight >= 0 && xRight < this.width) this.drawVLine(xRight, y, z, h);
}, "~N,~N,~N,~N,~N,~N");
Clazz_defineMethod(c$, "drawHLine", 
function(x, y, z, w){
if (w < 0) {
x += w;
w = -w;
}if (x < 0) {
w += x;
x = 0;
}if (x + w >= this.width) w = this.width - 1 - x;
var p = this.pixel;
var c = this.argbCurrent;
var offset = x + this.width * y;
for (var i = 0; i <= w; i++) {
if (z < this.zbuf[offset]) p.addPixel(offset, z, c);
offset++;
}
}, "~N,~N,~N,~N");
Clazz_defineMethod(c$, "drawVLine", 
function(x, y, z, h){
if (h < 0) {
y += h;
h = -h;
}if (y < 0) {
h += y;
y = 0;
}if (y + h >= this.height) {
h = this.height - 1 - y;
}var offset = x + this.width * y;
var p = this.pixel;
var c = this.argbCurrent;
for (var i = 0; i <= h; i++) {
if (z < this.zbuf[offset]) p.addPixel(offset, z, c);
offset += this.width;
}
}, "~N,~N,~N,~N");
Clazz_overrideMethod(c$, "fillTextRect", 
function(x, y, z, zSlab, widthFill, heightFill){
if (this.isClippedZ(zSlab)) return;
var w = this.width;
if (x < 0) {
widthFill += x;
if (widthFill <= 0) return;
x = 0;
}if (x + widthFill > w) {
widthFill = w - x;
if (widthFill <= 0) return;
}if (y < 0) {
heightFill += y;
if (heightFill <= 0) return;
y = 0;
}if (y + heightFill > this.height) heightFill = this.height - y;
var c = this.argbCurrent;
if (this.isAntialiased()) c = J.g3d.Graphics3D.fixTextImageRGB(c);
var zb = this.zbuf;
var p = this.pixel;
while (--heightFill >= 0) this.plotPixelsUnclippedCount(c, widthFill, x, y++, z, w, zb, p);

}, "~N,~N,~N,~N,~N,~N");
Clazz_overrideMethod(c$, "drawString", 
function(str, font3d, xBaseline, yBaseline, z, zSlab, bgColix){
this.currentShadeIndex = 0;
if (str == null) return;
if (this.isClippedZ(zSlab)) return;
this.drawStringNoSlab(str, font3d, xBaseline, yBaseline, z, bgColix);
}, "~S,JU.Font,~N,~N,~N,~N,~N");
Clazz_overrideMethod(c$, "drawStringNoSlab", 
function(str, font3d, xBaseline, yBaseline, z, bgColix){
if (str == null) return;
if (this.strings == null) this.strings =  new Array(10);
if (this.stringCount == this.strings.length) this.strings = JU.AU.doubleLength(this.strings);
var t =  new J.g3d.TextString();
t.setText(str, font3d == null ? this.currentFont : (this.currentFont = font3d), this.argbCurrent, JU.C.isColixTranslucent(bgColix) ? (this.getColorArgbOrGray(bgColix) & 0xFFFFFF) | ((bgColix & 30720) << 13) : 0, xBaseline, yBaseline, z);
this.strings[this.stringCount++] = t;
}, "~S,JU.Font,~N,~N,~N,~N");
Clazz_overrideMethod(c$, "renderAllStrings", 
function(jmolRenderer){
if (this.strings == null) return;
if (this.stringCount >= 2) {
if (J.g3d.Graphics3D.sort == null) J.g3d.Graphics3D.sort =  new J.g3d.TextString();
java.util.Arrays.sort(this.strings, J.g3d.Graphics3D.sort);
}for (var i = 0; i < this.stringCount; i++) {
var ts = this.strings[i];
this.plotText(ts.x, ts.y, ts.z, ts.argb, ts.bgargb, ts.text, ts.font, jmolRenderer);
}
this.strings = null;
this.stringCount = 0;
}, "~O");
Clazz_overrideMethod(c$, "plotText", 
function(x, y, z, argb, bgargb, text, font3d, jmolRenderer){
J.g3d.TextRenderer.plot(x, y, z, argb, bgargb, text, font3d, this, jmolRenderer, this.antialiasThisFrame);
}, "~N,~N,~N,~N,~N,~S,JU.Font,J.api.JmolRendererInterface");
Clazz_overrideMethod(c$, "drawImage", 
function(objImage, x, y, z, zSlab, bgcolix, width, height){
if (objImage != null && width > 0 && height > 0 && !this.isClippedZ(zSlab)) this.plotImage(x, y, z, objImage, null, bgcolix, width, height);
}, "~O,~N,~N,~N,~N,~N,~N,~N");
Clazz_overrideMethod(c$, "plotImage", 
function(x, y, z, image, jmolRenderer, bgcolix, imageWidth, imageHeight){
this.setC(bgcolix);
if (!this.isPass2) this.translucencyMask = -1;
if (bgcolix == 0) this.argbCurrent = 0;
var isBackground = (x == -2147483648);
var bg = (isBackground ? this.bgcolor : this.argbCurrent);
if (isBackground) {
x = 0;
z = 2147483646;
imageWidth = this.width;
imageHeight = this.height;
}if (x + imageWidth <= 0 || x >= this.width || y + imageHeight <= 0 || y >= this.height) return;
var g;
{
g = null;
}var buffer = this.apiPlatform.drawImageToBuffer(g, this.platform.offscreenImage, image, imageWidth, imageHeight, isBackground ? bg : 0);
if (buffer == null) return;
var zb = this.zbuf;
var w = this.width;
var p = this.pixel;
var h = this.height;
var t = this.translucencyLog;
if (jmolRenderer == null && (x >= 0 && x + imageWidth <= w && y >= 0 && y + imageHeight <= h)) {
for (var i = 0, offset = 0, pbufOffset = y * w + x; i < imageHeight; i++, pbufOffset += (w - imageWidth)) {
for (var j = 0; j < imageWidth; j++, offset++, pbufOffset++) {
if (z < zb[pbufOffset]) {
var b = buffer[offset];
if ((b & 0xFF000000) == (-16777216)) p.addPixel(pbufOffset, z, b);
}}
}
} else {
if (jmolRenderer == null) jmolRenderer = this;
for (var i = 0, offset = 0; i < imageHeight; i++) for (var j = 0; j < imageWidth; j++) {
var b = buffer[offset++];
if ((b & 0xFF000000) == (-16777216)) jmolRenderer.plotImagePixel(b, x + j, y + i, z, 8, bg, w, h, zb, p, t);
}

}}, "~N,~N,~N,~O,J.api.JmolRendererInterface,~N,~N,~N");
Clazz_overrideMethod(c$, "setFont", 
function(font3d){
this.currentFont = font3d;
}, "JU.Font");
Clazz_overrideMethod(c$, "drawPixel", 
function(x, y, z){
this.plotPixelClippedArgb(this.argbCurrent, x, y, z, this.width, this.zbuf, this.pixel);
}, "~N,~N,~N");
Clazz_overrideMethod(c$, "drawPoints", 
function(count, coordinates, scale){
if (scale > 1) {
var s2 = scale * scale * 0.8;
for (var i = -scale; i < scale; i++) {
for (var j = -scale; j < scale; j++) {
if (i * i + j * j > s2) continue;
this.plotPoints(count, coordinates, i, j);
this.plotPoints(count, coordinates, i, j);
}
}
} else {
this.plotPoints(count, coordinates, 0, 0);
}}, "~N,~A,~N");
Clazz_overrideMethod(c$, "drawDashedLineBits", 
function(run, rise, pointA, pointB){
if (this.isAntialiased()) {
run += run;
rise += rise;
}this.setScreeni(pointA, this.sA);
this.setScreeni(pointB, this.sB);
this.drawLineABBits(run, rise, true);
}, "~N,~N,JU.P3,JU.P3");
Clazz_defineMethod(c$, "drawLineABBits", 
function(run, rise, andClip){
this.line3d.plotLineBits(this.argbCurrent, this.argbCurrent, this.sA, this.sB, run, rise, andClip);
if (Math.abs(this.sA.x - this.sB.x) < Math.abs(this.sA.y - this.sB.y)) {
this.sA.x += 1;
this.sB.x += 1;
this.line3d.plotLineBits(this.argbCurrent, this.argbCurrent, this.sA, this.sB, run, rise, andClip);
} else {
this.sA.y += 1;
this.sB.y += 1;
this.line3d.plotLineBits(this.argbCurrent, this.argbCurrent, this.sA, this.sB, run, rise, andClip);
}}, "~N,~N,~B");
Clazz_defineMethod(c$, "setScreeni", 
function(pt, p){
p.x = Math.round(pt.x);
p.y = Math.round(pt.y);
p.z = Math.round(pt.z);
}, "JU.P3,JU.P3i");
Clazz_overrideMethod(c$, "drawLineXYZ", 
function(x1, y1, z1, x2, y2, z2){
this.line3d.plotLineInt(this.argbCurrent, this.argbCurrent, x1, y1, z1, x2, y2, z2);
}, "~N,~N,~N,~N,~N,~N");
Clazz_overrideMethod(c$, "drawLine", 
function(colixA, colixB, x1, y1, z1, x2, y2, z2){
if (!this.setC(colixA)) colixA = 0;
var argbA = this.argbCurrent;
if (!this.setC(colixB)) colixB = 0;
if (colixA != 0 || colixB != 0) this.line3d.plotLineInt(argbA, this.argbCurrent, x1, y1, z1, x2, y2, z2);
}, "~N,~N,~N,~N,~N,~N,~N,~N");
Clazz_overrideMethod(c$, "drawLineBits", 
function(colixA, colixB, pointA, pointB){
if (!this.setC(colixA)) colixA = 0;
var argbA = this.argbCurrent;
if (!this.setC(colixB)) colixB = 0;
if (colixA != 0 || colixB != 0) {
this.setScreeni(pointA, this.sA);
this.setScreeni(pointB, this.sB);
this.line3d.plotLineBits(argbA, this.argbCurrent, this.sA, this.sB, 0, 0, false);
}}, "~N,~N,JU.P3,JU.P3");
Clazz_overrideMethod(c$, "drawLinePixels", 
function(a, b, z, zslab){
this.sA.setT(a);
this.sB.setT(b);
this.sA.z = this.sB.z = z;
var slab0 = this.slab;
if (zslab == -2147483648) this.slab = 0;
this.drawLineABBits(0, 0, false);
this.slab = slab0;
}, "JU.P3i,JU.P3i,~N,~N");
Clazz_overrideMethod(c$, "drawLineAB", 
function(pointA, pointB){
this.setScreeni(pointA, this.sA);
this.setScreeni(pointB, this.sB);
this.line3d.plotLineBits(this.argbCurrent, this.argbCurrent, this.sA, this.sB, 0, 0, false);
}, "JU.P3,JU.P3");
Clazz_overrideMethod(c$, "fillCylinderXYZ", 
function(colixA, colixB, endcaps, diameter, xA, yA, zA, xB, yB, zB){
if (diameter > this.ht3) return;
var screen = 0;
this.currentShadeIndex = 0;
if (!this.setC(colixB)) colixB = 0;
if (this.wasScreened) screen = 2;
if (!this.setC(colixA)) colixA = 0;
if (this.wasScreened) screen += 1;
if (colixA == 0 && colixB == 0) return;
this.cylinder3d.renderOld(colixA, colixB, screen, endcaps, diameter, xA, yA, zA, xB, yB, zB);
}, "~N,~N,~N,~N,~N,~N,~N,~N,~N,~N");
Clazz_overrideMethod(c$, "fillCylinderScreen3I", 
function(endcaps, diameter, screenA, screenB, pt0f, pt1f, radius){
if (diameter <= this.ht3) this.cylinder3d.renderOld(this.colixCurrent, this.colixCurrent, 0, endcaps, diameter, Clazz_floatToInt(screenA.x), Clazz_floatToInt(screenA.y), Clazz_floatToInt(screenA.z), Clazz_floatToInt(screenB.x), Clazz_floatToInt(screenB.y), Clazz_floatToInt(screenB.z));
}, "~N,~N,JU.P3,JU.P3,JU.P3,JU.P3,~N");
Clazz_overrideMethod(c$, "fillCylinder", 
function(endcaps, diameter, screenA, screenB){
if (diameter <= this.ht3) this.cylinder3d.renderOld(this.colixCurrent, this.colixCurrent, 0, endcaps, diameter, screenA.x, screenA.y, screenA.z, screenB.x, screenB.y, screenB.z);
}, "~N,~N,JU.P3i,JU.P3i");
Clazz_overrideMethod(c$, "fillCylinderBits", 
function(endcaps, diameter, screenA, screenB){
if (diameter <= this.ht3 && screenA.z != 1 && screenB.z != 1) {
if (diameter == 0 || diameter == 1) {
this.setScreeni(screenA, this.sA);
this.setScreeni(screenB, this.sB);
this.line3d.plotLineBits(this.getColorArgbOrGray(this.colixCurrent), this.getColorArgbOrGray(this.colixCurrent), this.sA, this.sB, 0, 0, false);
return;
}this.cylinder3d.renderBitsFloat(this.colixCurrent, this.colixCurrent, 0, endcaps, diameter, screenA, screenB);
}}, "~N,~N,JU.P3,JU.P3");
Clazz_overrideMethod(c$, "fillCylinderBits2", 
function(colixA, colixB, endcaps, diameter, screenA, screenB){
if (diameter > this.ht3) return;
var screen = 0;
this.currentShadeIndex = 0;
if (!this.setC(colixB)) colixB = 0;
if (this.wasScreened) screen = 2;
if (!this.setC(colixA)) colixA = 0;
if (this.wasScreened) screen += 1;
if (colixA == 0 && colixB == 0) return;
this.setScreeni(screenA, this.sA);
this.setScreeni(screenB, this.sB);
this.cylinder3d.renderBits(colixA, colixB, screen, endcaps, diameter, this.sA, this.sB);
}, "~N,~N,~N,~N,JU.P3,JU.P3");
Clazz_overrideMethod(c$, "fillConeScreen3f", 
function(endcap, screenDiameter, screenBase, screenTip, isBarb){
if (screenDiameter <= this.ht3) this.cylinder3d.renderConeOld(this.colixCurrent, endcap, screenDiameter, screenBase.x, screenBase.y, screenBase.z, screenTip.x, screenTip.y, screenTip.z, true, isBarb);
}, "~N,~N,JU.P3,JU.P3,~B");
Clazz_overrideMethod(c$, "drawHermite4", 
function(tension, s0, s1, s2, s3){
(this.hermite3d).renderHermiteRope(false, tension, 0, 0, 0, s0, s1, s2, s3);
}, "~N,JU.P3,JU.P3,JU.P3,JU.P3");
Clazz_overrideMethod(c$, "drawHermite7", 
function(fill, border, tension, s0, s1, s2, s3, s4, s5, s6, s7, aspectRatio, colixBack){
if (colixBack == 0) {
(this.hermite3d).renderHermiteRibbon(fill, border, tension, s0, s1, s2, s3, s4, s5, s6, s7, aspectRatio, 0);
return;
}(this.hermite3d).renderHermiteRibbon(fill, border, tension, s0, s1, s2, s3, s4, s5, s6, s7, aspectRatio, 1);
var colix = this.colixCurrent;
this.setC(colixBack);
(this.hermite3d).renderHermiteRibbon(fill, border, tension, s0, s1, s2, s3, s4, s5, s6, s7, aspectRatio, -1);
this.setC(colix);
}, "~B,~B,~N,JU.P3,JU.P3,JU.P3,JU.P3,JU.P3,JU.P3,JU.P3,JU.P3,~N,~N");
Clazz_overrideMethod(c$, "fillHermite", 
function(tension, diameterBeg, diameterMid, diameterEnd, s0, s1, s2, s3){
(this.hermite3d).renderHermiteRope(true, tension, diameterBeg, diameterMid, diameterEnd, s0, s1, s2, s3);
}, "~N,~N,~N,~N,JU.P3,JU.P3,JU.P3,JU.P3");
Clazz_overrideMethod(c$, "drawTriangle3C", 
function(screenA, colixA, screenB, colixB, screenC, colixC, check){
if ((check & 1) == 1) this.drawLine(colixA, colixB, screenA.x, screenA.y, screenA.z, screenB.x, screenB.y, screenB.z);
if ((check & 2) == 2) this.drawLine(colixB, colixC, screenB.x, screenB.y, screenB.z, screenC.x, screenC.y, screenC.z);
if ((check & 4) == 4) this.drawLine(colixA, colixC, screenA.x, screenA.y, screenA.z, screenC.x, screenC.y, screenC.z);
}, "JU.P3i,~N,JU.P3i,~N,JU.P3i,~N,~N");
Clazz_overrideMethod(c$, "fillTriangleTwoSided", 
function(normix, screenA, screenB, screenC){
this.setColorNoisy(this.getShadeIndex(normix));
this.fillTriangleP3f(screenA, screenB, screenC, false);
}, "~N,JU.P3,JU.P3,JU.P3");
Clazz_defineMethod(c$, "fillTriangleP3f", 
function(screenA, screenB, screenC, useGouraud){
this.setScreeni(screenA, this.sA);
this.setScreeni(screenB, this.sB);
this.setScreeni(screenC, this.sC);
(this.triangle3d).fillTriangle(this.sA, this.sB, this.sC, useGouraud);
}, "JU.P3,JU.P3,JU.P3,~B");
Clazz_overrideMethod(c$, "fillTriangle3f", 
function(screenA, screenB, screenC, isSolid){
var i = this.getShadeIndexP3(screenA, screenB, screenC, isSolid);
if (i < 0) return;
if (isSolid) this.setColorNoisy(i);
 else this.setColor(this.shadesCurrent[i]);
this.fillTriangleP3f(screenA, screenB, screenC, false);
}, "JU.P3,JU.P3,JU.P3,~B");
Clazz_overrideMethod(c$, "fillTriangle3i", 
function(screenA, screenB, screenC, ptA, ptB, ptC, doShade){
if (doShade) {
var v = this.vectorAB;
v.set(screenB.x - screenA.x, screenB.y - screenA.y, screenB.z - screenA.z);
var shadeIndex;
if (screenC == null) {
shadeIndex = this.shader.getShadeIndex(-v.x, -v.y, v.z);
} else {
this.vectorAC.set(screenC.x - screenA.x, screenC.y - screenA.y, screenC.z - screenA.z);
v.cross(v, this.vectorAC);
shadeIndex = v.z >= 0 ? this.shader.getShadeIndex(-v.x, -v.y, v.z) : this.shader.getShadeIndex(v.x, v.y, -v.z);
}if (shadeIndex > 56) shadeIndex = 56;
this.setColorNoisy(shadeIndex);
}this.fillTriangleP3f(screenA, screenB, screenC, false);
}, "JU.P3,JU.P3,JU.P3,JU.T3,JU.T3,JU.T3,~B");
Clazz_overrideMethod(c$, "fillTriangle3CN", 
function(screenA, colixA, normixA, screenB, colixB, normixB, screenC, colixC, normixC){
(this.triangle3d).fillTriangle(screenA, screenB, screenC, this.checkGouraud(colixA, colixB, colixC, normixA, normixB, normixC));
}, "JU.P3i,~N,~N,JU.P3i,~N,~N,JU.P3i,~N,~N");
Clazz_overrideMethod(c$, "fillTriangle3CNBits", 
function(screenA, colixA, normixA, screenB, colixB, normixB, screenC, colixC, normixC, twoSided){
this.fillTriangleP3f(screenA, screenB, screenC, this.checkGouraud(colixA, colixB, colixC, normixA, normixB, normixC));
}, "JU.P3,~N,~N,JU.P3,~N,~N,JU.P3,~N,~N,~B");
Clazz_defineMethod(c$, "checkGouraud", 
function(colixA, colixB, colixC, normixA, normixB, normixC){
if (!this.isPass2 && normixA == normixB && normixA == normixC && colixA == colixB && colixA == colixC) {
var shadeIndex = this.getShadeIndex(normixA);
if (colixA != this.colixCurrent || this.currentShadeIndex != shadeIndex) {
this.currentShadeIndex = -1;
this.setC(colixA);
this.setColorNoisy(shadeIndex);
}return false;
}this.setTriangleTranslucency(colixA, colixB, colixC);
(this.triangle3d).setGouraud(this.getShades(colixA)[this.getShadeIndex(normixA)], this.getShades(colixB)[this.getShadeIndex(normixB)], this.getShades(colixC)[this.getShadeIndex(normixC)]);
return true;
}, "~N,~N,~N,~N,~N,~N");
Clazz_defineMethod(c$, "getShadeIndex", 
function(normix){
return (normix == -10000 || normix == 9999 ? J.g3d.Graphics3D.nullShadeIndex : normix < 0 ? this.shadeIndexes2Sided[~normix] : this.shadeIndexes[normix]);
}, "~N");
Clazz_defineMethod(c$, "setTriangleTranslucency", 
function(colixA, colixB, colixC){
if (this.isPass2) {
var maskA = colixA & 30720;
var maskB = colixB & 30720;
var maskC = colixC & 30720;
maskA &= -16385;
maskB &= -16385;
maskC &= -16385;
var mask = JU.GData.roundInt(Clazz_doubleToInt((maskA + maskB + maskC) / 3)) & 30720;
this.translucencyMask = (mask << 13) | 0xFFFFFF;
}}, "~N,~N,~N");
Clazz_overrideMethod(c$, "fillQuadrilateral", 
function(screenA, screenB, screenC, screenD, isSolid){
var i = this.getShadeIndexP3(screenA, screenB, screenC, isSolid);
if (i < 0) return;
this.setColorNoisy(i);
this.fillTriangleP3f(screenA, screenB, screenC, false);
this.fillTriangleP3f(screenA, screenC, screenD, false);
}, "JU.P3,JU.P3,JU.P3,JU.P3,~B");
Clazz_overrideMethod(c$, "drawSurface", 
function(meshSurface, colix){
}, "JU.MeshSurface,~N");
Clazz_overrideMethod(c$, "plotPixelClippedP3i", 
function(screen){
this.plotPixelClippedArgb(this.argbCurrent, screen.x, screen.y, screen.z, this.width, this.zbuf, this.pixel);
}, "JU.P3i");
Clazz_defineMethod(c$, "plotPixelClippedArgb", 
function(argb, x, y, z, width, zbuf, p){
if (this.isClipped3(x, y, z)) return;
var offset = y * width + x;
if (z < zbuf[offset]) p.addPixel(offset, z, argb);
}, "~N,~N,~N,~N,~N,~A,J.g3d.Pixelator");
Clazz_defineMethod(c$, "plotPixelUnclipped", 
function(argb, x, y, z, width, zbuf, p){
var offset = y * width + x;
if (z < zbuf[offset]) p.addPixel(offset, z, argb);
}, "~N,~N,~N,~N,~N,~A,J.g3d.Pixelator");
Clazz_defineMethod(c$, "plotImagePixel", 
function(argb, x, y, z, shade, bgargb, width, height, zbuf, p, transpLog){
if (x < 0 || x >= width || y < 0 || y >= height) return;
(p).addImagePixel(shade, transpLog, y * width + x, z, argb, bgargb);
}, "~N,~N,~N,~N,~N,~N,~N,~N,~A,~O,~N");
Clazz_defineMethod(c$, "plotPixelsClippedRaster", 
function(count, x, y, zAtLeft, zPastRight, rgb16Left, rgb16Right){
var depth;
var slab;
if (count <= 0 || y < 0 || y >= this.height || x >= this.width || (zAtLeft < (slab = this.slab) && zPastRight < slab) || (zAtLeft > (depth = this.depth) && zPastRight > depth)) return;
var zb = this.zbuf;
var seed = (x << 16) + (y << 1) ^ 0x33333333;
var zScaled = (zAtLeft << 10) + (512);
var dz = zPastRight - zAtLeft;
var roundFactor = Clazz_doubleToInt(count / 2);
var zIncrementScaled = JU.GData.roundInt(Clazz_doubleToInt(((dz << 10) + (dz >= 0 ? roundFactor : -roundFactor)) / count));
if (x < 0) {
x = -x;
zScaled += zIncrementScaled * x;
count -= x;
if (count <= 0) return;
x = 0;
}if (count + x > this.width) count = this.width - x;
var offsetPbuf = y * this.width + x;
var p = this.pixel;
if (rgb16Left == null) {
var adn = this.argbNoisyDn;
var aup = this.argbNoisyUp;
var ac = this.argbCurrent;
while (--count >= 0) {
var z = zScaled >> 10;
if (z >= slab && z <= depth && z < zb[offsetPbuf]) {
seed = ((seed << 16) + (seed << 1) + seed) & 0x7FFFFFFF;
var bits = (seed >> 16) & 0x07;
p.addPixel(offsetPbuf, z, bits == 0 ? adn : (bits == 1 ? aup : ac));
}++offsetPbuf;
zScaled += zIncrementScaled;
}
} else {
var rScaled = rgb16Left.r << 8;
var rIncrement = Clazz_doubleToInt(((rgb16Right.r - rgb16Left.r) << 8) / count);
var gScaled = rgb16Left.g;
var gIncrement = Clazz_doubleToInt((rgb16Right.g - gScaled) / count);
var bScaled = rgb16Left.b;
var bIncrement = Clazz_doubleToInt((rgb16Right.b - bScaled) / count);
while (--count >= 0) {
var z = zScaled >> 10;
if (z >= slab && z <= depth && z < zb[offsetPbuf]) p.addPixel(offsetPbuf, z, 0xFF000000 | (rScaled & 0xFF0000) | (gScaled & 0xFF00) | ((bScaled >> 8) & 0xFF));
++offsetPbuf;
zScaled += zIncrementScaled;
rScaled += rIncrement;
gScaled += gIncrement;
bScaled += bIncrement;
}
}}, "~N,~N,~N,~N,~N,JU.Rgb16,JU.Rgb16");
Clazz_defineMethod(c$, "plotPixelsUnclippedRaster", 
function(count, x, y, zAtLeft, zPastRight, rgb16Left, rgb16Right){
if (count <= 0) return;
var seed = ((x << 16) + (y << 1) ^ 0x33333333) & 0x7FFFFFFF;
var zScaled = (zAtLeft << 10) + (512);
var dz = zPastRight - zAtLeft;
var roundFactor = Clazz_doubleToInt(count / 2);
var zIncrementScaled = JU.GData.roundInt(Clazz_doubleToInt(((dz << 10) + (dz >= 0 ? roundFactor : -roundFactor)) / count));
var offsetPbuf = y * this.width + x;
var zb = this.zbuf;
var p = this.pixel;
if (rgb16Left == null) {
var adn = this.argbNoisyDn;
var aup = this.argbNoisyUp;
var ac = this.argbCurrent;
while (--count >= 0) {
var z = zScaled >> 10;
if (z < zb[offsetPbuf]) {
seed = ((seed << 16) + (seed << 1) + seed) & 0x7FFFFFFF;
var bits = (seed >> 16) & 0x07;
p.addPixel(offsetPbuf, z, bits == 0 ? adn : (bits == 1 ? aup : ac));
}++offsetPbuf;
zScaled += zIncrementScaled;
}
} else {
var rScaled = rgb16Left.r << 8;
var rIncrement = JU.GData.roundInt(Clazz_doubleToInt(((rgb16Right.r - rgb16Left.r) << 8) / count));
var gScaled = rgb16Left.g;
var gIncrement = JU.GData.roundInt(Clazz_doubleToInt((rgb16Right.g - gScaled) / count));
var bScaled = rgb16Left.b;
var bIncrement = JU.GData.roundInt(Clazz_doubleToInt((rgb16Right.b - bScaled) / count));
while (--count >= 0) {
var z = zScaled >> 10;
if (z < zb[offsetPbuf]) p.addPixel(offsetPbuf, z, 0xFF000000 | (rScaled & 0xFF0000) | (gScaled & 0xFF00) | ((bScaled >> 8) & 0xFF));
++offsetPbuf;
zScaled += zIncrementScaled;
rScaled += rIncrement;
gScaled += gIncrement;
bScaled += bIncrement;
}
}}, "~N,~N,~N,~N,~N,JU.Rgb16,JU.Rgb16");
Clazz_defineMethod(c$, "plotPixelsClippedRasterBits", 
function(count, x, y, zAtLeft, zPastRight, rgb16Left, rgb16Right, a, b){
var depth;
var slab;
if (count <= 0 || y < 0 || y >= this.height || x >= this.width || (zAtLeft < (slab = this.slab) && zPastRight < slab) || (zAtLeft > (depth = this.depth) && zPastRight > depth)) return;
var zb = this.zbuf;
var seed = (x << 16) + (y << 1) ^ 0x33333333;
if (x < 0) {
x = -x;
count -= x;
if (count <= 0) return;
x = 0;
}if (count + x > this.width) count = this.width - x;
var offsetPbuf = y * this.width + x;
var p = this.pixel;
if (rgb16Left == null) {
var adn = this.argbNoisyDn;
var aup = this.argbNoisyUp;
var ac = this.argbCurrent;
while (--count >= 0) {
var zCurrent = this.line3d.getZCurrent(a, b, x++);
if (zCurrent >= slab && zCurrent <= depth && zCurrent < zb[offsetPbuf]) {
seed = ((seed << 16) + (seed << 1) + seed) & 0x7FFFFFFF;
var bits = (seed >> 16) & 0x07;
p.addPixel(offsetPbuf, zCurrent, bits < 2 ? adn : bits < 6 ? aup : ac);
}++offsetPbuf;
}
} else {
var rScaled = rgb16Left.r << 8;
var rIncrement = Clazz_doubleToInt(((rgb16Right.r - rgb16Left.r) << 8) / count);
var gScaled = rgb16Left.g;
var gIncrement = Clazz_doubleToInt((rgb16Right.g - gScaled) / count);
var bScaled = rgb16Left.b;
var bIncrement = Clazz_doubleToInt((rgb16Right.b - bScaled) / count);
while (--count >= 0) {
var zCurrent = this.line3d.getZCurrent(a, b, x++);
if (zCurrent >= slab && zCurrent <= depth && zCurrent < zb[offsetPbuf]) p.addPixel(offsetPbuf, zCurrent, 0xFF000000 | (rScaled & 0xFF0000) | (gScaled & 0xFF00) | ((bScaled >> 8) & 0xFF));
++offsetPbuf;
rScaled += rIncrement;
gScaled += gIncrement;
bScaled += bIncrement;
}
}}, "~N,~N,~N,~N,~N,JU.Rgb16,JU.Rgb16,~N,~N");
Clazz_defineMethod(c$, "plotPixelsUnclippedRasterBits", 
function(count, x, y, rgb16Left, rgb16Right, a, b){
if (count <= 0) return;
var seed = ((x << 16) + (y << 1) ^ 0x33333333) & 0x7FFFFFFF;
var offsetPbuf = y * this.width + x;
var zb = this.zbuf;
var p = this.pixel;
if (rgb16Left == null) {
var adn = this.argbNoisyDn;
var aup = this.argbNoisyUp;
var ac = this.argbCurrent;
while (--count >= 0) {
var zCurrent = this.line3d.getZCurrent(a, b, x++);
if (zCurrent < zb[offsetPbuf]) {
seed = ((seed << 16) + (seed << 1) + seed) & 0x7FFFFFFF;
var bits = (seed >> 16) & 0x07;
var c = (bits == 0 ? adn : bits == 1 ? aup : ac);
p.addPixel(offsetPbuf, zCurrent, c);
}++offsetPbuf;
}
} else {
var rScaled = rgb16Left.r << 8;
var rIncrement = JU.GData.roundInt(Clazz_doubleToInt(((rgb16Right.r - rgb16Left.r) << 8) / count));
var gScaled = rgb16Left.g;
var gIncrement = JU.GData.roundInt(Clazz_doubleToInt((rgb16Right.g - gScaled) / count));
var bScaled = rgb16Left.b;
var bIncrement = JU.GData.roundInt(Clazz_doubleToInt((rgb16Right.b - bScaled) / count));
while (--count >= 0) {
var zCurrent = this.line3d.getZCurrent(a, b, x++);
if (zCurrent < zb[offsetPbuf]) p.addPixel(offsetPbuf, zCurrent, 0xFF000000 | (rScaled & 0xFF0000) | (gScaled & 0xFF00) | ((bScaled >> 8) & 0xFF));
++offsetPbuf;
rScaled += rIncrement;
gScaled += gIncrement;
bScaled += bIncrement;
}
}}, "~N,~N,~N,JU.Rgb16,JU.Rgb16,~N,~N");
Clazz_defineMethod(c$, "plotPixelsUnclippedCount", 
function(c, count, x, y, z, width, zbuf, p){
var offsetPbuf = y * width + x;
while (--count >= 0) {
if (z < zbuf[offsetPbuf]) p.addPixel(offsetPbuf, z, c);
++offsetPbuf;
}
}, "~N,~N,~N,~N,~N,~N,~A,J.g3d.Pixelator");
Clazz_defineMethod(c$, "plotPoints", 
function(count, coordinates, xOffset, yOffset){
var p = this.pixel;
var c = this.argbCurrent;
var zb = this.zbuf;
var w = this.width;
var antialias = this.antialiasThisFrame;
for (var i = count * 3; i > 0; ) {
var z = coordinates[--i];
var y = coordinates[--i] + yOffset;
var x = coordinates[--i] + xOffset;
if (this.isClipped3(x, y, z)) continue;
var offset = y * w + x++;
if (z < zb[offset]) p.addPixel(offset, z, c);
if (antialias) {
offset = y * w + x;
if (!this.isClipped3(x, y, z) && z < zb[offset]) p.addPixel(offset, z, c);
offset = (++y) * w + x;
if (!this.isClipped3(x, y, z) && z < zb[offset]) p.addPixel(offset, z, c);
offset = y * w + (--x);
if (!this.isClipped3(x, y, z) && z < zb[offset]) p.addPixel(offset, z, c);
}}
}, "~N,~A,~N,~N");
Clazz_defineMethod(c$, "setColorNoisy", 
function(shadeIndex){
this.currentShadeIndex = shadeIndex;
this.argbCurrent = this.shadesCurrent[shadeIndex];
this.argbNoisyUp = this.shadesCurrent[shadeIndex < 63 ? shadeIndex + 1 : 63];
this.argbNoisyDn = this.shadesCurrent[shadeIndex > 0 ? shadeIndex - 1 : 0];
}, "~N");
Clazz_defineMethod(c$, "getShadeIndexP3", 
function(screenA, screenB, screenC, isSolid){
this.vectorAB.sub2(screenB, screenA);
this.vectorAC.sub2(screenC, screenA);
var v = this.vectorNormal;
v.cross(this.vectorAB, this.vectorAC);
var i = (v.z < 0 ? this.shader.getShadeIndex(v.x, v.y, -v.z) : isSolid ? -1 : this.shader.getShadeIndex(-v.x, -v.y, v.z));
return i;
}, "JU.P3,JU.P3,JU.P3,~B");
Clazz_overrideMethod(c$, "renderBackground", 
function(jmolRenderer){
if (this.backgroundImage != null) this.plotImage(-2147483648, 0, -2147483648, this.backgroundImage, jmolRenderer, 0, 0, 0);
}, "J.api.JmolRendererInterface");
Clazz_overrideMethod(c$, "drawAtom", 
function(atom, radius){
this.fillSphereXYZ(atom.sD, atom.sX, atom.sY, atom.sZ);
}, "JM.Atom,~N");
Clazz_overrideMethod(c$, "getExportType", 
function(){
return 0;
});
Clazz_overrideMethod(c$, "getExportName", 
function(){
return null;
});
Clazz_defineMethod(c$, "canDoTriangles", 
function(){
return true;
});
Clazz_defineMethod(c$, "isCartesianExport", 
function(){
return false;
});
Clazz_overrideMethod(c$, "initializeExporter", 
function(vwr, privateKey, g3d, params){
return null;
}, "JV.Viewer,~N,JU.GData,java.util.Map");
Clazz_overrideMethod(c$, "finalizeOutput", 
function(){
return null;
});
Clazz_overrideMethod(c$, "drawBond", 
function(atomA, atomB, colixA, colixB, endcaps, mad, bondOrder){
}, "JU.P3,JU.P3,~N,~N,~N,~N,~N");
Clazz_overrideMethod(c$, "drawEllipse", 
function(ptAtom, ptX, ptY, fillArc, wireframeOnly){
return false;
}, "JU.P3,JU.P3,JU.P3,~B,~B");
Clazz_defineMethod(c$, "getPrivateKey", 
function(){
return 0;
});
Clazz_overrideMethod(c$, "clearFontCache", 
function(){
J.g3d.TextRenderer.clearFontCache();
});
Clazz_defineMethod(c$, "setRotationMatrix", 
function(rotationMatrix){
var vertexVectors = JU.Normix.getVertexVectors();
for (var i = JU.GData.normixCount; --i >= 0; ) {
var tv = this.transformedVectors[i];
rotationMatrix.rotate2(vertexVectors[i], tv);
this.shadeIndexes[i] = this.shader.getShadeB(tv.x, -tv.y, tv.z);
this.shadeIndexes2Sided[i] = (tv.z >= 0 ? this.shadeIndexes[i] : this.shader.getShadeB(-tv.x, tv.y, -tv.z));
}
}, "JU.M3");
Clazz_overrideMethod(c$, "renderCrossHairs", 
function(minMax, screenWidth, screenHeight, navOffset, navDepth){
var antialiased = this.isAntialiased();
this.setC(navDepth < 0 ? 10 : navDepth > 100 ? 11 : 23);
var x = Math.max(Math.min(this.width, Math.round(navOffset.x)), 0);
var y = Math.max(Math.min(this.height, Math.round(navOffset.y)), 0);
var z = Math.round(navOffset.z) + 1;
var off = (antialiased ? 8 : 4);
var h = (antialiased ? 20 : 10);
var w = (antialiased ? 2 : 1);
this.drawRect(x - off, y, z, 0, h, w);
this.drawRect(x, y - off, z, 0, w, h);
this.drawRect(x - off, y - off, z, 0, h, h);
off = h;
h = h >> 1;
this.setC(minMax[1] < navOffset.x ? 21 : 11);
this.drawRect(x - off, y, z, 0, h, w);
this.setC(minMax[0] > navOffset.x ? 21 : 11);
this.drawRect(x + h, y, z, 0, h, w);
this.setC(minMax[3] < navOffset.y ? 21 : 11);
this.drawRect(x, y - off, z, 0, w, h);
this.setC(minMax[2] > navOffset.y ? 21 : 11);
this.drawRect(x, y + h, z, 0, w, h);
}, "~A,~N,~N,JU.P3,~N");
Clazz_overrideMethod(c$, "initializeOutput", 
function(vwr, privateKey, params){
return false;
}, "JV.Viewer,~N,java.util.Map");
c$.fixTextImageRGB = Clazz_defineMethod(c$, "fixTextImageRGB", 
function(argb){
return ((argb & 0xC0C0C0) == 0 ? argb | 0x040404 : argb);
}, "~N");
c$.sort = null;
c$.nullShadeIndex = 50;
});
;//5.0.1-v7 Mon Aug 24 10:01:38 CDT 2026
Clazz_declarePackage("J.g3d");
Clazz_load(["J.g3d.PrecisionRenderer", "java.util.Hashtable", "JU.BS"], "J.g3d.LineRenderer", null, function(){
var c$ = Clazz_decorateAsClass(function(){
this.g3d = null;
this.shader = null;
this.lineBits = null;
this.lineTypeX = false;
this.nBits = 0;
this.lineCache = null;
this.x1t = 0;
this.y1t = 0;
this.z1t = 0;
this.x2t = 0;
this.y2t = 0;
this.z2t = 0;
Clazz_instantialize(this, arguments);}, J.g3d, "LineRenderer", J.g3d.PrecisionRenderer);
Clazz_prepareFields (c$, function(){
this.lineBits =  new JU.BS();
this.lineCache =  new java.util.Hashtable();
});
Clazz_makeConstructor(c$, 
function(g3d){
Clazz_superConstructor (this, J.g3d.LineRenderer, []);
this.g3d = g3d;
this.shader = g3d.shader;
}, "J.g3d.Graphics3D");
Clazz_defineMethod(c$, "setLineBits", 
function(dx, dy){
var adx = Math.abs(dx);
var ady = Math.abs(dy);
var slope;
if (adx < 1 && ady < 0) {
this.lineBits = J.g3d.LineRenderer.lbNone;
return;
}if (adx == 0) {
slope = (dy >= 0 ? 3.4028235E38 : -3.4028235E38);
} else {
slope = (dy / dx);
if (slope > 1e5) slope = 3.4028235E38;
 else if (slope < -100000.0) slope = -3.4028235E38;
}this.lineTypeX = (slope <= 1 && slope >= -1);
this.nBits = (this.lineTypeX ? this.g3d.width : this.g3d.height);
var slopeKey = Integer.$valueOf(Math.round(slope * 10000));
var lb = this.lineCache.get(slopeKey);
if (lb == null) {
if (this.lineCache.size() > 10000) {
this.lineCache.clear();
}lb = JU.BS.newN(this.nBits);
if (ady > adx) {
var t = adx;
adx = ady;
ady = t;
}var twoDError = 0;
var twoDx = adx + adx;
var twoDy = ady + ady;
for (var i = 0; i < this.nBits; i++) {
twoDError += twoDy;
if (twoDError > adx) {
lb.set(i);
twoDError -= twoDx;
}}
this.lineCache.put(slopeKey, lb);
}this.lineBits = lb;
}, "~N,~N");
Clazz_defineMethod(c$, "clearLineCache", 
function(){
this.lineCache.clear();
});
Clazz_defineMethod(c$, "plotLineInt", 
function(argbA, argbB, xA, yA, zA, xB, yB, zB){
this.x1t = xA;
this.x2t = xB;
this.y1t = yA;
this.y2t = yB;
this.z1t = zA;
this.z2t = zB;
var clipped = true;
switch (this.getTrimmedLineImpl()) {
case 0:
clipped = false;
break;
case 2:
return;
}
this.plotLineClippedOld(argbA, argbB, xA, yA, zA, xB - xA, yB - yA, zB - zA, clipped, 0, 0);
}, "~N,~N,~N,~N,~N,~N,~N,~N");
Clazz_defineMethod(c$, "plotLineDeltaOld", 
function(argbA, argbB, xA, yA, zA, dxBA, dyBA, dzBA, clipped){
this.x1t = xA;
this.x2t = xA + dxBA;
this.y1t = yA;
this.y2t = yA + dyBA;
this.z1t = zA;
this.z2t = zA + dzBA;
if (clipped) switch (this.getTrimmedLineImpl()) {
case 2:
return;
case 0:
clipped = false;
break;
}
this.plotLineClippedOld(argbA, argbB, xA, yA, zA, dxBA, dyBA, dzBA, clipped, 0, 0);
}, "~N,~N,~N,~N,~N,~N,~N,~N,~B");
Clazz_defineMethod(c$, "plotLineDeltaAOld", 
function(shades1, shades2, screenMask, shadeIndex, x, y, z, dx, dy, dz, clipped){
this.x1t = x;
this.x2t = x + dx;
this.y1t = y;
this.y2t = y + dy;
this.z1t = z;
this.z2t = z + dz;
if (clipped) switch (this.getTrimmedLineImpl()) {
case 2:
return;
case 0:
clipped = false;
}
var zbuf = this.g3d.zbuf;
var width = this.g3d.width;
var runIndex = 0;
var rise = 2147483647;
var run = 1;
var offset = y * width + x;
var offsetMax = this.g3d.bufferSize;
var shadeIndexUp = (shadeIndex < 63 ? shadeIndex + 1 : shadeIndex);
var shadeIndexDn = (shadeIndex > 0 ? shadeIndex - 1 : shadeIndex);
var argb1 = shades1[shadeIndex];
var argb1Up = shades1[shadeIndexUp];
var argb1Dn = shades1[shadeIndexDn];
var argb2 = shades2[shadeIndex];
var argb2Up = shades2[shadeIndexUp];
var argb2Dn = shades2[shadeIndexDn];
var argb = argb1;
var p = this.g3d.pixel;
if (screenMask != 0) {
p = this.g3d.setScreened((screenMask & 1) == 1);
this.g3d.currentShadeIndex = 0;
}if (argb != 0 && !clipped && offset >= 0 && offset < offsetMax && z < zbuf[offset]) p.addPixel(offset, z, argb);
if (dx == 0 && dy == 0) return;
var xIncrement = 1;
var yOffsetIncrement = width;
var x2 = x + dx;
var y2 = y + dy;
if (dx < 0) {
dx = -dx;
xIncrement = -1;
}if (dy < 0) {
dy = -dy;
yOffsetIncrement = -width;
}var twoDx = dx + dx;
var twoDy = dy + dy;
var zCurrentScaled = z << 10;
var argbUp = argb1Up;
var argbDn = argb1Dn;
if (dy <= dx) {
var roundingFactor = dx - 1;
if (dz < 0) roundingFactor = -roundingFactor;
var zIncrementScaled = Clazz_doubleToInt(((dz << 10) + roundingFactor) / dx);
var twoDxAccumulatedYError = 0;
var n1 = Math.abs(x2 - this.x2t) - 1;
var n2 = Math.abs(x2 - this.x1t) - 1;
for (var n = dx - 1, nMid = Clazz_doubleToInt(n / 2); --n >= n1; ) {
if (n == nMid) {
argb = argb2;
if (argb == 0) return;
argbUp = argb2Up;
argbDn = argb2Dn;
if (screenMask % 3 != 0) {
p = this.g3d.setScreened((screenMask & 2) == 2);
this.g3d.currentShadeIndex = 0;
}}offset += xIncrement;
zCurrentScaled += zIncrementScaled;
twoDxAccumulatedYError += twoDy;
if (twoDxAccumulatedYError > dx) {
offset += yOffsetIncrement;
twoDxAccumulatedYError -= twoDx;
}if (argb != 0 && n < n2 && offset >= 0 && offset < offsetMax && runIndex < rise) {
var zCurrent = zCurrentScaled >> 10;
if (zCurrent < zbuf[offset]) {
var rand8 = this.shader.nextRandom8Bit();
p.addPixel(offset, zCurrent, rand8 < 85 ? argbDn : (rand8 > 170 ? argbUp : argb));
}}runIndex = (runIndex + 1) % run;
}
} else {
var roundingFactor = dy - 1;
if (dz < 0) roundingFactor = -roundingFactor;
var zIncrementScaled = Clazz_doubleToInt(((dz << 10) + roundingFactor) / dy);
var twoDyAccumulatedXError = 0;
var n1 = Math.abs(y2 - this.y2t) - 1;
var n2 = Math.abs(y2 - this.y1t) - 1;
for (var n = dy - 1, nMid = Clazz_doubleToInt(n / 2); --n >= n1; ) {
if (n == nMid) {
argb = argb2;
if (argb == 0) return;
argbUp = argb2Up;
argbDn = argb2Dn;
if (screenMask % 3 != 0) {
p = this.g3d.setScreened((screenMask & 2) == 2);
this.g3d.currentShadeIndex = 0;
}}offset += yOffsetIncrement;
zCurrentScaled += zIncrementScaled;
twoDyAccumulatedXError += twoDx;
if (twoDyAccumulatedXError > dy) {
offset += xIncrement;
twoDyAccumulatedXError -= twoDy;
}if (argb != 0 && n < n2 && offset >= 0 && offset < offsetMax && runIndex < rise) {
var zCurrent = zCurrentScaled >> 10;
if (zCurrent < zbuf[offset]) {
var rand8 = this.g3d.shader.nextRandom8Bit();
p.addPixel(offset, zCurrent, rand8 < 85 ? argbDn : (rand8 > 170 ? argbUp : argb));
}}runIndex = (runIndex + 1) % run;
}
}}, "~A,~A,~N,~N,~N,~N,~N,~N,~N,~N,~B");
Clazz_defineMethod(c$, "plotLineDeltaABitsFloat", 
function(shades1, shades2, shadeIndex, ptA, ptB, screenMask, clipped){
var x = Math.round(ptA.x);
var y = Math.round(ptA.y);
var z = Math.round(ptA.z);
var bx = Math.round(ptB.x);
var by = Math.round(ptB.y);
var bz = Math.round(ptB.z);
var dx = bx - x;
var dy = by - y;
this.x1t = x;
this.x2t = bx;
this.y1t = y;
this.y2t = by;
this.z1t = z;
this.z2t = bz;
if (clipped && this.getTrimmedLineImpl() == 2) return;
var zbuf = this.g3d.zbuf;
var width = this.g3d.width;
var runIndex = 0;
var rise = 2147483647;
var run = 1;
var shadeIndexUp = (shadeIndex < 63 ? shadeIndex + 1 : shadeIndex);
var shadeIndexDn = (shadeIndex > 0 ? shadeIndex - 1 : shadeIndex);
var argb1 = shades1[shadeIndex];
var argb1Up = shades1[shadeIndexUp];
var argb1Dn = shades1[shadeIndexDn];
var argb2 = shades2[shadeIndex];
var argb2Up = shades2[shadeIndexUp];
var argb2Dn = shades2[shadeIndexDn];
var offset = y * width + x;
var offsetMax = this.g3d.bufferSize;
var i0;
var iMid;
var i1;
var i2;
var iIncrement;
var xIncrement;
var yOffsetIncrement;
if (this.lineTypeX) {
i0 = x;
i1 = this.x1t;
i2 = this.x2t;
iMid = x + Clazz_doubleToInt(dx / 2);
iIncrement = (dx >= 0 ? 1 : -1);
xIncrement = iIncrement;
yOffsetIncrement = (dy >= 0 ? width : -width);
this.setRastABFloat(ptA.x, ptA.z, ptB.x, ptB.z);
} else {
i0 = y;
i1 = this.y1t;
i2 = this.y2t;
iMid = y + Clazz_doubleToInt(dy / 2);
iIncrement = (dy >= 0 ? 1 : -1);
xIncrement = (dy >= 0 ? width : -width);
yOffsetIncrement = (dx >= 0 ? 1 : -1);
this.setRastABFloat(ptA.y, ptA.z, ptB.y, ptB.z);
}var zCurrent = z;
var argb = argb1;
var argbUp = argb1Up;
var argbDn = argb1Dn;
var isInWindow = false;
var p = this.g3d.pixel;
if (screenMask != 0) {
p = this.g3d.setScreened((screenMask & 1) == 1);
this.g3d.currentShadeIndex = 0;
}for (var i = i0, iBits = i0; ; i += iIncrement, iBits += iIncrement) {
if (i == i1) isInWindow = true;
if (i == iMid) {
argb = argb2;
if (argb == 0) return;
argbUp = argb2Up;
argbDn = argb2Dn;
if (screenMask % 3 != 0) {
p = this.g3d.setScreened((screenMask & 2) == 2);
this.g3d.currentShadeIndex = 0;
}}if (argb != 0 && isInWindow && offset >= 0 && offset < offsetMax && runIndex < rise) {
zCurrent = this.getZCurrent(this.a, this.b, i);
if (zCurrent < zbuf[offset]) {
var rand8 = this.shader.nextRandom8Bit();
p.addPixel(offset, Clazz_floatToInt(zCurrent), rand8 < 85 ? argbDn : (rand8 > 170 ? argbUp : argb));
}}if (i == i2) break;
runIndex = (runIndex + 1) % run;
offset += xIncrement;
while (iBits < 0) iBits += this.nBits;

if (this.lineBits.get(iBits % this.nBits)) {
offset += yOffsetIncrement;
}}
}, "~A,~A,~N,JU.P3,JU.P3,~N,~B");
Clazz_defineMethod(c$, "plotLineDeltaABitsInt", 
function(shades1, shades2, shadeIndex, ptA, ptB, screenMask, clipped){
var x = ptA.x;
var y = ptA.y;
var z = ptA.z;
var bx = ptB.x;
var by = ptB.y;
var bz = ptB.z;
var dx = bx - x;
var dy = by - y;
this.x1t = x;
this.x2t = bx;
this.y1t = y;
this.y2t = by;
this.z1t = z;
this.z2t = bz;
if (clipped && this.getTrimmedLineImpl() == 2) return;
var zbuf = this.g3d.zbuf;
var width = this.g3d.width;
var runIndex = 0;
var rise = 2147483647;
var run = 1;
var shadeIndexUp = (shadeIndex < 63 ? shadeIndex + 1 : shadeIndex);
var shadeIndexDn = (shadeIndex > 0 ? shadeIndex - 1 : shadeIndex);
var argb1 = shades1[shadeIndex];
var argb1Up = shades1[shadeIndexUp];
var argb1Dn = shades1[shadeIndexDn];
var argb2 = shades2[shadeIndex];
var argb2Up = shades2[shadeIndexUp];
var argb2Dn = shades2[shadeIndexDn];
var offset = y * width + x;
var offsetMax = this.g3d.bufferSize;
var i0;
var iMid;
var i1;
var i2;
var iIncrement;
var xIncrement;
var yOffsetIncrement;
if (this.lineTypeX) {
i0 = x;
i1 = this.x1t;
i2 = this.x2t;
iMid = x + Clazz_doubleToInt(dx / 2);
iIncrement = (dx >= 0 ? 1 : -1);
xIncrement = iIncrement;
yOffsetIncrement = (dy >= 0 ? width : -width);
this.setRastAB(ptA.x, ptA.z, ptB.x, ptB.z);
} else {
i0 = y;
i1 = this.y1t;
i2 = this.y2t;
iMid = y + Clazz_doubleToInt(dy / 2);
iIncrement = (dy >= 0 ? 1 : -1);
xIncrement = (dy >= 0 ? width : -width);
yOffsetIncrement = (dx >= 0 ? 1 : -1);
this.setRastAB(ptA.y, ptA.z, ptB.y, ptB.z);
}var zCurrent = z;
var argb = argb1;
var argbUp = argb1Up;
var argbDn = argb1Dn;
var isInWindow = false;
var p = this.g3d.pixel;
if (screenMask != 0) {
p = this.g3d.setScreened((screenMask & 1) == 1);
this.g3d.currentShadeIndex = 0;
}for (var i = i0, iBits = i0; ; i += iIncrement, iBits += iIncrement) {
if (i == i1) isInWindow = true;
if (i == iMid) {
argb = argb2;
if (argb == 0) return;
argbUp = argb2Up;
argbDn = argb2Dn;
if (screenMask % 3 != 0) {
p = this.g3d.setScreened((screenMask & 2) == 2);
this.g3d.currentShadeIndex = 0;
}}if (argb != 0 && isInWindow && offset >= 0 && offset < offsetMax && runIndex < rise) {
zCurrent = this.getZCurrent(this.a, this.b, i);
if (zCurrent < zbuf[offset]) {
var rand8 = this.shader.nextRandom8Bit();
p.addPixel(offset, Clazz_floatToInt(zCurrent), rand8 < 85 ? argbDn : (rand8 > 170 ? argbUp : argb));
}}if (i == i2) break;
runIndex = (runIndex + 1) % run;
offset += xIncrement;
while (iBits < 0) iBits += this.nBits;

if (this.lineBits.get(iBits % this.nBits)) {
offset += yOffsetIncrement;
}}
}, "~A,~A,~N,JU.P3i,JU.P3i,~N,~B");
Clazz_defineMethod(c$, "plotLineBits", 
function(argbA, argbB, ptA, ptB, run, rise, andClip){
if (ptA.z <= 1 || ptB.z <= 1) return;
var clipped = true;
this.x1t = ptA.x;
this.y1t = ptA.y;
this.z1t = ptA.z;
this.x2t = ptB.x;
this.y2t = ptB.y;
this.z2t = ptB.z;
switch (this.getTrimmedLineImpl()) {
case 2:
return;
case 0:
clipped = false;
break;
default:
if (andClip) {
ptA.set(this.x1t, this.y1t, this.z1t);
ptB.set(this.x2t, this.y2t, this.z2t);
}}
var zbuf = this.g3d.zbuf;
var width = this.g3d.width;
var runIndex = 0;
if (run == 0) {
rise = 2147483647;
run = 1;
}var x = ptA.x;
var y = ptA.y;
var z = ptA.z;
var dx = ptB.x - x;
var x2 = x + dx;
var dy = ptB.y - y;
var y2 = y + dy;
var offset = y * width + x;
var offsetMax = this.g3d.bufferSize;
var argb = argbA;
var p = this.g3d.pixel;
if (argb != 0 && !clipped && offset >= 0 && offset < offsetMax && z < zbuf[offset]) p.addPixel(offset, z, argb);
if (dx == 0 && dy == 0) return;
var xIncrement = 1;
var yIncrement = 1;
var yOffsetIncrement = width;
if (dx < 0) {
dx = -dx;
xIncrement = -1;
}if (dy < 0) {
dy = -dy;
yOffsetIncrement = -width;
yIncrement = -1;
}var twoDx = dx + dx;
var twoDy = dy + dy;
if (dy <= dx) {
this.setRastAB(ptA.x, ptA.z, ptB.x, ptB.z);
var twoDxAccumulatedYError = 0;
var n1 = Math.abs(x2 - this.x2t) - 1;
var n2 = Math.abs(x2 - this.x1t) - 1;
for (var n = dx - 1, nMid = Clazz_doubleToInt(n / 2); --n >= n1; ) {
if (n == nMid) {
argb = argbB;
if (argb == 0) return;
}offset += xIncrement;
x += xIncrement;
twoDxAccumulatedYError += twoDy;
if (twoDxAccumulatedYError > dx) {
offset += yOffsetIncrement;
twoDxAccumulatedYError -= twoDx;
}if (argb != 0 && n < n2 && offset >= 0 && offset < offsetMax && runIndex < rise) {
var zCurrent = this.getZCurrent(this.a, this.b, x);
if (zCurrent < zbuf[offset]) p.addPixel(offset, zCurrent, argb);
}runIndex = (runIndex + 1) % run;
}
} else {
this.setRastAB(ptA.y, ptA.z, ptB.y, ptB.z);
var twoDyAccumulatedXError = 0;
var n1 = Math.abs(y2 - this.y2t) - 1;
var n2 = Math.abs(y2 - this.y1t) - 1;
for (var n = dy - 1, nMid = Clazz_doubleToInt(n / 2); --n >= n1; ) {
if (n == nMid) {
argb = argbB;
if (argb == 0) return;
}offset += yOffsetIncrement;
y += yIncrement;
twoDyAccumulatedXError += twoDx;
if (twoDyAccumulatedXError > dy) {
offset += xIncrement;
twoDyAccumulatedXError -= twoDy;
}if (argb != 0 && n < n2 && offset >= 0 && offset < offsetMax && runIndex < rise) {
var zCurrent = this.getZCurrent(this.a, this.b, y);
if (zCurrent < zbuf[offset]) p.addPixel(offset, zCurrent, argb);
}runIndex = (runIndex + 1) % run;
}
}}, "~N,~N,JU.P3i,JU.P3i,~N,~N,~B");
Clazz_defineMethod(c$, "getTrimmedLineImpl", 
function(){
var cc1 = this.g3d.clipCode3(this.x1t, this.y1t, this.z1t);
var cc2 = this.g3d.clipCode3(this.x2t, this.y2t, this.z2t);
var c = (cc1 | cc2);
if ((cc1 | cc2) == 0) return 0;
if (c == -1) return 2;
var xLast = this.g3d.xLast;
var yLast = this.g3d.yLast;
var slab = this.g3d.slab;
var depth = this.g3d.depth;
do {
if ((cc1 & cc2) != 0) return 2;
var dx = this.x2t - this.x1t;
var dy = this.y2t - this.y1t;
var dz = this.z2t - this.z1t;
if (cc1 != 0) {
if ((cc1 & 8) != 0) {
this.y1t += Clazz_floatToInt((-this.x1t * dy) / dx);
this.z1t += Clazz_floatToInt((-this.x1t * dz) / dx);
this.x1t = 0;
} else if ((cc1 & 4) != 0) {
this.y1t += Clazz_floatToInt(((xLast - this.x1t) * dy) / dx);
this.z1t += Clazz_floatToInt(((xLast - this.x1t) * dz) / dx);
this.x1t = xLast;
} else if ((cc1 & 2) != 0) {
this.x1t += Clazz_floatToInt((-this.y1t * dx) / dy);
this.z1t += Clazz_floatToInt((-this.y1t * dz) / dy);
this.y1t = 0;
} else if ((cc1 & 1) != 0) {
this.x1t += Clazz_floatToInt(((yLast - this.y1t) * dx) / dy);
this.z1t += Clazz_floatToInt(((yLast - this.y1t) * dz) / dy);
this.y1t = yLast;
} else if ((cc1 & 32) != 0) {
this.x1t += Clazz_floatToInt(((slab - this.z1t) * dx) / dz);
this.y1t += Clazz_floatToInt(((slab - this.z1t) * dy) / dz);
this.z1t = slab;
} else {
this.x1t += Clazz_floatToInt(((depth - this.z1t) * dx) / dz);
this.y1t += Clazz_floatToInt(((depth - this.z1t) * dy) / dz);
this.z1t = depth;
}cc1 = this.g3d.clipCode3(this.x1t, this.y1t, this.z1t);
} else {
if ((cc2 & 8) != 0) {
this.y2t += Clazz_floatToInt((-this.x2t * dy) / dx);
this.z2t += Clazz_floatToInt((-this.x2t * dz) / dx);
this.x2t = 0;
} else if ((cc2 & 4) != 0) {
this.y2t += Clazz_floatToInt(((xLast - this.x2t) * dy) / dx);
this.z2t += Clazz_floatToInt(((xLast - this.x2t) * dz) / dx);
this.x2t = xLast;
} else if ((cc2 & 2) != 0) {
this.x2t += Clazz_floatToInt((-this.y2t * dx) / dy);
this.z2t += Clazz_floatToInt((-this.y2t * dz) / dy);
this.y2t = 0;
} else if ((cc2 & 1) != 0) {
this.x2t += Clazz_floatToInt(((yLast - this.y2t) * dx) / dy);
this.z2t += Clazz_floatToInt(((yLast - this.y2t) * dz) / dy);
this.y2t = yLast;
} else if ((cc2 & 32) != 0) {
this.x2t += Clazz_floatToInt(((slab - this.z2t) * dx) / dz);
this.y2t += Clazz_floatToInt(((slab - this.z2t) * dy) / dz);
this.z2t = slab;
} else {
this.x2t += Clazz_floatToInt(((depth - this.z2t) * dx) / dz);
this.y2t += Clazz_floatToInt(((depth - this.z2t) * dy) / dz);
this.z2t = depth;
}cc2 = this.g3d.clipCode3(this.x2t, this.y2t, this.z2t);
}} while ((cc1 | cc2) != 0);
return 1;
});
Clazz_defineMethod(c$, "plotLineClippedOld", 
function(argb1, argb2, x, y, z, dx, dy, dz, clipped, run, rise){
var zbuf = this.g3d.zbuf;
var width = this.g3d.width;
var runIndex = 0;
if (run == 0) {
rise = 2147483647;
run = 1;
}var offset = y * width + x;
var offsetMax = this.g3d.bufferSize;
var argb = argb1;
var p = this.g3d.pixel;
if (argb != 0 && !clipped && offset >= 0 && offset < offsetMax && z < zbuf[offset]) p.addPixel(offset, z, argb);
if (dx == 0 && dy == 0) return;
var xIncrement = 1;
var yOffsetIncrement = width;
var x2 = x + dx;
var y2 = y + dy;
if (dx < 0) {
dx = -dx;
xIncrement = -1;
}if (dy < 0) {
dy = -dy;
yOffsetIncrement = -width;
}var twoDx = dx + dx;
var twoDy = dy + dy;
var zCurrentScaled = z << 10;
if (dy <= dx) {
var roundingFactor = dx - 1;
if (dz < 0) roundingFactor = -roundingFactor;
var zIncrementScaled = Clazz_doubleToInt(((dz << 10) + roundingFactor) / dx);
var twoDxAccumulatedYError = 0;
var n1 = Math.abs(x2 - this.x2t) - 1;
var n2 = Math.abs(x2 - this.x1t) - 1;
for (var n = dx - 1, nMid = Clazz_doubleToInt(n / 2); --n >= n1; ) {
if (n == nMid) {
argb = argb2;
if (argb == 0) return;
}offset += xIncrement;
zCurrentScaled += zIncrementScaled;
twoDxAccumulatedYError += twoDy;
if (twoDxAccumulatedYError > dx) {
offset += yOffsetIncrement;
twoDxAccumulatedYError -= twoDx;
}if (argb != 0 && n < n2 && offset >= 0 && offset < offsetMax && runIndex < rise) {
var zCurrent = zCurrentScaled >> 10;
if (zCurrent < zbuf[offset]) p.addPixel(offset, zCurrent, argb);
}runIndex = (runIndex + 1) % run;
}
} else {
var roundingFactor = dy - 1;
if (dz < 0) roundingFactor = -roundingFactor;
var zIncrementScaled = Clazz_doubleToInt(((dz << 10) + roundingFactor) / dy);
var twoDyAccumulatedXError = 0;
var n1 = Math.abs(y2 - this.y2t) - 1;
var n2 = Math.abs(y2 - this.y1t) - 1;
for (var n = dy - 1, nMid = Clazz_doubleToInt(n / 2); --n >= n1; ) {
if (n == nMid) {
argb = argb2;
if (argb == 0) return;
}offset += yOffsetIncrement;
zCurrentScaled += zIncrementScaled;
twoDyAccumulatedXError += twoDx;
if (twoDyAccumulatedXError > dy) {
offset += xIncrement;
twoDyAccumulatedXError -= twoDy;
}if (argb != 0 && n < n2 && offset >= 0 && offset < offsetMax && runIndex < rise) {
var zCurrent = zCurrentScaled >> 10;
if (zCurrent < zbuf[offset]) p.addPixel(offset, zCurrent, argb);
}runIndex = (runIndex + 1) % run;
}
}}, "~N,~N,~N,~N,~N,~N,~N,~N,~B,~N,~N");
c$.lbNone =  new JU.BS();
});
;//5.0.1-v7 Mon Aug 17 10:07:10 MDT 2026
Clazz_declarePackage("J.g3d");
Clazz_load(null, "J.g3d.Pixelator", ["J.g3d.Graphics3D"], function(){
var c$ = Clazz_decorateAsClass(function(){
this.g = null;
this.p0 = null;
this.zb = null;
this.pb = null;
this.width = 0;
this.bgcolor = 0;
Clazz_instantialize(this, arguments);}, J.g3d, "Pixelator", null);
Clazz_makeConstructor(c$, 
function(graphics3d){
this.g = graphics3d;
this.bgcolor = this.g.bgcolor;
this.setBuf();
}, "J.g3d.Graphics3D");
Clazz_defineMethod(c$, "setBuf", 
function(){
this.zb = this.g.zbuf;
this.pb = this.g.pbuf;
});
Clazz_defineMethod(c$, "clearPixel", 
function(offset, z){
if (this.zb[offset] > z) this.zb[offset] = 2147483647;
}, "~N,~N");
Clazz_defineMethod(c$, "addPixel", 
function(offset, z, p){
this.zb[offset] = z;
this.pb[offset] = p;
}, "~N,~N,~N");
Clazz_defineMethod(c$, "addImagePixel", 
function(shade, tLog, offset, z, argb, bgargb){
if (z < this.zb[offset]) {
switch (shade) {
case 0:
return;
case 8:
this.addPixel(offset, z, argb);
return;
default:
shade += tLog;
if (shade <= 7) {
var p = this.pb[offset];
if (bgargb != 0) p = J.g3d.Graphics3D.mergeBufferPixel(p, bgargb, bgargb);
p = J.g3d.Graphics3D.mergeBufferPixel(p, (argb & 0xFFFFFF) | (shade << 24), this.bgcolor);
this.addPixel(offset, z, p);
}}
}}, "~N,~N,~N,~N,~N,~N");
});
;//5.0.1-v7 Mon Aug 17 10:07:10 MDT 2026
Clazz_declarePackage("J.g3d");
Clazz_load(["J.g3d.Pixelator"], "J.g3d.PixelatorT", ["J.g3d.Graphics3D"], function(){
var c$ = Clazz_declareType(J.g3d, "PixelatorT", J.g3d.Pixelator);
Clazz_overrideMethod(c$, "clearPixel", 
function(offset, z){
}, "~N,~N");
Clazz_overrideMethod(c$, "addPixel", 
function(offset, z, p){
var zT = this.g.zbufT[offset];
if (z < zT) {
var argb = this.g.pbufT[offset];
if (!this.g.translucentCoverOnly && argb != 0 && zT - z > this.g.zMargin) this.pb[offset] = J.g3d.Graphics3D.mergeBufferPixel(this.pb[offset], argb, this.g.bgcolor);
this.g.zbufT[offset] = z;
this.g.pbufT[offset] = p & this.g.translucencyMask;
} else if (z == zT) {
} else if (!this.g.translucentCoverOnly && z - zT > this.g.zMargin) {
this.pb[offset] = J.g3d.Graphics3D.mergeBufferPixel(this.pb[offset], p & this.g.translucencyMask, this.g.bgcolor);
}}, "~N,~N,~N");
});
;//5.0.1-v7 Mon Aug 17 10:07:10 MDT 2026
Clazz_declarePackage("J.g3d");
Clazz_load(["J.g3d.Pixelator"], "J.g3d.PixelatorShaded", null, function(){
var c$ = Clazz_decorateAsClass(function(){
this.bgRGB = null;
this.tmp = null;
this.zSlab = 0;
this.zDepth = 0;
this.zShadePower = 0;
Clazz_instantialize(this, arguments);}, J.g3d, "PixelatorShaded", J.g3d.Pixelator);
Clazz_makeConstructor(c$, 
function(g){
Clazz_superConstructor(this, J.g3d.PixelatorShaded, [g]);
this.tmp =  Clazz_newIntArray (3, 0);
}, "J.g3d.Graphics3D");
Clazz_defineMethod(c$, "set", 
function(zSlab, zDepth, zShadePower){
this.bgcolor = this.g.bgcolor;
this.bgRGB =  Clazz_newIntArray(-1, [this.bgcolor & 0xFF, (this.bgcolor >> 8) & 0xFF, (this.g.bgcolor >> 16) & 0xFF]);
this.zSlab = zSlab < 0 ? 0 : zSlab;
this.zDepth = zDepth < 0 ? 0 : zDepth;
this.zShadePower = zShadePower;
this.p0 = this.g.pixel0;
return this;
}, "~N,~N,~N");
Clazz_overrideMethod(c$, "addPixel", 
function(offset, z, p){
if (z > this.zDepth) return;
if (z >= this.zSlab && this.zShadePower > 0) {
var t = this.tmp;
var zs = this.bgRGB;
t[0] = p;
t[1] = p >> 8;
t[2] = p >> 16;
var f = (this.zDepth - z) / (this.zDepth - this.zSlab);
if (this.zShadePower > 1) for (var i = 0; i < this.zShadePower; i++) f *= f;

for (var i = 0; i < 3; i++) t[i] = zs[i] + Clazz_floatToInt(f * ((t[i] & 0xFF) - zs[i]));

p = (t[2] << 16) | (t[1] << 8) | t[0] | (p & 0xFF000000);
}this.p0.addPixel(offset, z, p);
}, "~N,~N,~N");
Clazz_defineMethod(c$, "showZBuffer", 
function(){
for (var i = this.p0.zb.length; --i >= 0; ) {
if (this.p0.pb[i] == 0) continue;
var z = Clazz_floatToInt(Math.min(255, Math.max(0, 255 * (this.zDepth - this.p0.zb[i]) / (this.zDepth - this.zSlab))));
this.p0.pb[i] = 0xFF000000 | z | (z << 8) | (z << 16);
}
});
});
;//5.0.1-v7 Mon Aug 17 10:07:10 MDT 2026
Clazz_declarePackage("J.g3d");
Clazz_load(["J.g3d.Pixelator"], "J.g3d.PixelatorScreened", null, function(){
var c$ = Clazz_declareType(J.g3d, "PixelatorScreened", J.g3d.Pixelator);
Clazz_makeConstructor(c$, 
function(g, p0){
Clazz_superConstructor(this, J.g3d.PixelatorScreened, [g]);
this.width = g.width;
this.p0 = p0;
}, "J.g3d.Graphics3D,J.g3d.Pixelator");
Clazz_overrideMethod(c$, "addPixel", 
function(offset, z, p){
if ((offset % this.width) % 2 == (Clazz_doubleToInt(offset / this.width)) % 2) this.p0.addPixel(offset, z, p);
}, "~N,~N,~N");
});
;//5.0.1-v7 Mon Aug 17 10:07:10 MDT 2026
Clazz_declarePackage("J.g3d");
(function(){
var c$ = Clazz_decorateAsClass(function(){
this.windowWidth = 0;
this.windowHeight = 0;
this.windowSize = 0;
this.bufferWidth = 0;
this.bufferHeight = 0;
this.bufferSize = 0;
this.bufferSizeT = 0;
this.bufferedImage = null;
this.pBuffer = null;
this.pBufferT = null;
this.zBuffer = null;
this.zBufferT = null;
this.widthOffscreen = 0;
this.heightOffscreen = 0;
this.offscreenImage = null;
this.graphicsForTextOrImage = null;
this.apiPlatform = null;
Clazz_instantialize(this, arguments);}, J.g3d, "Platform3D", null);
Clazz_makeConstructor(c$, 
function(apiPlatform){
this.apiPlatform = apiPlatform;
}, "J.api.GenericPlatform");
Clazz_defineMethod(c$, "getGraphicsForMetrics", 
function(){
return this.apiPlatform.getGraphics(this.allocateOffscreenImage(1, 1));
});
Clazz_defineMethod(c$, "allocateTBuffers", 
function(antialiasTranslucent){
this.bufferSizeT = (antialiasTranslucent ? this.bufferSize : this.windowSize);
this.zBufferT =  Clazz_newIntArray (this.bufferSizeT, 0);
this.pBufferT =  Clazz_newIntArray (this.bufferSizeT, 0);
}, "~B");
Clazz_defineMethod(c$, "allocateBuffers", 
function(width, height, antialias, isImageWrite){
this.windowWidth = width;
this.windowHeight = height;
this.windowSize = width * height;
if (antialias) {
width *= 2;
height *= 2;
}this.bufferWidth = width;
this.bufferHeight = height;
this.bufferSize = this.bufferWidth * this.bufferHeight;
this.zBuffer =  Clazz_newIntArray (this.bufferSize, 0);
this.pBuffer =  Clazz_newIntArray (this.bufferSize, 0);
this.bufferedImage = this.apiPlatform.allocateRgbImage(this.windowWidth, this.windowHeight, this.pBuffer, this.windowSize, J.g3d.Platform3D.backgroundTransparent, isImageWrite);
}, "~N,~N,~B,~B");
Clazz_defineMethod(c$, "releaseBuffers", 
function(){
this.windowWidth = this.windowHeight = this.bufferWidth = this.bufferHeight = this.bufferSize = -1;
if (this.bufferedImage != null) {
this.apiPlatform.flushImage(this.bufferedImage);
this.bufferedImage = null;
}this.pBuffer = null;
this.zBuffer = null;
this.pBufferT = null;
this.zBufferT = null;
});
Clazz_defineMethod(c$, "hasContent", 
function(){
for (var i = this.bufferSize; --i >= 0; ) if (this.zBuffer[i] != 2147483647) return true;

return false;
});
Clazz_defineMethod(c$, "clearScreenBuffer", 
function(){
for (var i = this.bufferSize; --i >= 0; ) {
this.zBuffer[i] = 2147483647;
this.pBuffer[i] = 0;
}
});
Clazz_defineMethod(c$, "setBackgroundColor", 
function(bgColor){
if (this.pBuffer == null) return;
for (var i = this.bufferSize; --i >= 0; ) if (this.pBuffer[i] == 0) this.pBuffer[i] = bgColor;

}, "~N");
Clazz_defineMethod(c$, "clearTBuffer", 
function(){
for (var i = this.bufferSizeT; --i >= 0; ) {
this.zBufferT[i] = 2147483647;
this.pBufferT[i] = 0;
}
});
Clazz_defineMethod(c$, "clearBuffer", 
function(){
this.clearScreenBuffer();
});
Clazz_defineMethod(c$, "clearScreenBufferThreaded", 
function(){
});
Clazz_defineMethod(c$, "notifyEndOfRendering", 
function(){
this.apiPlatform.notifyEndOfRendering();
});
Clazz_defineMethod(c$, "getGraphicsForTextOrImage", 
function(width, height){
if (width > this.widthOffscreen || height > this.heightOffscreen) {
if (this.offscreenImage != null) {
this.apiPlatform.disposeGraphics(this.graphicsForTextOrImage);
this.apiPlatform.flushImage(this.offscreenImage);
}if (width > this.widthOffscreen) this.widthOffscreen = width;
if (height > this.heightOffscreen) this.heightOffscreen = height;
this.offscreenImage = this.allocateOffscreenImage(this.widthOffscreen, this.heightOffscreen);
this.graphicsForTextOrImage = this.apiPlatform.getStaticGraphics(this.offscreenImage, J.g3d.Platform3D.backgroundTransparent);
}return this.graphicsForTextOrImage;
}, "~N,~N");
Clazz_defineMethod(c$, "allocateOffscreenImage", 
function(width, height){
return this.apiPlatform.newOffScreenImage(width, height);
}, "~N,~N");
Clazz_defineMethod(c$, "setBackgroundTransparent", 
function(tf){
J.g3d.Platform3D.backgroundTransparent = tf;
}, "~B");
c$.backgroundTransparent = false;
})();
;//5.0.1-v7 Mon Aug 17 10:07:10 MDT 2026
Clazz_declarePackage("J.g3d");
(function(){
var c$ = Clazz_decorateAsClass(function(){
this.a = 0;
this.b = 0;
this.isOrthographic = false;
Clazz_instantialize(this, arguments);}, J.g3d, "PrecisionRenderer", null);
Clazz_defineMethod(c$, "getZCurrent", 
function(a, b, x){
return Math.round(a == 1.4E-45 ? b : this.isOrthographic ? a * x + b : a / (b - x));
}, "~N,~N,~N");
Clazz_defineMethod(c$, "setRastABFloat", 
function(xa, za, xb, zb){
var zdif = (zb - za);
var xdif = (xb - xa);
if (zdif == 0 || xdif == 0) {
this.a = 1.4E-45;
this.b = za;
return;
}if (this.isOrthographic) {
this.a = zdif / xdif;
this.b = za - this.a * xa;
} else {
this.a = xdif * za * (zb / zdif);
this.b = (xb * zb - xa * za) / zdif;
}}, "~N,~N,~N,~N");
Clazz_defineMethod(c$, "setRastAB", 
function(xa, za, xb, zb){
var zdif = (zb - za);
var xdif = (xb - xa);
if (xa == 1.4E-45 || zdif == 0 || xdif == 0) {
this.a = 1.4E-45;
this.b = zb;
return;
}if (this.isOrthographic) {
this.a = zdif / xdif;
this.b = za - this.a * xa;
} else {
this.a = xdif * za * (zb / zdif);
this.b = (xb * zb - xa * za) / zdif;
}}, "~N,~N,~N,~N");
})();
;//5.0.1-v7 Mon Aug 17 10:07:10 MDT 2026
Clazz_declarePackage("J.g3d");
Clazz_load(["JU.P3"], "J.g3d.SphereRenderer", null, function(){
var c$ = Clazz_decorateAsClass(function(){
this.g3d = null;
this.shader = null;
this.zroot = null;
this.mat = null;
this.coef = null;
this.mDeriv = null;
this.selectedOctant = 0;
this.planeShade = 0;
this.zbuf = null;
this.width = 0;
this.height = 0;
this.depth = 0;
this.slab = 0;
this.offsetPbufBeginLine = 0;
this.ptTemp = null;
this.planeShades = null;
this.dxyz = null;
Clazz_instantialize(this, arguments);}, J.g3d, "SphereRenderer", null);
Clazz_prepareFields (c$, function(){
this.zroot =  Clazz_newDoubleArray (2, 0);
this.ptTemp =  new JU.P3();
this.planeShades =  Clazz_newIntArray (3, 0);
this.dxyz =  Clazz_newFloatArray (3, 3, 0);
});
Clazz_makeConstructor(c$, 
function(g3d){
this.g3d = g3d;
this.shader = g3d.shader;
}, "J.g3d.Graphics3D");
Clazz_defineMethod(c$, "render", 
function(shades, diameter, x, y, z, mat, coef, mDeriv, selectedOctant, octantPoints){
if (z == 1) return;
if (diameter > 49) diameter &= -2;
if (this.g3d.isClippedXY(diameter, x, y)) return;
this.slab = this.g3d.slab;
this.depth = this.g3d.depth;
var radius = (diameter + 1) >> 1;
var minZ = z - radius;
if (z + radius < this.slab || minZ > this.depth) return;
var minX = x - radius;
var maxX = x + radius;
var minY = y - radius;
var maxY = y + radius;
this.shader.nOut = this.shader.nIn = 0;
this.zbuf = this.g3d.zbuf;
this.height = this.g3d.height;
this.width = this.g3d.width;
this.offsetPbufBeginLine = this.width * y + x;
var sh = this.shader;
this.mat = mat;
if (mat != null) {
this.coef = coef;
this.mDeriv = mDeriv;
this.selectedOctant = selectedOctant;
if (sh.ellipsoidShades == null) sh.createEllipsoidShades();
if (octantPoints != null) {
this.planeShade = -1;
for (var i = 0; i < 3; i++) {
var dx = this.dxyz[i][0] = octantPoints[i].x - x;
var dy = this.dxyz[i][1] = octantPoints[i].y - y;
var dz = this.dxyz[i][2] = octantPoints[i].z - z;
this.planeShades[i] = sh.getShadeIndex(dx, dy, -dz);
if (dx == 0 && dy == 0) {
this.planeShade = this.planeShades[i];
break;
}}
}}if (mat != null || diameter > 128) {
this.renderQuadrant(-1, -1, x, y, z, diameter, shades);
this.renderQuadrant(-1, 1, x, y, z, diameter, shades);
this.renderQuadrant(1, -1, x, y, z, diameter, shades);
this.renderQuadrant(1, 1, x, y, z, diameter, shades);
if (mat != null) {
this.mat = null;
this.coef = null;
this.mDeriv = null;
}} else {
var ss = sh.sphereShapeCache[diameter - 1];
if (ss == null) {
var countSE = 0;
var d = (diameter & 1) != 0;
var radiusF = diameter / 2.0;
var radiusF2 = radiusF * radiusF;
radius = Clazz_doubleToInt((diameter + 1) / 2);
var ys = d ? 0 : 0.5;
for (var i = 0; i < radius; ++i, ++ys) {
var y2 = ys * ys;
var xs = d ? 0 : 0.5;
for (var j = 0; j < radius; ++j, ++xs) {
var x2 = xs * xs;
var z2 = radiusF2 - y2 - x2;
if (z2 >= 0) ++countSE;
}
}
ss =  Clazz_newIntArray (countSE, 0);
var offset = 0;
ys = d ? 0 : 0.5;
for (var i = 0; i < radius; ++i, ++ys) {
var y2 = ys * ys;
var xs = d ? 0 : 0.5;
for (var j = 0; j < radius; ++j, ++xs) {
var x2 = xs * xs;
var z2 = radiusF2 - y2 - x2;
if (z2 >= 0) {
var zs = Math.sqrt(z2);
var height = Clazz_floatToInt(zs);
var shadeIndexSE = sh.getShadeN(xs, ys, zs, radiusF);
var shadeIndexSW = sh.getShadeN(-xs, ys, zs, radiusF);
var shadeIndexNE = sh.getShadeN(xs, -ys, zs, radiusF);
var shadeIndexNW = sh.getShadeN(-xs, -ys, zs, radiusF);
var packed = (height | (shadeIndexSE << 7) | (shadeIndexSW << 13) | (shadeIndexNE << 19) | (shadeIndexNW << 25));
ss[offset++] = packed;
}}
ss[offset - 1] |= 0x80000000;
}
sh.sphereShapeCache[diameter - 1] = ss;
}if (minX < 0 || maxX >= this.width || minY < 0 || maxY >= this.height || minZ < this.slab || z > this.depth) this.renderSphereClipped(ss, x, y, z, diameter, shades);
 else this.renderSphereUnclipped(ss, z, diameter, shades);
}this.zbuf = null;
}, "~A,~N,~N,~N,~N,JU.M3,~A,JU.M4,~N,~A");
Clazz_defineMethod(c$, "renderSphereUnclipped", 
function(sphereShape, z, diameter, shades){
var offsetSphere = 0;
var evenSizeCorrection = 1 - (diameter & 1);
var offsetSouthCenter = this.offsetPbufBeginLine;
var offsetNorthCenter = offsetSouthCenter - evenSizeCorrection * this.width;
var nLines = Clazz_doubleToInt((diameter + 1) / 2);
var zbuf = this.zbuf;
var width = this.width;
var p = this.g3d.pixel;
do {
var offsetSE = offsetSouthCenter;
var offsetSW = offsetSouthCenter - evenSizeCorrection;
var offsetNE = offsetNorthCenter;
var offsetNW = offsetNorthCenter - evenSizeCorrection;
var packed;
do {
packed = sphereShape[offsetSphere++];
var zPixel = z - (packed & 0x7F);
if (zPixel < zbuf[offsetSE]) p.addPixel(offsetSE, zPixel, shades[((packed >> 7) & 0x3F)]);
if (zPixel < zbuf[offsetSW]) p.addPixel(offsetSW, zPixel, shades[((packed >> 13) & 0x3F)]);
if (zPixel < zbuf[offsetNE]) p.addPixel(offsetNE, zPixel, shades[((packed >> 19) & 0x3F)]);
if (zPixel < zbuf[offsetNW]) p.addPixel(offsetNW, zPixel, shades[((packed >> 25) & 0x3F)]);
++offsetSE;
--offsetSW;
++offsetNE;
--offsetNW;
} while (packed >= 0);
offsetSouthCenter += width;
offsetNorthCenter -= width;
} while (--nLines > 0);
}, "~A,~N,~N,~A");
Clazz_defineMethod(c$, "renderSphereClipped", 
function(sphereShape, x, y, z, diameter, shades){
var w = this.width;
var h = this.height;
var offsetSphere = 0;
var evenSizeCorrection = 1 - (diameter & 1);
var offsetSouthCenter = this.offsetPbufBeginLine;
var offsetNorthCenter = offsetSouthCenter - evenSizeCorrection * w;
var nLines = Clazz_doubleToInt((diameter + 1) / 2);
var ySouth = y;
var yNorth = y - evenSizeCorrection;
var randu = (x << 16) + (y << 1) ^ 0x33333333;
var sh = shades;
var zb = this.zbuf;
var p = this.g3d.pixel;
var sl = this.slab;
var de = this.depth;
do {
var tSouthVisible = ySouth >= 0 && ySouth < h;
var tNorthVisible = yNorth >= 0 && yNorth < h;
var offsetSE = offsetSouthCenter;
var offsetSW = offsetSouthCenter - evenSizeCorrection;
var offsetNE = offsetNorthCenter;
var offsetNW = offsetNorthCenter - evenSizeCorrection;
var packed;
var xEast = x;
var xWest = x - evenSizeCorrection;
do {
var tWestVisible = xWest >= 0 && xWest < w;
var tEastVisible = xEast >= 0 && xEast < w;
packed = sphereShape[offsetSphere++];
var isCore;
var zOffset = packed & 0x7F;
var zPixel;
if (z < sl) {
zPixel = z + zOffset;
isCore = (zPixel >= sl);
} else {
zPixel = z - zOffset;
isCore = (zPixel < sl);
}if (isCore) zPixel = sl;
if (zPixel >= sl && zPixel <= de) {
if (tSouthVisible) {
if (tEastVisible && zPixel < zb[offsetSE]) {
var i = (isCore ? 44 + ((randu >> 7) & 0x07) : (packed >> 7) & 0x3F);
p.addPixel(offsetSE, zPixel, sh[i]);
}if (tWestVisible && zPixel < zb[offsetSW]) {
var i = (isCore ? 44 + ((randu >> 13) & 0x07) : (packed >> 13) & 0x3F);
p.addPixel(offsetSW, zPixel, sh[i]);
}}if (tNorthVisible) {
if (tEastVisible && zPixel < zb[offsetNE]) {
var i = (isCore ? 44 + ((randu >> 19) & 0x07) : (packed >> 19) & 0x3F);
p.addPixel(offsetNE, zPixel, sh[i]);
}if (tWestVisible && zPixel < zb[offsetNW]) {
var i = (isCore ? 44 + ((randu >> 25) & 0x07) : (packed >> 25) & 0x3F);
p.addPixel(offsetNW, zPixel, sh[i]);
}}}++offsetSE;
--offsetSW;
++offsetNE;
--offsetNW;
++xEast;
--xWest;
if (isCore) randu = ((randu << 16) + (randu << 1) + randu) & 0x7FFFFFFF;
} while (packed >= 0);
offsetSouthCenter += w;
offsetNorthCenter -= w;
++ySouth;
--yNorth;
} while (--nLines > 0);
}, "~A,~N,~N,~N,~N,~A");
Clazz_defineMethod(c$, "renderQuadrant", 
function(xSign, ySign, x, y, z, diameter, shades){
var radius = Clazz_doubleToInt(diameter / 2);
var t = x + radius * xSign;
var xStatus = (x < 0 ? -1 : x < this.width ? 0 : 1) + (t < 0 ? -2 : t < this.width ? 0 : 2);
if (xStatus == -3 || xStatus == 3) return;
t = y + radius * ySign;
var yStatus = (y < 0 ? -1 : y < this.height ? 0 : 1) + (t < 0 ? -2 : t < this.height ? 0 : 2);
if (yStatus == -3 || yStatus == 3) return;
var unclipped = (this.mat == null && xStatus == 0 && yStatus == 0 && z - radius >= this.slab && z <= this.depth);
if (unclipped) this.renderQuadrantUnclipped(radius, xSign, ySign, z, shades);
 else this.renderQuadrantClipped(radius, xSign, ySign, x, y, z, shades);
}, "~N,~N,~N,~N,~N,~N,~A");
Clazz_defineMethod(c$, "renderQuadrantUnclipped", 
function(radius, xSign, ySign, z, s){
var r2 = radius * radius;
var dDivisor = radius * 2 + 1;
var lineIncrement = (ySign < 0 ? -this.width : this.width);
var ptLine = this.offsetPbufBeginLine;
var zb = this.zbuf;
var p = this.g3d.pixel;
var indexes = this.shader.sphereShadeIndexes;
for (var i = 0, i2 = 0; i2 <= r2; i2 += i + (++i), ptLine += lineIncrement) {
var offset = ptLine;
var s2 = r2 - i2;
var z0 = z - radius;
var y8 = Clazz_doubleToInt(((i * ySign + radius) << 8) / dDivisor);
for (var j = 0, j2 = 0; j2 <= s2; j2 += j + (++j), offset += xSign) {
if (zb[offset] <= z0) continue;
var k = Clazz_doubleToInt(Math.sqrt(s2 - j2));
z0 = z - k;
if (zb[offset] <= z0) continue;
var x8 = Clazz_doubleToInt(((j * xSign + radius) << 8) / dDivisor);
p.addPixel(offset, z0, s[indexes[((y8 << 8) + x8)]]);
}
}
}, "~N,~N,~N,~N,~A");
Clazz_defineMethod(c$, "renderQuadrantClipped", 
function(radius, xSign, ySign, x, y, z, shades){
var isEllipsoid = (this.mat != null);
var checkOctant = (this.selectedOctant >= 0);
var r2 = radius * radius;
var dDivisor = radius * 2 + 1;
var lineIncrement = (ySign < 0 ? -this.width : this.width);
var ptLine = this.offsetPbufBeginLine;
var randu = (x << 16) + (y << 1) ^ 0x33333333;
var y8 = 0;
var iShade = 0;
var p = this.g3d.pixel;
var z1 = 0;
var h = this.height;
var w = this.width;
var x0 = x;
var zb = this.zbuf;
var xyz = this.dxyz;
var y0 = y;
var z0 = z;
var sl = this.slab;
var de = this.depth;
var pt = this.ptTemp;
var c = this.coef;
var rt = this.zroot;
var oct = this.selectedOctant;
var s = this.shader;
var pl = this.planeShades;
var indexes = s.sphereShadeIndexes;
var ps = this.planeShade;
var m = this.mat;
for (var i = 0, i2 = 0, yC = y; i2 <= r2; i2 += i + (++i), ptLine += lineIncrement, yC += ySign) {
if (yC < 0) {
if (ySign < 0) return;
continue;
}if (yC >= h) {
if (ySign > 0) return;
continue;
}var s2 = r2 - (isEllipsoid ? 0 : i2);
if (!isEllipsoid) {
y8 = Clazz_doubleToInt(((i * ySign + radius) << 8) / dDivisor);
}randu = ((randu << 16) + (randu << 1) + randu) & 0x7FFFFFFF;
var xC = x0;
for (var j = 0, j2 = 0, iRoot = -1, mode = 1, offset = ptLine; j2 <= s2; j2 += j + (++j), offset += xSign, xC += xSign) {
if (xC < 0) {
if (xSign < 0) break;
continue;
}if (xC >= w) {
if (xSign > 0) break;
continue;
}var zPixel;
if (isEllipsoid) {
var b_2a = (c[4] * xC + c[5] * yC + c[8]) / c[2] / 2;
var c_a = (c[0] * xC * xC + c[1] * yC * yC + c[3] * xC * yC + c[6] * xC + c[7] * yC - 1) / c[2];
var f = b_2a * b_2a - c_a;
if (f < 0) {
if (iRoot >= 0) {
break;
}continue;
}f = Math.sqrt(f);
rt[0] = (-b_2a - f);
rt[1] = (-b_2a + f);
iRoot = (z0 < sl ? 1 : 0);
if ((zPixel = Clazz_doubleToInt(rt[iRoot])) == 0) zPixel = z0;
mode = 2;
z1 = zPixel;
if (checkOctant) {
pt.set(xC - x0, yC - y0, zPixel - z0);
m.rotate(pt);
var thisOctant = 0;
if (pt.x < 0) thisOctant |= 1;
if (pt.y < 0) thisOctant |= 2;
if (pt.z < 0) thisOctant |= 4;
if (thisOctant == oct) {
if (ps >= 0) {
iShade = ps;
} else {
var iMin = 3;
var dz;
var zMin = 3.4028235E38;
for (var ii = 0; ii < 3; ii++) {
if ((dz = xyz[ii][2]) == 0) continue;
var ptz = z0 + (-xyz[ii][0] * (xC - x) - xyz[ii][1] * (yC - y0)) / dz;
if (ptz < zMin) {
zMin = ptz;
iMin = ii;
}}
if (iMin == 3) {
iMin = 0;
zMin = z0;
}rt[0] = zMin;
iShade = pl[iMin];
}zPixel = Clazz_doubleToInt(rt[0]);
mode = 3;
}var isCore = (z0 < sl ? zPixel >= sl : zPixel < sl);
if (isCore) {
z1 = zPixel = sl;
mode = 0;
}}if (zPixel < sl || zPixel > de || zb[offset] <= z1) continue;
} else {
var zOffset = Clazz_doubleToInt(Math.sqrt(s2 - j2));
zPixel = z0 + (z0 < sl ? zOffset : -zOffset);
var isCore = (z0 < sl ? zPixel >= sl : zPixel < sl);
if (isCore) {
zPixel = sl;
mode = 0;
}if (zPixel < sl || zPixel > de || zb[offset] <= zPixel) continue;
}switch (mode) {
case 0:
iShade = (44 + ((randu >> 8) & 0x07));
randu = ((randu << 16) + (randu << 1) + randu) & 0x7FFFFFFF;
mode = 1;
break;
case 2:
iShade = s.getEllipsoidShade(xC, yC, rt[iRoot], radius, this.mDeriv);
break;
case 3:
p.clearPixel(offset, z1);
break;
default:
var x8 = Clazz_doubleToInt(((j * xSign + radius) << 8) / dDivisor);
iShade = indexes[(y8 << 8) + x8];
break;
}
p.addPixel(offset, zPixel, shades[iShade]);
}
randu = ((randu + xC + yC) | 1) & 0x7FFFFFFF;
}
}, "~N,~N,~N,~N,~N,~N,~A");
});
;//5.0.1-v7 Mon Aug 17 10:07:10 MDT 2026
Clazz_declarePackage("J.g3d");
Clazz_load(["java.util.Hashtable"], "J.g3d.TextRenderer", ["JU.CU", "J.g3d.Graphics3D"], function(){
var c$ = Clazz_decorateAsClass(function(){
this.height = 0;
this.ascent = 0;
this.width = 0;
this.mapWidth = 0;
this.size = 0;
this.tmap = null;
this.isInvalid = false;
Clazz_instantialize(this, arguments);}, J.g3d, "TextRenderer", null);
Clazz_makeConstructor(c$, 
function(text, font3d){
this.ascent = font3d.getAscent();
this.height = font3d.getHeight();
this.width = font3d.stringWidth(text);
if (this.width == 0) return;
this.mapWidth = this.width;
this.size = this.mapWidth * this.height;
}, "~S,JU.Font");
c$.clearFontCache = Clazz_defineMethod(c$, "clearFontCache", 
function(){
if (J.g3d.TextRenderer.working) return;
J.g3d.TextRenderer.htFont3d.clear();
J.g3d.TextRenderer.htFont3dAntialias.clear();
});
c$.plot = Clazz_defineMethod(c$, "plot", 
function(x, y, z, argb, bgargb, text, font3d, g3d, jr, antialias){
if (text.length == 0) return 0;
if (text.indexOf("<su") >= 0 || text.indexOf("<color") >= 0) return J.g3d.TextRenderer.plotByCharacter(x, y, z, argb, bgargb, text, font3d, g3d, jr, antialias);
var offset = font3d.getAscent();
y -= offset;
var text3d = J.g3d.TextRenderer.getPlotText3D(x, y, g3d, text, font3d, antialias);
if (text3d.isInvalid) return text3d.width;
if (antialias) argb = J.g3d.Graphics3D.fixTextImageRGB(argb);
var textHeight = text3d.height;
var textWidth = text3d.width;
var tmap = text3d.tmap;
var g = g3d;
var width = g.width;
var height = g.height;
var zbuf = g.zbuf;
var p = g.pixel;
var tLog = g.translucencyLog;
if (jr != null || (x < 0 || x + text3d.width > width || y < 0 || y + text3d.height > height) && (jr = g3d) != null) {
for (var off = 0, i = 0; i < textHeight; i++) {
for (var j = 0; j < textWidth; j++) {
var shade = tmap[off++];
if (shade != 0) jr.plotImagePixel(argb, x + j, y + i, z, shade, bgargb, width, height, zbuf, p, tLog);
}
}
} else {
for (var i = 0, off = 0, pbufOffset = y * width + x; i < textHeight; i++, pbufOffset += (width - textWidth)) for (var j = 0; j < textWidth; j++) p.addImagePixel(tmap[off++], tLog, pbufOffset++, z, argb, bgargb);


}return text3d.width;
}, "~N,~N,~N,~N,~N,~S,JU.Font,J.g3d.Graphics3D,J.api.JmolRendererInterface,~B");
c$.plotByCharacter = Clazz_defineMethod(c$, "plotByCharacter", 
function(x, y, z, argb, bgargb, text, font3d, g3d, jmolRenderer, antialias){
var w = 0;
var len = text.length;
var suboffset = Math.round(font3d.getHeight() * 0.25);
var supoffset = -Math.round(font3d.getHeight() * 0.3);
var argb0 = 0;
for (var i = 0; i < len; i++) {
if (text.charAt(i) == '<') {
if (i + 5 < len && text.substring(i, i + 6).equals("<color")) {
argb0 = argb;
var pt = text.indexOf(">", i);
if (pt < 0) continue;
argb = JU.CU.getArgbFromString(text.substring(i + 7, pt).trim());
i = pt;
continue;
}if (i + 7 < len && text.substring(i, i + 8).equals("</color>")) {
i += 7;
argb = argb0;
continue;
}if (i + 4 < len && text.substring(i, i + 5).equals("<sub>")) {
i += 4;
y += suboffset;
continue;
}if (i + 4 < len && text.substring(i, i + 5).equals("<sup>")) {
i += 4;
y += supoffset;
continue;
}if (i + 5 < len && text.substring(i, i + 6).equals("</sub>")) {
i += 5;
y -= suboffset;
continue;
}if (i + 5 < len && text.substring(i, i + 6).equals("</sup>")) {
i += 5;
y -= supoffset;
continue;
}}var width = J.g3d.TextRenderer.plot(x + w, y, z, argb, bgargb, text.substring(i, i + 1), font3d, g3d, jmolRenderer, antialias);
w += width;
}
return w;
}, "~N,~N,~N,~N,~N,~S,JU.Font,J.g3d.Graphics3D,J.api.JmolRendererInterface,~B");
c$.getPlotText3D = Clazz_defineMethod(c$, "getPlotText3D", 
function(x, y, g3d, text, font3d, antialias){
J.g3d.TextRenderer.working = true;
var ht = (antialias ? J.g3d.TextRenderer.htFont3dAntialias : J.g3d.TextRenderer.htFont3d);
var htForThisFont = ht.get(font3d);
var text3d = null;
var newFont = false;
var newText = false;
if (htForThisFont != null) {
text3d = htForThisFont.get(text);
} else {
htForThisFont =  new java.util.Hashtable();
newFont = true;
}if (text3d == null) {
text3d =  new J.g3d.TextRenderer(text, font3d);
newText = true;
}text3d.isInvalid = (text3d.width == 0 || x + text3d.width <= 0 || x >= g3d.width || y + text3d.height <= 0 || y >= g3d.height);
if (text3d.isInvalid) return text3d;
if (newFont) ht.put(font3d, htForThisFont);
if (newText) {
text3d.setTranslucency(text, font3d, g3d);
htForThisFont.put(text, text3d);
}J.g3d.TextRenderer.working = false;
return text3d;
}, "~N,~N,J.g3d.Graphics3D,~S,JU.Font,~B");
Clazz_defineMethod(c$, "setTranslucency", 
function(text, font3d, g3d){
var pixels = g3d.apiPlatform.getTextPixels(text, font3d, g3d.platform.getGraphicsForTextOrImage(this.mapWidth, this.height), g3d.platform.offscreenImage, this.mapWidth, this.height, this.ascent);
if (pixels == null) return;
this.tmap =  Clazz_newByteArray (this.size, 0);
for (var i = pixels.length; --i >= 0; ) {
var p = pixels[i] & 0xFF;
if (p != 0) {
this.tmap[i] = J.g3d.TextRenderer.translucency[p >> 5];
}}
}, "~S,JU.Font,J.g3d.Graphics3D");
c$.translucency =  Clazz_newByteArray(-1, [7, 6, 5, 4, 3, 2, 1, 8]);
c$.working = false;
c$.htFont3d =  new java.util.Hashtable();
c$.htFont3dAntialias =  new java.util.Hashtable();
});
;//5.0.1-v7 Mon Aug 17 10:07:10 MDT 2026
Clazz_declarePackage("J.g3d");
Clazz_load(["JU.P3i"], "J.g3d.TextString", null, function(){
var c$ = Clazz_decorateAsClass(function(){
this.text = null;
this.font = null;
this.argb = 0;
this.bgargb = 0;
Clazz_instantialize(this, arguments);}, J.g3d, "TextString", JU.P3i, java.util.Comparator);
Clazz_defineMethod(c$, "setText", 
function(text, font, argb, bgargb, x, y, z){
this.text = text;
this.font = font;
this.argb = argb;
this.bgargb = bgargb;
this.x = x;
this.y = y;
this.z = z;
}, "~S,JU.Font,~N,~N,~N,~N,~N");
Clazz_overrideMethod(c$, "compare", 
function(a, b){
return (a == null || b == null ? 0 : a.z > b.z ? -1 : a.z < b.z ? 1 : 0);
}, "J.g3d.TextString,J.g3d.TextString");
Clazz_overrideMethod(c$, "toString", 
function(){
return this.asString() + " " + this.text;
});
});
;//5.0.1-v7 Mon Aug 17 10:07:10 MDT 2026
Clazz_declarePackage("J.g3d");
Clazz_load(["J.g3d.G3DRenderer", "$.PrecisionRenderer", "JU.Rgb16"], "J.g3d.TriangleRenderer", ["JU.GData"], function(){
var c$ = Clazz_decorateAsClass(function(){
this.g3d = null;
this.ax = null;
this.ay = null;
this.az = null;
this.aa = null;
this.bb = null;
this.axW = null;
this.azW = null;
this.axE = null;
this.azE = null;
this.rgb16sW = null;
this.rgb16sE = null;
this.rgb16sGouraud = null;
this.rgb16t1 = null;
this.rgb16t2 = null;
Clazz_instantialize(this, arguments);}, J.g3d, "TriangleRenderer", J.g3d.PrecisionRenderer, J.g3d.G3DRenderer);
Clazz_prepareFields (c$, function(){
this.ax =  Clazz_newIntArray (3, 0);
this.ay =  Clazz_newIntArray (3, 0);
this.az =  Clazz_newIntArray (3, 0);
this.aa =  Clazz_newFloatArray (64, 0);
this.bb =  Clazz_newFloatArray (64, 0);
this.axW =  Clazz_newIntArray (64, 0);
this.azW =  Clazz_newIntArray (64, 0);
this.axE =  Clazz_newIntArray (64, 0);
this.azE =  Clazz_newIntArray (64, 0);
this.rgb16t1 =  new JU.Rgb16();
this.rgb16t2 =  new JU.Rgb16();
});
Clazz_makeConstructor(c$, 
function(){
Clazz_superConstructor (this, J.g3d.TriangleRenderer, []);
});
Clazz_overrideMethod(c$, "set", 
function(g3d, gdata){
try {
this.rgb16sW =  new Array(64);
this.rgb16sE =  new Array(64);
for (var i = 64; --i >= 0; ) {
this.rgb16sW[i] =  new JU.Rgb16();
this.rgb16sE[i] =  new JU.Rgb16();
}
this.g3d = g3d;
this.rgb16sGouraud =  new Array(3);
for (var i = 3; --i >= 0; ) this.rgb16sGouraud[i] =  new JU.Rgb16();

} catch (e) {
if (Clazz_exceptionOf(e, Exception)){
} else {
throw e;
}
}
return this;
}, "J.api.JmolRendererInterface,JU.GData");
Clazz_defineMethod(c$, "reallocRgb16s", 
function(rgb16s, n){
var t =  new Array(n);
System.arraycopy(rgb16s, 0, t, 0, rgb16s.length);
for (var i = rgb16s.length; i < n; ++i) t[i] =  new JU.Rgb16();

return t;
}, "~A,~N");
Clazz_defineMethod(c$, "setGouraud", 
function(rgbA, rgbB, rgbC){
this.rgb16sGouraud[0].setInt(rgbA);
this.rgb16sGouraud[1].setInt(rgbB);
this.rgb16sGouraud[2].setInt(rgbC);
}, "~N,~N,~N");
Clazz_defineMethod(c$, "fillTriangle", 
function(screenA, screenB, screenC, useGouraud){
this.ax[0] = screenA.x;
this.ax[1] = screenB.x;
this.ax[2] = screenC.x;
this.ay[0] = screenA.y;
this.ay[1] = screenB.y;
this.ay[2] = screenC.y;
this.az[0] = screenA.z;
this.az[1] = screenB.z;
this.az[2] = screenC.z;
if (this.az[0] <= 1 || this.az[1] <= 1 || this.az[2] <= 1) return;
var cc0 = this.g3d.clipCode3(this.ax[0], this.ay[0], this.az[0]);
var cc1 = this.g3d.clipCode3(this.ax[1], this.ay[1], this.az[1]);
var cc2 = this.g3d.clipCode3(this.ax[2], this.ay[2], this.az[2]);
var c = (cc0 | cc1 | cc2);
var isClipped = (c != 0);
if (isClipped) {
if (c == -1 || (cc0 & cc1 & cc2) != 0) {
return;
}}var iMinY = 0;
if (this.ay[1] < this.ay[iMinY]) iMinY = 1;
if (this.ay[2] < this.ay[iMinY]) iMinY = 2;
var iMidY = (iMinY + 1) % 3;
var iMaxY = (iMinY + 2) % 3;
if (this.ay[iMidY] > this.ay[iMaxY]) {
var t = iMidY;
iMidY = iMaxY;
iMaxY = t;
}var yMin = this.ay[iMinY];
var yMid = this.ay[iMidY];
var yMax = this.ay[iMaxY];
var nLines = yMax - yMin + 1;
if (nLines > this.g3d.height * 3) return;
if (nLines > this.axW.length) {
var n = (nLines + 31) & -32;
this.axW =  Clazz_newIntArray (n, 0);
this.azW =  Clazz_newIntArray (n, 0);
this.axE =  Clazz_newIntArray (n, 0);
this.azE =  Clazz_newIntArray (n, 0);
this.aa =  Clazz_newFloatArray (n, 0);
this.bb =  Clazz_newFloatArray (n, 0);
this.rgb16sW = this.reallocRgb16s(this.rgb16sW, n);
this.rgb16sE = this.reallocRgb16s(this.rgb16sE, n);
}var gouraudW;
var gouraudE;
if (useGouraud) {
gouraudW = this.rgb16sW;
gouraudE = this.rgb16sE;
} else {
gouraudW = gouraudE = null;
}var dyMidMin = yMid - yMin;
if (dyMidMin == 0) {
if (this.ax[iMidY] < this.ax[iMinY]) {
var t = iMidY;
iMidY = iMinY;
iMinY = t;
}this.generateRaster(nLines, iMinY, iMaxY, this.axW, this.azW, 0, gouraudW);
this.generateRaster(nLines, iMidY, iMaxY, this.axE, this.azE, 0, gouraudE);
} else if (yMid == yMax) {
if (this.ax[iMaxY] < this.ax[iMidY]) {
var t = iMidY;
iMidY = iMaxY;
iMaxY = t;
}this.generateRaster(nLines, iMinY, iMidY, this.axW, this.azW, 0, gouraudW);
this.generateRaster(nLines, iMinY, iMaxY, this.axE, this.azE, 0, gouraudE);
} else {
var dxMaxMin = this.ax[iMaxY] - this.ax[iMinY];
var roundFactor;
roundFactor = JU.GData.roundInt(Clazz_doubleToInt(nLines / 2));
if (dxMaxMin < 0) roundFactor = -roundFactor;
var axSplit = this.ax[iMinY] + Clazz_doubleToInt((dxMaxMin * dyMidMin + roundFactor) / nLines);
if (axSplit < this.ax[iMidY]) {
this.generateRaster(nLines, iMinY, iMaxY, this.axW, this.azW, 0, gouraudW);
this.generateRaster(dyMidMin + 1, iMinY, iMidY, this.axE, this.azE, 0, gouraudE);
this.generateRaster(nLines - dyMidMin, iMidY, iMaxY, this.axE, this.azE, dyMidMin, gouraudE);
} else {
this.generateRaster(dyMidMin + 1, iMinY, iMidY, this.axW, this.azW, 0, gouraudW);
this.generateRaster(nLines - dyMidMin, iMidY, iMaxY, this.axW, this.azW, dyMidMin, gouraudW);
this.generateRaster(nLines, iMinY, iMaxY, this.axE, this.azE, 0, gouraudE);
}}this.g3d.setZMargin(5);
var pass2Row = this.g3d.pass2Flag01;
var pass2Off = 1 - pass2Row;
var xW;
var i = 0;
if (yMin < 0) {
nLines += yMin;
i -= yMin;
yMin = 0;
}if (yMin + nLines > this.g3d.height) nLines = this.g3d.height - yMin;
if (useGouraud) {
if (isClipped) {
for (; --nLines >= pass2Row; ++yMin, ++i) {
var pixelCount = this.axE[i] - (xW = this.axW[i]) + pass2Off;
if (pixelCount > 0) this.g3d.plotPixelsClippedRaster(pixelCount, xW, yMin, this.azW[i], this.azE[i], this.rgb16sW[i], this.rgb16sE[i]);
}
} else {
for (; --nLines >= pass2Row; ++yMin, ++i) {
var pixelCount = this.axE[i] - (xW = this.axW[i]) + pass2Off;
if (pass2Row == 1 && pixelCount < 0) {
pixelCount = 1;
xW--;
}if (pixelCount > 0) this.g3d.plotPixelsUnclippedRaster(pixelCount, xW, yMin, this.azW[i], this.azE[i], this.rgb16sW[i], this.rgb16sE[i]);
}
}} else {
if (isClipped) {
for (; --nLines >= pass2Row; ++yMin, ++i) {
var pixelCount = this.axE[i] - (xW = this.axW[i]) + pass2Off;
if (pixelCount > 0) this.g3d.plotPixelsClippedRasterBits(pixelCount, xW, yMin, this.azW[i], this.azE[i], null, null, this.aa[i], this.bb[i]);
}
} else {
for (; --nLines >= pass2Row; ++yMin, ++i) {
var pixelCount = this.axE[i] - (xW = this.axW[i]) + pass2Off;
if (pass2Row == 1 && pixelCount < 0) {
pixelCount = 1;
xW--;
}if (pixelCount > 0) this.g3d.plotPixelsUnclippedRasterBits(pixelCount, xW, yMin, null, null, this.aa[i], this.bb[i]);
}
}}this.g3d.setZMargin(0);
}, "JU.P3i,JU.P3i,JU.P3i,~B");
Clazz_defineMethod(c$, "generateRaster", 
function(dy, iN, iS, axRaster, azRaster, iRaster, gouraud){
var xN = this.ax[iN];
var xS = this.ax[iS];
var dx = xS - xN;
var xCurrent = xN;
var xIncrement;
var width;
var errorTerm;
if (dx >= 0) {
xIncrement = 1;
width = dx;
errorTerm = 0;
} else {
xIncrement = -1;
width = -dx;
errorTerm = 1 - dy;
}var xMajorIncrement;
var xMajorError;
if (width <= dy) {
xMajorIncrement = 0;
xMajorError = width;
} else {
xMajorIncrement = JU.GData.roundInt(Clazz_doubleToInt(dx / dy));
xMajorError = width % dy;
}this.setRastAB(this.ay[iN], this.az[iN], this.ay[iS], this.az[iS]);
var a0 = this.a;
var b0 = this.b;
var isEast = (axRaster === this.axE);
for (var y = 0, zy = this.ay[iN], lastY = dy - 1, i = iRaster; y <= lastY; ++i, ++y, ++zy) {
if (i == 0 || i > iRaster) {
axRaster[i] = (y == lastY ? this.ax[iS] : xCurrent);
azRaster[i] = this.getZCurrent(a0, b0, zy);
if (isEast) {
this.setRastAB(this.axW[i], this.azW[i], axRaster[i], azRaster[i]);
this.aa[i] = this.a;
this.bb[i] = this.b;
}}xCurrent += xMajorIncrement;
errorTerm += xMajorError;
if (errorTerm > 0) {
xCurrent += xIncrement;
errorTerm -= dy;
}}
if (gouraud != null) {
var rgb16Base = this.rgb16t1;
rgb16Base.setRgb(this.rgb16sGouraud[iN]);
var rgb16Increment = this.rgb16t2;
rgb16Increment.diffDiv(this.rgb16sGouraud[iS], rgb16Base, dy);
for (var i = iRaster, iMax = iRaster + dy; i < iMax; ++i) gouraud[i].setAndIncrement(rgb16Base, rgb16Increment);

}}, "~N,~N,~N,~A,~A,~N,~A");
});
;//5.0.1-v7 Mon Aug 17 10:07:10 MDT 2026
Clazz_declarePackage("J.i18n");
Clazz_load(["J.api.Translator", "java.text.MessageFormat", "java.util.Hashtable", "JU.PT", "J.i18n.Language", "$.Resource"], "J.i18n.GT", ["JU.Logger"], function(){
var c$ = Clazz_decorateAsClass(function(){
this.resources = null;
this.resourceCount = 0;
this.doTranslate = true;
this.language = null;
Clazz_instantialize(this, arguments);}, J.i18n, "GT", null, J.api.Translator);
/*LV!1824 unnec constructor*/Clazz_makeConstructor(c$, 
function(vr, langCode){
{
}this.resources = null;
this.resourceCount = 0;
J.i18n.GT.$getTextWrapper = this;
if (langCode != null && langCode.length == 0) langCode = "none";
if (langCode != null) this.language = langCode;
if ("none".equals(this.language)) this.language = null;
if (this.language == null) this.language = J.i18n.Resource.getLanguage();
if (this.language == null) this.language = "en";
var la = this.language;
var la_co = null;
var la_co_va = null;
var i = this.language.indexOf("_");
if (i >= 0) {
la = la.substring(0, i);
la_co = this.language;
if ((i = la_co.indexOf("_", ++i)) >= 0) {
la_co = la_co.substring(0, i);
la_co_va = this.language;
}}if ((this.language = this.getSupported(la_co_va)) == null && (this.language = this.getSupported(la_co)) == null && (this.language = this.getSupported(la)) == null) {
this.language = "en";
System.out.println(this.language + " not supported -- using en");
return;
}la_co_va = null;
la_co = null;
switch (this.language.length) {
default:
la_co_va = this.language;
la_co = this.language.substring(0, 5);
la = this.language.substring(0, 2);
break;
case 5:
la_co = this.language;
la = this.language.substring(0, 2);
break;
case 2:
la = this.language;
break;
}
la_co = this.getSupported(la_co);
la = this.getSupported(la);
if (la === la_co || "en_US".equals(la)) la = null;
if (la_co === la_co_va) la_co = null;
if ("en_US".equals(la_co)) return;
if (J.i18n.GT.allowDebug && JU.Logger.debugging) JU.Logger.debug("Instantiating gettext wrapper for " + this.language + " using files for language:" + la + " country:" + la_co + " variant:" + la_co_va);
if (!J.i18n.GT.$ignoreApplicationBundle) this.addBundles(vr, "Jmol", la_co_va, null, null);
this.addBundles(vr, "JmolApplet", la_co_va, null, null);
if (!J.i18n.GT.$ignoreApplicationBundle) this.addBundles(vr, "Jmol", null, la_co, null);
this.addBundles(vr, "JmolApplet", null, la_co, null);
if (!J.i18n.GT.$ignoreApplicationBundle) this.addBundles(vr, "Jmol", null, null, la);
this.addBundles(vr, "JmolApplet", null, null, la);
}, "JV.Viewer,~S");
Clazz_overrideMethod(c$, "translate", 
function(s){
return J.i18n.GT.$(s);
}, "~S");
c$.getLanguageList = Clazz_defineMethod(c$, "getLanguageList", 
function(gt){
if (J.i18n.GT.languageList == null) {
if (gt == null) gt = J.i18n.GT.getTextWrapper();
gt.createLanguageList();
}return J.i18n.GT.languageList;
}, "J.i18n.GT");
c$.getLanguage = Clazz_defineMethod(c$, "getLanguage", 
function(){
return J.i18n.GT.getTextWrapper().language;
});
c$.ignoreApplicationBundle = Clazz_defineMethod(c$, "ignoreApplicationBundle", 
function(){
J.i18n.GT.$ignoreApplicationBundle = true;
});
c$.setDoTranslate = Clazz_defineMethod(c$, "setDoTranslate", 
function(TF){
var b = J.i18n.GT.getDoTranslate();
J.i18n.GT.getTextWrapper().doTranslate = TF;
return b;
}, "~B");
c$.getDoTranslate = Clazz_defineMethod(c$, "getDoTranslate", 
function(){
return J.i18n.GT.getTextWrapper().doTranslate;
});
c$.$ = Clazz_defineMethod(c$, "$", 
function(string){
return J.i18n.GT.getTextWrapper().getString(string);
}, "~S");
c$.o = Clazz_defineMethod(c$, "o", 
function(s, o){
if (Clazz_instanceOf(o,Array)) {
if ((o).length != 1) return java.text.MessageFormat.format(s, o);
o = (o)[0];
}return JU.PT.rep(s, "{0}", o.toString());
}, "~S,~O");
c$.i = Clazz_defineMethod(c$, "i", 
function(s, n){
return JU.PT.rep(s, "{0}", "" + n);
}, "~S,~N");
c$.escapeHTML = Clazz_defineMethod(c$, "escapeHTML", 
function(msg){
var ch;
for (var i = msg.length; --i >= 0; ) if ((ch = msg.charAt(i)).charCodeAt(0) > 0x7F) {
msg = msg.substring(0, i) + "&#" + ((ch).charCodeAt(0)) + ";" + msg.substring(i + 1);
}
return msg;
}, "~S");
c$.getTextWrapper = Clazz_defineMethod(c$, "getTextWrapper", 
function(){
return (J.i18n.GT.$getTextWrapper == null ? J.i18n.GT.$getTextWrapper =  new J.i18n.GT(null, null) : J.i18n.GT.$getTextWrapper);
});
Clazz_defineMethod(c$, "createLanguageList", 
function(){
var wasTranslating = this.doTranslate;
this.doTranslate = false;
J.i18n.GT.languageList = J.i18n.Language.getLanguageList();
this.doTranslate = wasTranslating;
});
Clazz_defineMethod(c$, "getSupported", 
function(code){
if (code == null) return null;
var s = J.i18n.GT.htLanguages.get(code);
if (s != null) return (s.length == 0 ? null : s);
s = J.i18n.Language.getSupported(J.i18n.GT.getLanguageList(this), code);
J.i18n.GT.htLanguages.put(code, (s == null ? "" : s));
return s;
}, "~S");
Clazz_defineMethod(c$, "addBundles", 
function(vwr, type, la_co_va, la_co, la){
try {
var className = "J.translation." + type + ".";
if (la_co_va != null) this.addBundle(vwr, className, la_co_va);
if (la_co != null) this.addBundle(vwr, className, la_co);
if (la != null) this.addBundle(vwr, className, la);
} catch (exception) {
if (Clazz_exceptionOf(exception, Exception)){
if (J.i18n.GT.allowDebug) JU.Logger.errorEx("Some exception occurred!", exception);
this.resources = null;
this.resourceCount = 0;
} else {
throw exception;
}
}
}, "JV.Viewer,~S,~S,~S,~S");
Clazz_defineMethod(c$, "addBundle", 
function(vwr, className, name){
var resource = J.i18n.Resource.getResource(vwr, className, name);
if (resource != null) {
if (this.resources == null) {
this.resources =  new Array(8);
this.resourceCount = 0;
}this.resources[this.resourceCount] = resource;
this.resourceCount++;
if (J.i18n.GT.allowDebug) JU.Logger.debug("GT adding " + className);
}}, "JV.Viewer,~S,~S");
Clazz_defineMethod(c$, "getString", 
function(s){
var trans = null;
if (this.doTranslate) {
for (var bundle = 0; bundle < this.resourceCount; bundle++) {
trans = this.resources[bundle].getString(s);
if (trans != null) {
s = trans;
break;
}}
if (this.resourceCount > 0 && trans == null && J.i18n.GT.allowDebug && JU.Logger.debugging) JU.Logger.debug("No trans, using default: " + s);
}if (trans == null) {
if (s.startsWith("[")) s = s.substring(s.indexOf("]") + 1);
 else if (s.endsWith("]")) s = s.substring(0, s.indexOf("["));
}return s;
}, "~S");
c$.$ignoreApplicationBundle = false;
c$.$getTextWrapper = null;
c$.languageList = null;
c$.allowDebug = false;
c$.vwr = null;
c$.htLanguages =  new java.util.Hashtable();
});
;//5.0.1-v7 Mon Aug 24 10:01:38 CDT 2026
Clazz_declarePackage("J.i18n");
Clazz_load(null, "J.i18n.Language", ["J.i18n.GT"], function(){
var c$ = Clazz_decorateAsClass(function(){
this.code = null;
this.language = null;
this.nativeLanguage = null;
this.display = false;
Clazz_instantialize(this, arguments);}, J.i18n, "Language", null);
Clazz_makeConstructor(c$, 
function(code, language, nativeLanguage, display){
this.code = code;
this.language = language;
this.nativeLanguage = nativeLanguage;
this.display = display;
}, "~S,~S,~S,~B");
c$.getLanguageList = Clazz_defineMethod(c$, "getLanguageList", 
function(){
return  Clazz_newArray(-1, [ new J.i18n.Language("ar", J.i18n.GT.$("Arabic"), "العربية", false),  new J.i18n.Language("ast", J.i18n.GT.$("Asturian"), "Asturian", false),  new J.i18n.Language("az", J.i18n.GT.$("Azerbaijani"), "azərbaycan dili", false),  new J.i18n.Language("bs", J.i18n.GT.$("Bosnian"), "bosanski jezik", false),  new J.i18n.Language("ca", J.i18n.GT.$("Catalan"), "Català", true),  new J.i18n.Language("cs", J.i18n.GT.$("Czech"), "Čeština", true),  new J.i18n.Language("da", J.i18n.GT.$("Danish"), "Dansk", true),  new J.i18n.Language("de", J.i18n.GT.$("German"), "Deutsch", true),  new J.i18n.Language("el", J.i18n.GT.$("Greek"), "Ελληνικά", false),  new J.i18n.Language("en_AU", J.i18n.GT.$("Australian English"), "Australian English", false),  new J.i18n.Language("en_GB", J.i18n.GT.$("British English"), "British English", true),  new J.i18n.Language("en_US", J.i18n.GT.$("American English"), "American English", true),  new J.i18n.Language("es", J.i18n.GT.$("Spanish"), "Español", true),  new J.i18n.Language("et", J.i18n.GT.$("Estonian"), "Eesti", false),  new J.i18n.Language("eu", J.i18n.GT.$("Basque"), "Euskara", true),  new J.i18n.Language("fi", J.i18n.GT.$("Finnish"), "Suomi", true),  new J.i18n.Language("fo", J.i18n.GT.$("Faroese"), "Føroyskt", false),  new J.i18n.Language("fr", J.i18n.GT.$("French"), "Français", true),  new J.i18n.Language("fy", J.i18n.GT.$("Frisian"), "Frysk", false),  new J.i18n.Language("gl", J.i18n.GT.$("Galician"), "Galego", false),  new J.i18n.Language("hr", J.i18n.GT.$("Croatian"), "Hrvatski", false),  new J.i18n.Language("hu", J.i18n.GT.$("Hungarian"), "Magyar", true),  new J.i18n.Language("hy", J.i18n.GT.$("Armenian"), "Հայերեն", false),  new J.i18n.Language("id", J.i18n.GT.$("Indonesian"), "Indonesia", true),  new J.i18n.Language("it", J.i18n.GT.$("Italian"), "Italiano", true),  new J.i18n.Language("ja", J.i18n.GT.$("Japanese"), "日本語", true),  new J.i18n.Language("jv", J.i18n.GT.$("Javanese"), "Basa Jawa", false),  new J.i18n.Language("ko", J.i18n.GT.$("Korean"), "한국어", true),  new J.i18n.Language("ms", J.i18n.GT.$("Malay"), "Bahasa Melayu", true),  new J.i18n.Language("nb", J.i18n.GT.$("Norwegian Bokmal"), "Norsk Bokmål", false),  new J.i18n.Language("nl", J.i18n.GT.$("Dutch"), "Nederlands", true),  new J.i18n.Language("oc", J.i18n.GT.$("Occitan"), "Occitan", false),  new J.i18n.Language("pl", J.i18n.GT.$("Polish"), "Polski", false),  new J.i18n.Language("pt", J.i18n.GT.$("Portuguese"), "Português", false),  new J.i18n.Language("pt_BR", J.i18n.GT.$("Brazilian Portuguese"), "Português brasileiro", true),  new J.i18n.Language("ru", J.i18n.GT.$("Russian"), "Русский", true),  new J.i18n.Language("sl", J.i18n.GT.$("Slovenian"), "Slovenščina", false),  new J.i18n.Language("sr", J.i18n.GT.$("Serbian"), "српски језик", false),  new J.i18n.Language("sv", J.i18n.GT.$("Swedish"), "Svenska", true),  new J.i18n.Language("ta", J.i18n.GT.$("Tamil"), "தமிழ்", false),  new J.i18n.Language("te", J.i18n.GT.$("Telugu"), "తెలుగు", false),  new J.i18n.Language("tr", J.i18n.GT.$("Turkish"), "Türkçe", true),  new J.i18n.Language("ug", J.i18n.GT.$("Uyghur"), "Uyƣurqə", false),  new J.i18n.Language("uk", J.i18n.GT.$("Ukrainian"), "Українська", true),  new J.i18n.Language("uz", J.i18n.GT.$("Uzbek"), "O'zbek", false),  new J.i18n.Language("zh_CN", J.i18n.GT.$("Simplified Chinese"), "简体中文", true),  new J.i18n.Language("zh_TW", J.i18n.GT.$("Traditional Chinese"), "繁體中文", true)]);
});
c$.getSupported = Clazz_defineMethod(c$, "getSupported", 
function(list, code){
for (var i = list.length; --i >= 0; ) if (list[i].code.equalsIgnoreCase(code)) return list[i].code;

for (var i = list.length; --i >= 0; ) if (list[i].code.startsWith(code)) return list[i].code;

return null;
}, "~A,~S");
});
;//5.0.1-v7 Mon Aug 17 10:07:10 MDT 2026
Clazz_declarePackage("J.i18n");
Clazz_load(null, "J.i18n.Resource", ["java.util.Hashtable", "JU.PT", "$.Rdr", "J.translation.PO", "JU.Logger", "JV.FileManager"], function(){
var c$ = Clazz_decorateAsClass(function(){
this.resource = null;
this.resourceMap = null;
Clazz_instantialize(this, arguments);}, J.i18n, "Resource", null);
Clazz_makeConstructor(c$, 
function(resource, className){
if (className == null) this.resourceMap = resource;
 else this.resource = resource;
}, "~O,~S");
c$.getResource = Clazz_defineMethod(c$, "getResource", 
function(vwr, className, name){
try {
var br = JV.FileManager.getBufferedReaderForResource(vwr, J.translation.PO, "J/translation/", (className.indexOf("Applet") >= 0 ? "JmolApplet/" : "Jmol/") + name + ".po");
var data =  new Array(1);
JU.Rdr.readAllAsString(br, 2147483647, false, data, 0);
var poData = data[0];
return J.i18n.Resource.getResourceFromPO(poData);
} catch (e) {
if (Clazz_exceptionOf(e,"java.io.IOException")){
return null;
} else {
throw e;
}
}
}, "JV.Viewer,~S,~S");
Clazz_defineMethod(c$, "getString", 
function(string){
try {
return (this.resource == null ? this.resourceMap.get(string) : this.resource.getString(string));
} catch (e) {
if (Clazz_exceptionOf(e, Exception)){
return null;
} else {
throw e;
}
}
}, "~S");
c$.getLanguage = Clazz_defineMethod(c$, "getLanguage", 
function(){
var language = null;
{
language = Jmol.featureDetection.getDefaultLanguage().replace(/-/g,'_');
}return language;
});
c$.getResourceFromPO = Clazz_defineMethod(c$, "getResourceFromPO", 
function(data){
if (data == null || data.length == 0) return null;
var map =  new java.util.Hashtable();
try {
var lines = JU.PT.split(data, "\n");
var mode = 0;
var msgstr = "";
var msgid = "";
for (var i = 0; i < lines.length; i++) {
var line = lines[i];
if (line.length <= 2) {
if (mode == 2 && msgstr.length != 0 && msgid.length != 0) map.put(msgid, msgstr);
mode = 0;
} else if (line.indexOf("msgid") == 0) {
mode = 1;
msgid = J.i18n.Resource.fix(line);
} else if (line.indexOf("msgstr") == 0) {
mode = 2;
msgstr = J.i18n.Resource.fix(line);
} else if (mode == 1) {
msgid += J.i18n.Resource.fix(line);
} else if (mode == 2) {
msgstr += J.i18n.Resource.fix(line);
}}
} catch (e) {
if (Clazz_exceptionOf(e, Exception)){
} else {
throw e;
}
}
JU.Logger.info(map.size() + " translations loaded");
return (map.size() == 0 ? null :  new J.i18n.Resource(map, null));
}, "~S");
c$.fix = Clazz_defineMethod(c$, "fix", 
function(line){
if (line.indexOf("\\\"") >= 0) line = JU.PT.rep(line, "\\\"", "\"");
return JU.PT.rep(line.substring(line.indexOf("\"") + 1, line.lastIndexOf("\"")), "\\n", "\n");
}, "~S");
});
;//5.0.1-v7 Mon Aug 24 10:01:38 CDT 2026
Clazz_declarePackage("J.io");
Clazz_load(null, "J.io.FileReader", ["java.io.BufferedReader", "JU.AU", "$.PT", "$.Rdr", "J.api.Interface", "JU.Logger"], function(){
var c$ = Clazz_decorateAsClass(function(){
this.vwr = null;
this.fileNameIn = null;
this.fullPathNameIn = null;
this.nameAsGivenIn = null;
this.fileTypeIn = null;
this.atomSetCollection = null;
this.readerOrDocument = null;
this.htParams = null;
this.isAppend = false;
this.bytesOrStream = null;
Clazz_instantialize(this, arguments);}, J.io, "FileReader", null);
Clazz_makeConstructor(c$, 
function(vwr, fileName, fullPathName, nameAsGiven, type, reader, htParams, isAppend){
this.vwr = vwr;
this.fileNameIn = (fileName == null ? fullPathName : fileName);
this.fullPathNameIn = (fullPathName == null ? this.fileNameIn : fullPathName);
this.nameAsGivenIn = (nameAsGiven == null ? this.fileNameIn : nameAsGiven);
this.fileTypeIn = type;
if (reader != null) {
if (JU.AU.isAB(reader) || Clazz_instanceOf(reader,"java.io.BufferedInputStream")) {
this.bytesOrStream = reader;
reader = null;
} else if (Clazz_instanceOf(reader,"java.io.Reader") && !(Clazz_instanceOf(reader,"java.io.BufferedReader"))) {
reader =  new java.io.BufferedReader(reader);
}}this.readerOrDocument = reader;
this.htParams = htParams;
this.isAppend = isAppend;
}, "JV.Viewer,~S,~S,~S,~S,~O,java.util.Map,~B");
Clazz_defineMethod(c$, "run", 
function(){
if (!this.isAppend && this.vwr.displayLoadErrors) this.vwr.zap(false, true, false);
var errorMessage = null;
var t = null;
if (this.fullPathNameIn.contains("#_DOCACHE_")) this.readerOrDocument = J.io.FileReader.getChangeableReader(this.vwr, this.nameAsGivenIn, this.fullPathNameIn);
if (this.readerOrDocument == null) {
t = this.vwr.fm.getUnzippedReaderOrStreamFromName(this.fullPathNameIn, this.bytesOrStream, true, false, false, true, this.htParams);
if (t == null || (typeof(t)=='string')) {
errorMessage = (t == null ? "error opening:" + this.nameAsGivenIn : t);
if (!errorMessage.startsWith("NOTE:")) JU.Logger.error("file ERROR: " + this.fullPathNameIn + "\n" + errorMessage);
this.atomSetCollection = errorMessage;
return;
}if (Clazz_instanceOf(t,"java.io.BufferedReader")) {
this.readerOrDocument = t;
} else if (Clazz_instanceOf(t,"javajs.api.ZInputStream")) {
var name = this.fullPathNameIn;
var subFileList = null;
name = name.$replace('\\', '/');
if (name.indexOf("|") >= 0 && !name.endsWith(".zip")) {
subFileList = JU.PT.split(name, "|");
name = subFileList[0];
}if (subFileList != null) this.htParams.put("subFileList", subFileList);
var zis = t;
var zipDirectory = this.vwr.fm.getZipDirectory(name, true, true);
this.atomSetCollection = t = this.vwr.fm.getJzu().getAtomSetCollectionOrBufferedReaderFromZip(this.vwr, zis, name, zipDirectory, this.htParams, 1, false);
try {
zis.close();
} catch (e) {
if (Clazz_exceptionOf(e, Exception)){
} else {
throw e;
}
}
}}if (Clazz_instanceOf(t,"java.io.BufferedInputStream")) this.readerOrDocument = (J.api.Interface.getInterface("JU.BinaryDocument", this.vwr, "file")).setStream(t, !this.htParams.containsKey("isLittleEndian"));
if (this.readerOrDocument != null) {
this.atomSetCollection = this.vwr.getModelAdapter().getAtomSetCollectionReader(this.fullPathNameIn, this.fileTypeIn, this.readerOrDocument, this.htParams);
if (!((typeof(this.atomSetCollection)=='string'))) this.atomSetCollection = this.vwr.getModelAdapter().getAtomSetCollection(this.atomSetCollection);
try {
if (Clazz_instanceOf(this.readerOrDocument,"java.io.BufferedReader")) (this.readerOrDocument).close();
 else if (Clazz_instanceOf(this.readerOrDocument,"javajs.api.GenericBinaryDocument")) (this.readerOrDocument).close();
} catch (e) {
if (Clazz_exceptionOf(e,"java.io.IOException")){
} else {
throw e;
}
}
}if ((typeof(this.atomSetCollection)=='string')) return;
if (!this.isAppend && !this.vwr.displayLoadErrors) this.vwr.zap(false, true, false);
this.vwr.fm.setFileInfo( Clazz_newArray(-1, [this.fullPathNameIn, this.fileNameIn, this.nameAsGivenIn]));
});
c$.getChangeableReader = Clazz_defineMethod(c$, "getChangeableReader", 
function(vwr, nameAsGivenIn, fullPathNameIn){
return JU.Rdr.getBR(vwr.getLigandModel(nameAsGivenIn, fullPathNameIn, "_file", null));
}, "JV.Viewer,~S,~S");
Clazz_defineMethod(c$, "getAtomSetCollection", 
function(){
return this.atomSetCollection;
});
});
;//5.0.1-v7 Mon Aug 24 10:01:38 CDT 2026
Clazz_declarePackage("J.render");
Clazz_load(["J.render.CageRenderer", "JU.P3"], "J.render.AxesRenderer", ["JV.JC"], function(){
var c$ = Clazz_decorateAsClass(function(){
this.originScreen = null;
this.colixes = null;
this.pt000 = null;
this.modelIndex = 0;
this.isDataSpin = false;
this.ptTemp = null;
Clazz_instantialize(this, arguments);}, J.render, "AxesRenderer", J.render.CageRenderer);
Clazz_prepareFields (c$, function(){
this.originScreen =  new JU.P3();
this.colixes =  Clazz_newShortArray (3, 0);
this.ptTemp =  new JU.P3();
});
Clazz_overrideMethod(c$, "initRenderer", 
function(){
this.endcap = 2;
this.draw000 = false;
});
Clazz_overrideMethod(c$, "render", 
function(){
if (this.vwr.ms !== this.ms) return false;
var axes = this.shape;
var mad10 = this.vwr.getObjectMad10(1);
var isXY = (axes.axisXY.z != 0);
if (mad10 == 0 || !this.g3d.checkTranslucent(false)) return false;
if (isXY ? this.exportType == 1 : this.tm.isNavigating() && this.vwr.getBoolean(603979890)) return false;
this.modelIndex = this.vwr.am.cmi;
var m = null;
this.isDataSpin = false;
var isUnitCell = (this.vwr.g.axesMode == 603979808);
if (this.ms.isJmolDataFrame(this.modelIndex)) {
switch (this.ms.getJmolFrameTypeInt(this.modelIndex)) {
case 1095241729:
m = this.ms.am[this.modelIndex];
this.isDataSpin = (m.uvw != null);
isUnitCell = true;
break;
case 134221834:
break;
default:
return false;
}
}var unitcell = (isUnitCell ? this.vwr.getCurrentUnitCell() : null);
if (!this.isDataSpin && isUnitCell && (unitcell == null || this.modelIndex < 0)) return false;
this.imageFontScaling = this.vwr.imageFontScaling;
if (!this.isDataSpin && this.vwr.areAxesTainted()) axes.reinitShape();
this.font3d = this.vwr.gdata.getFont3DScaled(axes.font3d, this.imageFontScaling);
isUnitCell = isUnitCell && (unitcell != null);
var axisType = (isUnitCell ? axes.axisType : null);
var isabcxyz = (isXY && isUnitCell && axes.axes2 != null);
this.isPolymer = isUnitCell && unitcell.isPolymer();
this.isSlab = isUnitCell && unitcell.isSlab();
this.nDims = (isUnitCell ? unitcell.getDimensionality() : 3);
this.periodicity = (isUnitCell ? unitcell.getPeriodicity() : 0x7);
this.setShifts();
var scale = axes.scale;
if (isabcxyz) {
if ("xyzabc".equals(axes.axes2)) this.render1(axes, mad10, false, axisType, isUnitCell, 2, null, null);
if (!"abc".equals(axes.axes2)) this.vwr.setBooleanProperty("axesmolecular", true);
axes.reinitShape();
this.render1(axes, mad10, true, null, false, scale, axes.axes2, null);
this.vwr.setBooleanProperty("axesunitcell", true);
} else if (this.isDataSpin) {
this.pt0.set(0, 0, 0);
this.render1(null, 25000, false, null, true, 1, null, m.uvw);
} else {
this.render1(axes, mad10, isXY, axisType, isUnitCell, scale, null, null);
}return true;
});
Clazz_defineMethod(c$, "render1", 
function(axes, mad10, isXY, axisType, isUnitCell, scale, labels2, pts){
var isDataFrame = this.vwr.isJmolDataFrame();
this.pt000 = (isDataFrame ? this.pt0 : axes.originPoint);
var nPoints = 6;
var labelPtr = 0;
if (isUnitCell) {
nPoints = 3;
labelPtr = (this.isDataSpin ? 21 : 6);
} else if (isXY) {
nPoints = 3;
labelPtr = 9;
} else if (this.vwr.g.axesMode == 603979809) {
nPoints = 6;
labelPtr = (this.vwr.getBoolean(603979806) ? 15 : 9);
}if (axes != null && axes.labels != null) {
if (nPoints != 3) nPoints = (axes.labels.length < 6 ? 3 : 6);
labelPtr = -1;
}var slab = this.vwr.gdata.slab;
var diameter = mad10;
var drawTicks = false;
this.ptTemp.setT(this.originScreen);
var checkAxisType = (labels2 == null && axisType != null && (isXY || this.vwr.getFloat(570425345) != 0 || axes.fixedOrigin != null));
if (isXY) {
if (mad10 >= 20) {
diameter = (mad10 > 500 ? 3 : Clazz_doubleToInt(mad10 / 200));
if (diameter == 0) diameter = 2;
}if (this.g3d.isAntialiased()) diameter += diameter;
this.g3d.setSlab(0);
this.ptTemp.setT(axes.axisXY);
this.pt0i.setT(this.tm.transformPt2D(this.ptTemp));
if (this.ptTemp.x < 0) {
var offx = Clazz_floatToInt(this.ptTemp.x);
var offy = Clazz_floatToInt(this.ptTemp.x);
this.pointT.setT(this.pt000);
for (var i = 0; i < 3; i++) this.pointT.add(axes.getAxisPoint(i, false, this.ptTemp));

this.pt0i.setT(this.tm.transformPt(this.pt000));
this.pt2i.scaleAdd(-1, this.pt0i, this.tm.transformPt(this.pointT));
if (this.pt2i.x < 0) offx = -offx;
if (this.pt2i.y < 0) offy = -offy;
this.pt0i.x += offx;
this.pt0i.y += offy;
}this.ptTemp.set(this.pt0i.x, this.pt0i.y, this.pt0i.z);
var zoomDimension = this.vwr.getScreenDim();
var scaleFactor = zoomDimension / 10 * scale;
if (this.g3d.isAntialiased()) scaleFactor *= 2;
if ((isUnitCell || "abc".equals(axes.axes2)) && isXY) scaleFactor /= 2;
for (var i = 0; i < 3; i++) {
var pt = this.p3Screens[i];
this.tm.rotatePoint(axes.getAxisPoint(i, false, this.pointT), pt);
pt.z *= -1;
pt.scaleAdd2(scaleFactor, pt, this.ptTemp);
}
} else {
drawTicks = (axes != null && axes.tickInfos != null);
if (drawTicks) {
this.checkTickTemps();
this.tickA.setT(this.pt000);
}this.tm.transformPtNoClip(this.pt000, this.ptTemp);
diameter = this.getDiameter(Clazz_floatToInt(this.ptTemp.z), mad10);
for (var i = nPoints; --i >= 0; ) {
var p = (pts == null ? axes.getAxisPoint(i, !isDataFrame, this.pointT) : pts[i]);
this.tm.transformPtNoClip(p, this.p3Screens[i]);
}
if (this.shifting) {
if (this.vvert == null) {
this.vvert =  Clazz_newArray(-1, [ new JU.P3(),  new JU.P3(),  new JU.P3(),  new JU.P3(),  new JU.P3(),  new JU.P3()]);
}if (this.shiftA) {
this.setVVert(axes, 0);
}if (this.shiftB) {
this.setVVert(axes, 1);
}if (this.shiftC) {
this.setVVert(axes, 2);
}}}var xCenter = this.ptTemp.x;
var yCenter = this.ptTemp.y;
this.colixes[0] = this.vwr.getObjectColix(1);
this.colixes[1] = this.vwr.getObjectColix(2);
this.colixes[2] = this.vwr.getObjectColix(3);
var showOrigin = (this.nDims == 3 && !isXY && nPoints == 3 && (scale == 2 || isUnitCell && !this.isDataSpin));
if (this.nDims == 2) nPoints = 2;
for (var i = nPoints; --i >= 0; ) {
if (labels2 != null && i >= labels2.length || checkAxisType && !axisType.contains(JV.JC.axesTypes[i]) || this.exportType != 1 && (Math.abs(xCenter - this.p3Screens[i].x) + Math.abs(yCenter - this.p3Screens[i].y) <= 2) && (!(showOrigin = false))) {
continue;
}this.colix = this.colixes[i % 3];
this.g3d.setC(this.colix);
var label = (labels2 != null ? labels2.substring(i, i + 1) : axes == null || axes.labels == null ? JV.JC.axisLabels[i + labelPtr] : i < axes.labels.length ? axes.labels[i] : null);
if (label != null && label.length > 0) {
var p = (i == 0 && this.shiftA ? this.vvert[1] : i == 1 && this.shiftB ? this.vvert[3] : i == 2 && this.shiftC ? this.vvert[5] : this.p3Screens[i]);
this.renderLabel(label, p.x, p.y, p.z, xCenter, yCenter);
}if (drawTicks) {
this.tickInfo = axes.tickInfos[(i % 3) + 1];
if (this.tickInfo == null) this.tickInfo = axes.tickInfos[0];
if (this.tickInfo != null) {
this.tickB.setT(axes.getAxisPoint(i, isDataFrame || isUnitCell, this.pointT));
this.tickInfo.first = 0;
this.tickInfo.signFactor = (i % 6 >= 3 ? -1 : 1);
}}var d = (this.isSlab && i == 2 || this.isPolymer && i > 0 ? -4 : diameter);
var p1 = this.ptTemp;
var p2 = this.p3Screens[i];
if (i == 2 && this.shiftC) {
p1 = this.vvert[4];
p2 = this.vvert[5];
} else if (i == 1 && this.shiftB) {
p1 = this.vvert[2];
p2 = this.vvert[3];
} else if (i == 0 && this.shiftA) {
p1 = this.vvert[0];
p2 = this.vvert[1];
}this.renderLine(p1, p2, d, drawTicks && this.tickInfo != null);
}
if (showOrigin) {
var label0 = (axes.labels == null || axes.labels.length == 3 || axes.labels[3] == null ? "0" : axes.labels[3]);
if (label0 != null && label0.length != 0) {
this.colix = this.vwr.cm.colixBackgroundContrast;
this.g3d.setC(this.colix);
this.renderLabel(label0, xCenter, yCenter, this.ptTemp.z, xCenter, yCenter);
}}if (isXY) this.g3d.setSlab(slab);
}, "J.shape.Axes,~N,~B,~S,~B,~N,~S,~A");
Clazz_defineMethod(c$, "setVVert", 
function(axes, i){
var vpt = i * 2;
this.vvert[vpt].setT(axes.originPoint);
axes.getAxisPoint(i, false, this.pt);
this.vvert[vpt].sub(this.pt);
this.pt.add(axes.originPoint);
this.tm.transformPtNoClip(this.vvert[vpt], this.vvert[vpt]);
this.tm.transformPtNoClip(this.pt, this.vvert[vpt + 1]);
}, "J.shape.Axes,~N");
Clazz_defineMethod(c$, "renderLabel", 
function(str, x, y, z, xCenter, yCenter){
var strAscent = this.font3d.getAscent();
var strWidth = this.font3d.stringWidth(str);
var dx = x - xCenter;
var dy = y - yCenter;
if ((dx != 0 || dy != 0)) {
var dist = Math.sqrt(dx * dx + dy * dy);
dx = (strWidth * 0.75 * dx / dist);
dy = (strAscent * 0.75 * dy / dist);
x += dx;
y += dy;
}var xStrBaseline = Math.floor(x - strWidth / 2);
var yStrBaseline = Math.floor(y + strAscent / 2);
this.g3d.drawString(str, this.font3d, Clazz_doubleToInt(xStrBaseline), Clazz_doubleToInt(yStrBaseline), Clazz_floatToInt(z), Clazz_floatToInt(z), 0);
}, "~S,~N,~N,~N,~N,~N");
});
;//5.0.1-v7 Mon Aug 24 10:19:01 CDT 2026
Clazz_declarePackage("J.render");
Clazz_load(["J.render.ShapeRenderer"], "J.render.BallsRenderer", ["J.shape.Shape"], function(){
var c$ = Clazz_declareType(J.render, "BallsRenderer", J.render.ShapeRenderer);
Clazz_overrideMethod(c$, "render", 
function(){
var needTranslucent = false;
if (this.isExport || this.vwr.checkMotionRendering(1153433601)) {
var atoms = this.ms.at;
var colixes = (this.shape).colixes;
var bsOK = this.vwr.shm.bsRenderableAtoms;
for (var i = bsOK.nextSetBit(0); i >= 0; i = bsOK.nextSetBit(i + 1)) {
var atom = atoms[i];
if (atom.sD > 0 && (atom.shapeVisibilityFlags & this.myVisibilityFlag) != 0) {
if (this.g3d.setC(colixes == null ? atom.colixAtom : J.shape.Shape.getColix(colixes, i, atom))) {
this.g3d.drawAtom(atom, 0);
} else {
needTranslucent = true;
}}}
}return needTranslucent;
});
});
;//5.0.1-v7 Mon Aug 24 10:01:38 CDT 2026
Clazz_declarePackage("J.render");
Clazz_load(["J.render.FontLineShapeRenderer", "JU.P3"], "J.render.CageRenderer", ["JU.BS", "$.Measure", "JU.BoxInfo"], function(){
var c$ = Clazz_decorateAsClass(function(){
this.p3Screens = null;
this.tickEdges = null;
this.isSlab = false;
this.isPolymer = false;
this.periodicity = 0x7;
this.nDims = 3;
this.bsPeriod = null;
this.pt = null;
this.vvert = null;
this.shiftA = false;
this.shiftB = false;
this.shiftC = false;
this.shifting = false;
Clazz_instantialize(this, arguments);}, J.render, "CageRenderer", J.render.FontLineShapeRenderer);
Clazz_prepareFields (c$, function(){
this.p3Screens =  new Array(8);
{
for (var i = 8; --i >= 0; ) this.p3Screens[i] =  new JU.P3();

}this.pt =  new JU.P3();
});
Clazz_defineMethod(c$, "setPeriodicity", 
function(vertices, scale){
}, "~A,~N");
Clazz_defineMethod(c$, "renderCage", 
function(mad, vertices, faces, axisPoints, firstLine, allowedEdges0, allowedEdges1, scale){
this.g3d.setC(this.colix);
var fls = this.shape;
var hiddenLines = (faces != null);
this.imageFontScaling = this.vwr.imageFontScaling;
this.font3d = this.vwr.gdata.getFont3DScaled(fls.font3d, this.imageFontScaling);
var zSum = 0;
for (var i = 8; --i >= 0; ) {
this.pt.setT(vertices[i]);
if (scale != 1) {
this.pt.sub(vertices[0]);
this.pt.scaleAdd2(scale, this.pt, vertices[0]);
}this.tm.transformPtNoClip(this.pt, this.p3Screens[i]);
zSum += this.p3Screens[i].z;
}
this.setPeriodicity(vertices, scale);
var bsSolid = null;
if (hiddenLines) {
bsSolid =  new JU.BS();
for (var i = 12; --i >= 0; ) {
var face = faces[i];
JU.Measure.getNormalThroughPoints(this.p3Screens[face[0]], this.p3Screens[face[1]], this.p3Screens[face[2]], this.pt1, this.pt);
if (this.pt1.z <= 0) {
bsSolid.set(face[0]);
bsSolid.set(face[1]);
bsSolid.set(face[2]);
}}
}var diameter = this.getDiameter(Clazz_doubleToInt(Math.floor(zSum / 8)), mad);
var axisPt = 2;
var edge = String.fromCharCode(0);
allowedEdges0 &= (this.isPolymer ? 0x1 : this.isSlab ? 0x55 : 0xFF);
allowedEdges1 &= (this.isPolymer ? 0x10 : this.isSlab ? 0x55 : 0xFF);
this.setBSPeriod();
for (var i = firstLine * 2; i < 24; i += 2) {
if (this.bsPeriod != null && !this.bsPeriod.get(i)) continue;
var d = diameter;
var edge0 = JU.BoxInfo.edges[i];
var edge1 = JU.BoxInfo.edges[i + 1];
if (hiddenLines && (!bsSolid.get(edge0) || !bsSolid.get(edge1))) d = -Math.abs(diameter);
if (axisPoints != null && edge0 == 0) this.tm.transformPtNoClip(axisPoints[axisPt--], this.p3Screens[0]);
if ((allowedEdges0 & (1 << edge0)) == 0 || (allowedEdges1 & (1 << edge1)) == 0) continue;
var drawTicks = (fls.tickInfos != null && (edge = this.tickEdges[i >> 1]).charCodeAt(0) != 0);
if (drawTicks) {
this.checkTickTemps();
this.tickA.setT(vertices[edge0]);
this.tickB.setT(vertices[edge1]);
var start = 0;
if (Clazz_instanceOf(this.shape,"J.shape.Bbcage")) switch ((edge).charCodeAt(0)) {
case 120:
start = this.tickA.x;
break;
case 121:
start = this.tickA.y;
break;
case 122:
start = this.tickA.z;
break;
}
this.tickInfo = fls.tickInfos["xyz".indexOf(edge) + 1];
if (this.tickInfo == null) this.tickInfo = fls.tickInfos[0];
if (this.tickInfo == null) drawTicks = false;
 else this.tickInfo.first = start;
}this.renderCageLine(i, edge0, edge1, d, drawTicks);
}
}, "~N,~A,~A,~A,~N,~N,~N,~N");
Clazz_defineMethod(c$, "renderCageLine", 
function(i, edge0, edge1, d, drawTicks){
var p1 = this.p3Screens[edge0];
var p2 = this.p3Screens[edge1];
this.renderLine(p1, p2, d, drawTicks);
}, "~N,~N,~N,~N,~B");
Clazz_defineMethod(c$, "setBSPeriod", 
function(){
});
Clazz_defineMethod(c$, "setShifts", 
function(){
this.shiftA = ((this.periodicity & 0x1) == 0);
this.shiftB = ((this.periodicity & 0x2) == 0);
this.shiftC = ((this.periodicity & 0x4) == 0);
this.shifting = (this.shiftA || this.shiftB || this.shiftC);
});
});
;//5.0.1-v7 Mon Aug 24 10:01:38 CDT 2026
Clazz_declarePackage("J.render");
Clazz_load(["J.render.ShapeRenderer", "JU.P3", "$.P3i", "$.V3"], "J.render.FontLineShapeRenderer", ["JU.PT"], function(){
var c$ = Clazz_decorateAsClass(function(){
this.colixA = 0;
this.colixB = 0;
this.dotsOrDashes = false;
this.dashDots = null;
this.asLineOnly = false;
this.imageFontScaling = 0;
this.tickA = null;
this.tickB = null;
this.tickAs = null;
this.tickBs = null;
this.font3d = null;
this.pt0i = null;
this.pt2i = null;
this.s1 = null;
this.s2 = null;
this.pointT = null;
this.pointT2 = null;
this.pointT3 = null;
this.vectorT = null;
this.vectorT2 = null;
this.vectorT3 = null;
this.tickInfo = null;
this.draw000 = true;
this.width = 0;
this.endcap = 3;
this.pt0 = null;
this.pt1 = null;
Clazz_instantialize(this, arguments);}, J.render, "FontLineShapeRenderer", J.render.ShapeRenderer);
Clazz_prepareFields (c$, function(){
this.pt0i =  new JU.P3i();
this.pt2i =  new JU.P3i();
this.s1 =  new JU.P3i();
this.s2 =  new JU.P3i();
this.pointT =  new JU.P3();
this.pointT2 =  new JU.P3();
this.pointT3 =  new JU.P3();
this.vectorT =  new JU.V3();
this.vectorT2 =  new JU.V3();
this.vectorT3 =  new JU.V3();
this.pt0 =  new JU.P3();
this.pt1 =  new JU.P3();
});
Clazz_defineMethod(c$, "getDiameter", 
function(z, mad10OrPixels){
var diameter;
var isMad10 = (mad10OrPixels > 20);
switch (this.exportType) {
case 1:
diameter = (isMad10 ? mad10OrPixels : Clazz_doubleToInt(Math.floor(this.vwr.tm.unscaleToScreen(z, mad10OrPixels * 2 / 10) * 1000)));
break;
default:
if (isMad10) {
diameter = Clazz_floatToInt(this.vwr.tm.scaleToScreen(z, Clazz_doubleToInt(mad10OrPixels / 10)));
} else {
if (this.g3d.isAntialiased()) mad10OrPixels += mad10OrPixels;
diameter = mad10OrPixels;
}}
return diameter;
}, "~N,~N");
Clazz_defineMethod(c$, "renderLine", 
function(p0, p1, diameter, drawTicks){
if (diameter < 0) this.g3d.drawDashedLineBits(8, 4, p0, p1);
 else this.g3d.fillCylinderBits(this.endcap, (this.exportType == 1 ? -diameter : diameter), p0, p1);
if (!drawTicks || this.tickInfo == null) return;
this.checkTickTemps();
this.tickAs.setT(p0);
this.tickBs.setT(p1);
this.drawTicks(diameter, true);
}, "JU.P3,JU.P3,~N,~B");
Clazz_defineMethod(c$, "checkTickTemps", 
function(){
if (this.tickA == null) {
this.tickA =  new JU.P3();
this.tickB =  new JU.P3();
this.tickAs =  new JU.P3();
this.tickBs =  new JU.P3();
}});
Clazz_defineMethod(c$, "drawTicks", 
function(diameter, withLabels){
if (Float.isNaN(this.tickInfo.first)) this.tickInfo.first = 0;
this.drawTicks2(this.tickInfo.ticks.x, 8, diameter, (!withLabels ? null : this.tickInfo.tickLabelFormats == null ?  Clazz_newArray(-1, ["%0.2f"]) : this.tickInfo.tickLabelFormats));
this.drawTicks2(this.tickInfo.ticks.y, 4, diameter, null);
this.drawTicks2(this.tickInfo.ticks.z, 2, diameter, null);
}, "~N,~B");
Clazz_defineMethod(c$, "drawTicks2", 
function(dx, length, diameter, formats){
if (dx == 0) return;
if (this.g3d.isAntialiased()) length *= 2;
this.vectorT2.set(this.tickBs.x, this.tickBs.y, 0);
this.vectorT.set(this.tickAs.x, this.tickAs.y, 0);
this.vectorT2.sub(this.vectorT);
if (this.vectorT2.length() < 50) return;
var signFactor = this.tickInfo.signFactor;
this.vectorT.sub2(this.tickB, this.tickA);
var d0 = this.vectorT.length();
if (this.tickInfo.scale != null) {
if (Float.isNaN(this.tickInfo.scale.x)) {
var a = this.vwr.getUnitCellInfo(0);
if (!Float.isNaN(a)) this.vectorT.set(this.vectorT.x / a, this.vectorT.y / this.vwr.getUnitCellInfo(1), this.vectorT.z / this.vwr.getUnitCellInfo(2));
} else {
this.vectorT.set(this.vectorT.x * this.tickInfo.scale.x, this.vectorT.y * this.tickInfo.scale.y, this.vectorT.z * this.tickInfo.scale.z);
}}var d = this.vectorT.length() + 0.0001 * dx;
if (d < dx) return;
var f = dx / d * d0 / d;
this.vectorT.scale(f);
var dz = (this.tickBs.z - this.tickAs.z) / (d / dx);
d += this.tickInfo.first;
var p = (Clazz_doubleToInt(Math.floor(this.tickInfo.first / dx))) * dx - this.tickInfo.first;
this.pointT.scaleAdd2(p / dx, this.vectorT, this.tickA);
p += this.tickInfo.first;
var z = this.tickAs.z;
if (diameter < 0) diameter = 1;
this.vectorT2.set(-this.vectorT2.y, this.vectorT2.x, 0);
this.vectorT2.scale(length / this.vectorT2.length());
var ptRef = this.tickInfo.reference;
if (ptRef == null) {
this.pointT3.setT(this.vwr.getBoundBoxCenter());
if (this.vwr.g.axesMode == 603979809) {
this.pointT3.add3(1, 1, 1);
}} else {
this.pointT3.setT(ptRef);
}this.tm.transformPtScr(this.pointT3, this.pt2i);
var horizontal = (Math.abs(this.vectorT2.x / this.vectorT2.y) < 0.2);
var centerX = horizontal;
var centerY = !horizontal;
var rightJustify = !centerX && (this.vectorT2.x < 0);
var drawLabel = (formats != null && formats.length > 0);
var x;
var y;
var val =  new Array(1);
var i = (this.draw000 ? 0 : -1);
while (p < d) {
if (p >= this.tickInfo.first) {
this.pointT2.setT(this.pointT);
this.tm.transformPt3f(this.pointT2, this.pointT2);
this.drawLine(Clazz_doubleToInt(Math.floor(this.pointT2.x)), Clazz_doubleToInt(Math.floor(this.pointT2.y)), Clazz_floatToInt(z), (x = Clazz_doubleToInt(Math.floor(this.pointT2.x + this.vectorT2.x))), (y = Clazz_doubleToInt(Math.floor(this.pointT2.y + this.vectorT2.y))), Clazz_floatToInt(z), diameter);
if (drawLabel && (this.draw000 || p != 0)) {
val[0] = Float.$valueOf((p == 0 ? 0 : p * signFactor));
var s = JU.PT.sprintf(formats[i % formats.length], "f", val);
this.drawString(x, y, Clazz_floatToInt(z), 4, rightJustify, centerX, centerY, Clazz_doubleToInt(Math.floor(this.pointT2.y)), s);
}}this.pointT.add(this.vectorT);
p += dx;
z += dz;
i++;
}
}, "~N,~N,~N,~A");
Clazz_defineMethod(c$, "drawLine", 
function(x1, y1, z1, x2, y2, z2, diameter){
return this.drawLine2(this.g3d, x1, y1, z1, x2, y2, z2, diameter);
}, "~N,~N,~N,~N,~N,~N,~N");
Clazz_defineMethod(c$, "drawLine2", 
function(g3d, x1, y1, z1, x2, y2, z2, diameter){
this.pt0.set(x1, y1, z1);
this.pt1.set(x2, y2, z2);
if (!this.dotsOrDashes) {
if (diameter < 0) {
g3d.drawDashedLineBits(8, 4, this.pt0, this.pt1);
return 1;
}g3d.fillCylinderBits(2, diameter, this.pt0, this.pt1);
} else if (this.dashDots != null) {
var renderD = (!this.isExport || this.mad == 1 ? this.width : this.mad);
J.render.FontLineShapeRenderer.drawDashedCylinder(g3d, x1, y1, z1, x2, y2, z2, this.dashDots, this.width, this.colixA, this.colixB, renderD, this.asLineOnly, this.s1);
}return Clazz_doubleToInt((diameter + 1) / 2);
}, "J.api.JmolRendererInterface,~N,~N,~N,~N,~N,~N,~N");
Clazz_defineMethod(c$, "drawString", 
function(x, y, z, radius, rightJustify, centerX, centerY, yRef, sVal){
if (sVal == null) return;
var width = this.font3d.stringWidth(sVal);
var height = this.font3d.getAscent();
var xT = x;
if (rightJustify) xT -= Clazz_doubleToInt(radius / 2) + 2 + width;
 else if (centerX) xT -= Clazz_doubleToInt(radius / 2) + 2 + Clazz_doubleToInt(width / 2);
 else xT += Clazz_doubleToInt(radius / 2) + 2;
var yT = y;
if (centerY) yT += Clazz_doubleToInt(height / 2);
 else if (yRef == 0 || yRef < y) yT += height;
 else yT -= Clazz_doubleToInt(radius / 2);
var zT = z - radius - 2;
if (zT < 1) zT = 1;
this.g3d.drawString(sVal, this.font3d, xT, yT, zT, zT, 0);
}, "~N,~N,~N,~N,~B,~B,~B,~N,~S");
c$.drawDashedCylinder = Clazz_defineMethod(c$, "drawDashedCylinder", 
function(g3d, xA, yA, zA, xB, yB, zB, array, width, colixA, colixB, renderD, asLineOnly, s1){
if (array == null || width < 0) return;
var f = array[0];
var dx = xB - xA;
var dy = yB - yA;
var dz = zB - zA;
var n = 0;
var isNdots = (array === J.render.FontLineShapeRenderer.ndots);
var isDots = (isNdots || array === J.render.FontLineShapeRenderer.sixdots);
if (isDots) {
if (s1 == null) s1 =  new JU.P3i();
var d2 = (dx * dx + dy * dy) / (width * width);
if (isNdots) {
f = (Math.sqrt(d2) / 1.5);
n = Clazz_floatToInt(f) + 2;
} else if (d2 < 8) {
array = J.render.FontLineShapeRenderer.twodots;
} else if (d2 < 32) {
array = J.render.FontLineShapeRenderer.fourdots;
}}var ptS = array[1];
var ptE = array[2];
var colixS = colixA;
var colixE = (ptE == 0 ? colixB : colixA);
if (n == 0) n = array.length;
for (var i = 0, pt = 3; pt < n; pt++) {
i = (isNdots ? i + 1 : array[pt]);
var xS = Clazz_doubleToInt(Math.floor(xA + dx * i / f));
var yS = Clazz_doubleToInt(Math.floor(yA + dy * i / f));
var zS = Clazz_doubleToInt(Math.floor(zA + dz * i / f));
if (isDots) {
s1.set(xS, yS, zS);
if (pt == ptS) g3d.setC(colixA);
 else if (pt == ptE) g3d.setC(colixB);
g3d.fillSphereI(width, s1);
continue;
}if (pt == ptS) colixS = colixB;
i = array[++pt];
if (pt == ptE) colixE = colixB;
var xE = Clazz_doubleToInt(Math.floor(xA + dx * i / f));
var yE = Clazz_doubleToInt(Math.floor(yA + dy * i / f));
var zE = Clazz_doubleToInt(Math.floor(zA + dz * i / f));
J.render.FontLineShapeRenderer.fillCylinder(g3d, colixS, colixE, 2, xS, yS, zS, xE, yE, zE, renderD, asLineOnly);
}
}, "J.api.JmolRendererInterface,~N,~N,~N,~N,~N,~N,~A,~N,~N,~N,~N,~B,JU.P3i");
c$.fillCylinder = Clazz_defineMethod(c$, "fillCylinder", 
function(g3d, colixA, colixB, endcaps, xA, yA, zA, xB, yB, zB, diameter, asLineOnly){
if (asLineOnly) g3d.drawLine(colixA, colixB, xA, yA, zA, xB, yB, zB);
 else g3d.fillCylinderXYZ(colixA, colixB, endcaps, diameter, xA, yA, zA, xB, yB, zB);
}, "J.api.JmolRendererInterface,~N,~N,~N,~N,~N,~N,~N,~N,~N,~N,~B");
c$.dashes =  Clazz_newIntArray(-1, [12, 0, 0, 2, 5, 7, 10]);
c$.hDashes =  Clazz_newIntArray(-1, [10, 7, 6, 1, 3, 4, 6, 7, 9]);
c$.pymoldashes =  Clazz_newIntArray(-1, [30, 0, 0, 2, 4, 7, 9, 12, 14, 17, 19, 22, 24, 27, 30]);
c$.ndots =  Clazz_newIntArray(-1, [0, 3, 1000]);
c$.sixdots =  Clazz_newIntArray(-1, [12, 3, 6, 1, 3, 5, 7, 9, 11]);
c$.fourdots =  Clazz_newIntArray(-1, [13, 3, 5, 2, 5, 8, 11]);
c$.twodots =  Clazz_newIntArray(-1, [12, 3, 4, 3, 9]);
});
;//5.0.1-v7 Mon Aug 24 10:01:38 CDT 2026
Clazz_declarePackage("J.render");
Clazz_load(["J.render.ShapeRenderer"], "J.render.FrankRenderer", ["J.shape.Frank", "JV.Viewer"], function(){
var c$ = Clazz_declareType(J.render, "FrankRenderer", J.render.ShapeRenderer);
Clazz_overrideMethod(c$, "render", 
function(){
if (this.isExport || !this.vwr.getShowFrank() || !this.g3d.setC(this.colix) || this.vwr.frankOn && !this.vwr.noFrankEcho || this.vwr.tm.splitFrameCurrentlyRendering == 0) return false;
var frank = this.shape;
var allowKeys = this.vwr.getBooleanProperty("allowKeyStrokes");
var modelKitMode = this.vwr.getBoolean(603983903);
this.colix = (modelKitMode && !this.vwr.getModelkit(false).isHidden() ? 20 : this.vwr.isSignedApplet ? (allowKeys || (JV.Viewer.isJS || JV.Viewer.isSwingJS) && !this.vwr.isWebGL ? 5 : 10) : allowKeys ? 7 : 12);
if (this.colix == this.vwr.getObjectColix(0)) this.colix = 4;
this.vwr.noFrankEcho = true;
var imageFontScaling = this.vwr.imageFontScaling;
frank.getFont(imageFontScaling);
var dx = Clazz_floatToInt(frank.frankWidth + 4 * imageFontScaling);
var dy = frank.frankDescent;
this.g3d.drawStringNoSlab(J.shape.Frank.frankString, frank.font3d, this.vwr.gdata.width - dx, this.vwr.gdata.height - dy, 0, 0);
var kit = (modelKitMode ? this.vwr.getModelkit(false) : null);
if (modelKitMode && !kit.isHidden()) {
this.g3d.setC(12);
var w = 10;
var h = 26;
this.g3d.fillTextRect(0, 0, 1, 0, w, h * 4);
var active = kit.getActiveMenu();
if (active != null) {
if ("atomMenu".equals(active)) {
this.g3d.setC(21);
this.g3d.fillTextRect(0, 0, 0, 0, w, h);
} else if ("bondMenu".equals(active)) {
this.g3d.setC(7);
this.g3d.fillTextRect(0, h, 0, 0, w, h);
} else if ("xtalMenu".equals(active)) {
this.g3d.setC(8);
this.g3d.fillTextRect(0, h << 1, 0, 0, w, h);
}}}return false;
});
});
;//5.0.1-v7 Mon Aug 24 10:01:38 CDT 2026
Clazz_declarePackage("J.render");
Clazz_load(["J.api.JmolRepaintManager", "JU.BS"], "J.render.RepaintManager", ["J.api.Interface", "JU.Logger", "JV.JC", "$.Viewer"], function(){
var c$ = Clazz_decorateAsClass(function(){
this.vwr = null;
this.shapeManager = null;
this.renderers = null;
this.bsTranslucent = null;
this.holdRepaint = 0;
this.repaintPending = false;
Clazz_instantialize(this, arguments);}, J.render, "RepaintManager", null, J.api.JmolRepaintManager);
Clazz_prepareFields (c$, function(){
this.bsTranslucent = JU.BS.newN(37);
});
Clazz_makeConstructor(c$, 
function(){
});
Clazz_overrideMethod(c$, "set", 
function(vwr, shapeManager){
this.vwr = vwr;
this.shapeManager = shapeManager;
}, "JV.Viewer,JV.ShapeManager");
Clazz_overrideMethod(c$, "isRepaintPending", 
function(){
return this.repaintPending;
});
Clazz_overrideMethod(c$, "pushHoldRepaint", 
function(why){
++this.holdRepaint;
}, "~S");
Clazz_overrideMethod(c$, "popHoldRepaint", 
function(andRepaint, why){
if (why != null && why.startsWith("CLEAR HOLD")) {
this.holdRepaint = 0;
}--this.holdRepaint;
if (this.holdRepaint <= 0) {
this.holdRepaint = 0;
if (andRepaint) {
this.repaintPending = true;
this.repaintNow(why);
}}}, "~B,~S");
Clazz_overrideMethod(c$, "requestRepaintAndWait", 
function(why){
var jsmol = null;
if (JV.Viewer.isJS && !JV.Viewer.isSwingJS) {
{
jsmol = (self.Jmol && Jmol.repaint ? Jmol : null)
}}if (jsmol == null) {
try {
this.repaintNow(why);
if (!JV.Viewer.isJS) this.wait(this.vwr.g.repaintWaitMs);
if (this.repaintPending) {
JU.Logger.error("repaintManager requestRepaintAndWait timeout");
this.repaintDone();
}} catch (e) {
if (Clazz_exceptionOf(e,"InterruptedException")){
System.out.println("repaintManager requestRepaintAndWait interrupted thread=" + Thread.currentThread().getName());
} else {
throw e;
}
}
} else {
jsmol.repaint(this.vwr.html5Applet, false);
this.repaintDone();
}}, "~S");
Clazz_overrideMethod(c$, "repaintIfReady", 
function(why){
if (this.repaintPending) return false;
this.repaintPending = true;
if (this.holdRepaint == 0) this.repaintNow(why);
return true;
}, "~S");
Clazz_defineMethod(c$, "repaintNow", 
function(why){
if (!this.vwr.haveDisplay) return;
this.vwr.apiPlatform.repaint(this.vwr.display);
}, "~S");
Clazz_overrideMethod(c$, "repaintDone", 
function(){
this.repaintPending = false;
{
}});
Clazz_overrideMethod(c$, "clear", 
function(iShape){
if (this.renderers == null) return;
if (iShape >= 0) this.renderers[iShape] = null;
 else for (var i = 0; i < 37; ++i) this.renderers[i] = null;

}, "~N");
Clazz_defineMethod(c$, "getRenderer", 
function(shapeID){
if (this.renderers[shapeID] != null) return this.renderers[shapeID];
var className = JV.JC.getShapeClassName(shapeID, true) + "Renderer";
var renderer;
if ((renderer = J.api.Interface.getInterface(className, this.vwr, "render")) == null) return null;
renderer.setViewerG3dShapeID(this.vwr, shapeID);
return this.renderers[shapeID] = renderer;
}, "~N");
Clazz_overrideMethod(c$, "render", 
function(gdata, modelSet, isFirstPass, navMinMax){
var g3d = gdata;
if (this.renderers == null) this.renderers =  new Array(37);
this.getAllRenderers();
try {
var logTime = this.vwr.getBoolean(603979934);
g3d.renderBackground(null);
if (isFirstPass) {
this.bsTranslucent.clearAll();
if (navMinMax != null) g3d.renderCrossHairs(navMinMax, this.vwr.getScreenWidth(), this.vwr.getScreenHeight(), this.vwr.tm.getNavigationOffset(), this.vwr.tm.navigationDepthPercent);
var band = this.vwr.getRubberBandSelection();
if (band != null && g3d.setC(this.vwr.cm.colixRubberband)) g3d.drawRect(band.x, band.y, 0, 0, band.width, band.height);
this.vwr.noFrankEcho = true;
}var msg = null;
var sticks = this.shapeManager.getShape(1);
sticks.haveStrutPoints = false;
for (var i = 0; i < 37 && gdata.currentlyRendering; ++i) {
var shape = this.shapeManager.getShape(i);
if (shape == null) continue;
if (logTime) {
msg = "rendering " + JV.JC.getShapeClassName(i, false);
JU.Logger.startTimer(msg);
}if ((isFirstPass || this.bsTranslucent.get(i)) && this.getRenderer(i).renderShape(g3d, modelSet, shape, 0)) this.bsTranslucent.set(i);
if (logTime) JU.Logger.checkTimer(msg, false);
}
if (sticks.haveStrutPoints) {
this.getRenderer(1).renderShape(g3d, modelSet, sticks, 1);
}g3d.renderAllStrings(null);
} catch (e) {
if (Clazz_exceptionOf(e, Exception)){
e.printStackTrace();
if (this.vwr.async && "Interface".equals(e.getMessage())) throw  new NullPointerException();
JU.Logger.error("rendering error? " + e);
} else {
throw e;
}
}
}, "JU.GData,JM.ModelSet,~B,~A");
Clazz_defineMethod(c$, "getAllRenderers", 
function(){
var isOK = true;
for (var i = 0; i < 37; ++i) {
if (this.shapeManager.getShape(i) == null || this.getRenderer(i) != null) continue;
isOK = this.repaintPending = !this.vwr.async;
}
if (!isOK) throw  new NullPointerException();
});
Clazz_overrideMethod(c$, "renderExport", 
function(gdata, modelSet, params){
var isOK;
this.shapeManager.finalizeAtoms(null, true);
var exporter3D = this.vwr.initializeExporter(params);
isOK = (exporter3D != null);
if (!isOK) {
JU.Logger.error("Cannot export " + params.get("type"));
return null;
}if (this.renderers == null) this.renderers =  new Array(37);
this.getAllRenderers();
var msg = null;
try {
var logTime = this.vwr.getBoolean(603979934);
exporter3D.renderBackground(exporter3D);
var sticks = this.shapeManager.getShape(1);
sticks.haveStrutPoints = false;
for (var i = 0; i < 37; ++i) {
var shape = this.shapeManager.getShape(i);
if (shape == null) continue;
if (logTime) {
msg = "rendering " + JV.JC.getShapeClassName(i, false);
JU.Logger.startTimer(msg);
}this.getRenderer(i).renderShape(exporter3D, modelSet, shape, 0);
if (logTime) JU.Logger.checkTimer(msg, false);
}
if (sticks.haveStrutPoints) {
this.getRenderer(1).renderShape(exporter3D, modelSet, sticks, 1);
}exporter3D.renderAllStrings(exporter3D);
msg = exporter3D.finalizeOutput();
} catch (e) {
if (Clazz_exceptionOf(e, Exception)){
e.printStackTrace();
JU.Logger.error("rendering error? " + e);
} else {
throw e;
}
}
return msg;
}, "JU.GData,JM.ModelSet,java.util.Map");
});
;//5.0.1-v7 Mon Aug 24 10:01:38 CDT 2026
Clazz_declarePackage("J.render");
Clazz_load(null, "J.render.ShapeRenderer", ["JV.JC"], function(){
var c$ = Clazz_decorateAsClass(function(){
this.vwr = null;
this.tm = null;
this.g3d = null;
this.ms = null;
this.shape = null;
this.myVisibilityFlag = 0;
this.shapeID = 0;
this.colix = 0;
this.mad = 0;
this.exportType = 0;
this.isExport = false;
this.flags = 0;
Clazz_instantialize(this, arguments);}, J.render, "ShapeRenderer", null);
Clazz_defineMethod(c$, "initRenderer", 
function(){
});
Clazz_defineMethod(c$, "setViewerG3dShapeID", 
function(vwr, shapeID){
this.vwr = vwr;
this.tm = vwr.tm;
this.shapeID = shapeID;
this.myVisibilityFlag = JV.JC.getShapeVisibilityFlag(shapeID);
this.initRenderer();
}, "JV.Viewer,~N");
Clazz_defineMethod(c$, "renderShape", 
function(g3d, modelSet, shape, flags){
this.setup(g3d, modelSet, shape);
this.flags = flags;
var needsTranslucent = this.render();
this.exportType = 0;
this.isExport = false;
return needsTranslucent;
}, "J.api.JmolRendererInterface,JM.ModelSet,J.shape.Shape,~N");
Clazz_defineMethod(c$, "setup", 
function(g3d, modelSet, shape){
this.g3d = g3d;
this.ms = modelSet;
this.shape = shape;
this.exportType = g3d.getExportType();
this.isExport = (this.exportType != 0);
}, "J.api.JmolRendererInterface,JM.ModelSet,J.shape.Shape");
Clazz_defineMethod(c$, "isVisibleForMe", 
function(a){
return a != null && a.isVisible(this.myVisibilityFlag | 9);
}, "JM.Atom");
});
;//5.0.1-v7 Mon Aug 24 10:01:38 CDT 2026
Clazz_declarePackage("J.render");
Clazz_load(["J.render.FontLineShapeRenderer", "JU.BS", "$.P3", "$.V3"], "J.render.SticksRenderer", ["JU.A4", "$.M3", "J.c.PAL", "JU.C", "$.Edge"], function(){
var c$ = Clazz_decorateAsClass(function(){
this.showMultipleBonds = false;
this.multipleBondSpacing = 0;
this.multipleBondRadiusFactor = 0;
this.bondsPerp = false;
this.useBananas = false;
this.modeMultipleBond = 0;
this.isCartesian = false;
this.endcaps = 0;
this.ssbondsBackbone = false;
this.hbondsBackbone = false;
this.bondsBackbone = false;
this.hbondsSolid = false;
this.a = null;
this.b = null;
this.pa = null;
this.pb = null;
this.bond = null;
this.xA = 0;
this.yA = 0;
this.zA = 0;
this.xB = 0;
this.yB = 0;
this.zB = 0;
this.dx = 0;
this.dy = 0;
this.mag2d = 0;
this.bondOrder = 0;
this.wireframeOnly = false;
this.isAntialiased = false;
this.slabbing = false;
this.slabByAtom = false;
this.x = null;
this.y = null;
this.z = null;
this.p1 = null;
this.p2 = null;
this.bsForPass2 = null;
this.isPass2 = false;
this.isPymol = false;
this.strutsOnly = false;
this.xAxis1 = 0;
this.yAxis1 = 0;
this.xAxis2 = 0;
this.yAxis2 = 0;
this.dxStep = 0;
this.dyStep = 0;
this.rot = null;
this.a4 = null;
Clazz_instantialize(this, arguments);}, J.render, "SticksRenderer", J.render.FontLineShapeRenderer);
Clazz_prepareFields (c$, function(){
this.x =  new JU.V3();
this.y =  new JU.V3();
this.z =  new JU.V3();
this.p1 =  new JU.P3();
this.p2 =  new JU.P3();
this.bsForPass2 = JU.BS.newN(64);
});
Clazz_overrideMethod(c$, "render", 
function(){
var bonds = this.ms.bo;
if (bonds == null) return false;
this.isPass2 = this.vwr.gdata.isPass2;
if (!this.isPass2) this.bsForPass2.clearAll();
this.slabbing = this.tm.slabEnabled;
this.slabByAtom = this.vwr.getBoolean(603979939);
this.endcaps = 3;
this.dashDots = (this.vwr.getBoolean(603979893) ? J.render.FontLineShapeRenderer.sixdots : J.render.FontLineShapeRenderer.dashes);
this.isCartesian = (this.exportType == 1);
this.getMultipleBondSettings(0);
this.wireframeOnly = !this.vwr.checkMotionRendering(1677721602);
this.ssbondsBackbone = this.vwr.getBoolean(603979952);
this.hbondsBackbone = this.vwr.getBoolean(603979852);
this.bondsBackbone =  new Boolean (this.hbondsBackbone | this.ssbondsBackbone).valueOf();
this.hbondsSolid = this.vwr.getBoolean(603979854);
this.isAntialiased = this.g3d.isAntialiased();
this.strutsOnly = ((this.flags & 1) != 0);
var needTranslucent = false;
if (this.isPass2) {
for (var i = this.bsForPass2.nextSetBit(0); i >= 0; i = this.bsForPass2.nextSetBit(i + 1)) {
this.bond = bonds[i];
if (this.bond != null) this.renderBond(i);
}
} else {
for (var i = this.ms.bondCount; --i >= 0; ) {
this.bond = bonds[i];
if (this.bond != null && (this.bond.shapeVisibilityFlags & this.myVisibilityFlag) != 0 && this.renderBond(i)) {
needTranslucent = true;
this.bsForPass2.set(i);
}}
}return needTranslucent;
});
Clazz_defineMethod(c$, "renderBond", 
function(index){
var atomA0;
var atomB0;
this.a = atomA0 = this.bond.atom1;
this.b = atomB0 = this.bond.atom2;
var order = this.bond.order & 131071;
if (this.bondsBackbone) {
if (this.ssbondsBackbone && (order & 256) != 0) {
this.a = this.a.group.getLeadAtomOr(this.a);
this.b = this.b.group.getLeadAtomOr(this.b);
} else if (this.hbondsBackbone && JU.Edge.isOrderH(order)) {
this.a = this.a.group.getLeadAtomOr(this.a);
this.b = this.b.group.getLeadAtomOr(this.b);
}}if (!this.isPass2 && (!this.a.isVisible(9) || !this.b.isVisible(9) || !this.g3d.isInDisplayRange(this.a.sX, this.a.sY) || !this.g3d.isInDisplayRange(this.b.sX, this.b.sY))) return false;
if (this.slabbing) {
var ba = this.vwr.gdata.isClippedZ(this.a.sZ);
if (ba && this.vwr.gdata.isClippedZ(this.b.sZ) || this.slabByAtom && (ba || this.vwr.gdata.isClippedZ(this.b.sZ))) return false;
}this.zA = this.a.sZ;
this.zB = this.b.sZ;
if (this.zA == 1 || this.zB == 1) return false;
this.colixA = atomA0.colixAtom;
this.colixB = atomB0.colixAtom;
if (((this.colix = this.bond.colix) & -30721) == 2) {
this.colix = (this.colix & 30720);
this.colixA = JU.C.getColixInherited((this.colix | this.vwr.cm.getColixAtomPalette(atomA0, J.c.PAL.CPK.id)), this.colixA);
this.colixB = JU.C.getColixInherited((this.colix | this.vwr.cm.getColixAtomPalette(atomB0, J.c.PAL.CPK.id)), this.colixB);
} else {
this.colixA = JU.C.getColixInherited(this.colix, this.colixA);
this.colixB = JU.C.getColixInherited(this.colix, this.colixB);
}var needTranslucent = false;
var skip = false;
this.bondOrder = order & 131071;
var isStrut = (this.bondOrder == 32768);
if (this.strutsOnly != isStrut) {
if (isStrut) {
(this.shape).haveStrutPoints = true;
if (!this.isPass2) {
this.a.group.unsetStrutPoint();
this.b.group.unsetStrutPoint();
}}skip = true;
}if (!this.isExport && !this.isPass2) {
var doA = !JU.C.renderPass2(this.colixA);
var doB = !JU.C.renderPass2(this.colixB);
if (!doA || !doB) {
if (isStrut || !doA && !doB) {
skip = true;
}this.g3d.setC(!doA ? this.colixB : this.colixA);
needTranslucent = true;
}}if (skip) return needTranslucent;
var isPartial = this.bond.isPartial();
if (!isPartial) {
if ((this.bondOrder & 256) != 0) this.bondOrder &= -257;
if ((this.bondOrder & 1023) != 0) {
if (!this.showMultipleBonds || (this.modeMultipleBond == 2 && this.mad > 1000) || (this.bondOrder & 98304) == 65536) {
this.bondOrder = 1;
}}}this.pa = this.a;
this.pb = this.b;
var mask = 0;
switch (this.bondOrder) {
case 1025:
case 1041:
case 1057:
this.bondOrder = 1;
case 1:
case 2:
case 3:
case 4:
case 5:
case 6:
break;
case 17:
case 513:
this.bondOrder = 1;
mask = (order == 513 ? 0 : 1);
break;
case 515:
case 514:
this.bondOrder = 2;
mask = (order == 515 ? this.getAromaticDottedBondMask() : 0);
break;
default:
if ((this.bondOrder & 98304) == 98304) {
this.getMultipleBondSettings(this.bondOrder);
this.bondOrder &= 3;
mask = -2;
} else if (isPartial) {
this.bondOrder = JU.Edge.getPartialBondOrder(order);
mask = JU.Edge.getPartialBondDotted(order);
} else if (JU.Edge.isOrderH(this.bondOrder)) {
this.bondOrder = 1;
if (!this.hbondsSolid) mask = -1;
} else if (isStrut) {
this.bondOrder = 1;
var p1 = this.a.group.strutPoint;
var p2 = this.b.group.strutPoint;
this.pa = this.setStrutPoint(p1, this.pa);
this.pb = this.setStrutPoint(p2, this.pb);
this.zA = this.pa.sZ;
this.zB = this.pb.sZ;
}}
this.xA = this.pa.sX;
this.yA = this.pa.sY;
this.xB = this.pb.sX;
this.yB = this.pb.sY;
this.mad = this.bond.mad;
if (this.multipleBondRadiusFactor > 0 && this.bondOrder > 1) this.mad *= this.multipleBondRadiusFactor;
this.dx = this.xB - this.xA;
this.dy = this.yB - this.yA;
this.width = Clazz_floatToInt(this.vwr.tm.scaleToScreen(Clazz_doubleToInt((this.zA + this.zB) / 2), this.mad));
if (this.wireframeOnly && this.width > 0) this.width = 1;
if (!this.isCartesian) {
this.asLineOnly = (this.width <= 1);
if (this.asLineOnly && (this.isAntialiased)) {
this.width = 3;
this.asLineOnly = false;
}}var renderD = (!this.isExport || this.mad == 1 ? this.width : this.mad);
switch (mask) {
case -2:
this.drawBond(0);
this.getMultipleBondSettings(0);
break;
case -1:
J.render.FontLineShapeRenderer.drawDashedCylinder(this.g3d, this.xA, this.yA, this.zA, this.xB, this.yB, this.zB, J.render.FontLineShapeRenderer.hDashes, this.width, this.colixA, this.colixB, renderD, this.asLineOnly, this.s1);
break;
default:
switch (this.bondOrder) {
case 4:
{
this.bondOrder = 2;
var f = this.multipleBondRadiusFactor;
if (f == 0 && this.width > 1) this.width = Clazz_doubleToInt(this.width * 0.5);
var m = this.multipleBondSpacing;
if (m < 0) this.multipleBondSpacing = 0.30;
this.drawBond(mask);
this.bondsPerp = !this.bondsPerp;
this.bondOrder = 2;
this.drawBond(mask >> 2);
this.bondsPerp = !this.bondsPerp;
this.multipleBondSpacing = m;
this.isPymol = false;
}break;
case 5:
{
this.bondOrder = 3;
var f = this.multipleBondRadiusFactor;
if (f == 0 && this.width > 1) this.width = Clazz_doubleToInt(this.width * 0.5);
var m = this.multipleBondSpacing;
if (m < 0) this.multipleBondSpacing = 0.20;
this.drawBond(mask);
this.bondsPerp = !this.bondsPerp;
this.bondOrder = 2;
this.multipleBondSpacing *= 1.5;
this.drawBond(mask >> 3);
this.bondsPerp = !this.bondsPerp;
this.multipleBondSpacing = m;
this.isPymol = false;
}break;
case 6:
{
this.bondOrder = 4;
var f = this.multipleBondRadiusFactor;
if (f == 0 && this.width > 1) this.width = Clazz_doubleToInt(this.width * 0.5);
var m = this.multipleBondSpacing;
if (m < 0) this.multipleBondSpacing = 0.15;
this.drawBond(mask);
this.bondsPerp = !this.bondsPerp;
this.bondOrder = 2;
this.multipleBondSpacing *= 1.5;
this.drawBond(mask >> 4);
this.bondsPerp = !this.bondsPerp;
this.multipleBondSpacing = m;
this.isPymol = false;
}break;
default:
this.drawBond(mask);
}
break;
}
return needTranslucent;
}, "~N");
Clazz_defineMethod(c$, "setStrutPoint", 
function(p, a){
if (p.sX == -2147483648) return a;
var pi = this.vwr.tm.transformPt(p);
p.sX = pi.x;
p.sY = pi.y;
p.sZ = pi.z;
return p;
}, "JU.Point3fi,JU.Point3fi");
Clazz_defineMethod(c$, "getMultipleBondSettings", 
function(pymolBondOrder){
this.isPymol = (pymolBondOrder != 0);
if (this.isPymol) {
this.bondsPerp = false;
var scale = ((pymolBondOrder >> 2) & 0x3F) / 50;
this.showMultipleBonds = (scale != 0);
var n = (pymolBondOrder & 3);
this.multipleBondRadiusFactor = scale * 2 / (3 * n - 1);
this.multipleBondSpacing = this.multipleBondRadiusFactor * 3 / 2 * (Clazz_doubleToInt(this.bond.mad / 1000));
} else {
this.useBananas = (this.vwr.getBoolean(603979886) && !this.isPymol);
this.multipleBondSpacing = this.vwr.getFloat(570425370);
this.multipleBondRadiusFactor = this.vwr.getFloat(570425369);
this.bondsPerp = (this.useBananas || this.multipleBondSpacing > 0 && this.multipleBondRadiusFactor < 0);
if (this.useBananas) this.multipleBondSpacing = (this.multipleBondSpacing < 0 ? -this.multipleBondSpacing * 0.4 : this.multipleBondSpacing);
this.multipleBondRadiusFactor = Math.abs(this.multipleBondRadiusFactor);
if (this.multipleBondSpacing == 0 && this.isCartesian) this.multipleBondSpacing = 0.2;
}this.modeMultipleBond = this.vwr.g.modeMultipleBond;
this.showMultipleBonds = (this.multipleBondSpacing != 0 && this.modeMultipleBond != 0 && this.vwr.getBoolean(603979928));
}, "~N");
Clazz_defineMethod(c$, "drawBond", 
function(dottedMask){
var isDashed = (dottedMask & 1) != 0;
var endcaps = ((this.colixA & 30720) == 16384 || (this.colixB & 30720) == 16384 ? 2 : this.endcaps);
if (this.isCartesian && this.bondOrder == 1 && !isDashed) {
this.g3d.drawBond(this.pa, this.pb, this.colixA, this.colixB, endcaps, this.mad, -1);
return;
}var isEndOn = (this.dx == 0 && this.dy == 0);
if (isEndOn && this.asLineOnly && !this.isCartesian) return;
var renderD = (!this.isExport || this.mad == 1 ? this.width : this.mad);
var doFixedSpacing = (this.bondOrder > 1 && (this.isPymol || this.multipleBondSpacing > 0));
var isPiBonded = doFixedSpacing && (this.vwr.getHybridizationAndAxes(this.a.i, this.z, this.x, "pz") != null || this.vwr.getHybridizationAndAxes(this.b.i, this.z, this.x, "pz") != null) && !Float.isNaN(this.x.x);
if (isEndOn && !doFixedSpacing) {
var space = Clazz_doubleToInt(this.width / 8) + 3;
var step = this.width + space;
var y = this.yA - Clazz_doubleToInt((this.bondOrder - 1) * step / 2);
do {
J.render.FontLineShapeRenderer.fillCylinder(this.g3d, this.colixA, this.colixB, endcaps, this.xA, y, this.zA, this.xB, y, this.zB, renderD, this.asLineOnly);
y += step;
} while (--this.bondOrder > 0);
return;
}if (this.bondOrder == 1) {
if (isDashed) J.render.FontLineShapeRenderer.drawDashedCylinder(this.g3d, this.xA, this.yA, this.zA, this.xB, this.yB, this.zB, this.dashDots, this.width, this.colixA, this.colixB, renderD, this.asLineOnly, this.s1);
 else J.render.FontLineShapeRenderer.fillCylinder(this.g3d, this.colixA, this.colixB, endcaps, this.xA, this.yA, this.zA, this.xB, this.yB, this.zB, renderD, this.asLineOnly);
return;
}if (doFixedSpacing) {
if (!isPiBonded) this.z.setT(JU.P3.getUnlikely());
this.x.sub2(this.b, this.a);
this.y.cross(this.x, this.z);
this.y.normalize();
if (Float.isNaN(this.y.x)) {
this.z.setT(JU.P3.getUnlikely());
this.y.cross(this.x, this.z);
this.y.cross(this.y, this.x);
this.y.normalize();
}if (this.bondsPerp) this.y.cross(this.y, this.x);
this.y.scale(this.multipleBondSpacing);
this.x.setT(this.y);
this.x.scale((this.bondOrder - 1) / 2);
if (this.useBananas) {
this.drawBanana(this.a, this.b, this.x, 0);
switch (this.bondOrder) {
case 4:
this.drawBanana(this.a, this.b, this.x, 90);
this.drawBanana(this.a, this.b, this.x, -90);
case 2:
default:
this.drawBanana(this.a, this.b, this.x, 180);
break;
case 3:
this.drawBanana(this.a, this.b, this.x, 120);
this.drawBanana(this.a, this.b, this.x, -120);
break;
}
return;
}this.p1.sub2(this.a, this.x);
this.p2.sub2(this.b, this.x);
while (true) {
if (this.isCartesian) {
this.g3d.drawBond(this.p1, this.p2, this.colixA, this.colixB, endcaps, this.mad, -2);
} else {
this.tm.transformPtScr(this.p1, this.s1);
this.tm.transformPtScr(this.p2, this.s2);
if (isDashed) J.render.FontLineShapeRenderer.drawDashedCylinder(this.g3d, this.s1.x, this.s1.y, this.s1.z, this.s2.x, this.s2.y, this.s2.z, this.dashDots, this.width, this.colixA, this.colixB, renderD, this.asLineOnly, this.s1);
 else J.render.FontLineShapeRenderer.fillCylinder(this.g3d, this.colixA, this.colixB, endcaps, this.s1.x, this.s1.y, this.s1.z, this.s2.x, this.s2.y, this.s2.z, renderD, this.asLineOnly);
}dottedMask >>= 1;
isDashed = (dottedMask & 1) != 0;
if (--this.bondOrder <= 0) break;
this.p1.add(this.y);
this.p2.add(this.y);
this.stepAxisCoordinates();
}
return;
}var dxB = this.dx * this.dx;
var dyB = this.dy * this.dy;
this.mag2d = Math.round(Math.sqrt(dxB + dyB));
this.resetAxisCoordinates();
if (this.isCartesian && this.bondOrder == 3) {
J.render.FontLineShapeRenderer.fillCylinder(this.g3d, this.colixA, this.colixB, endcaps, this.xAxis1, this.yAxis1, this.zA, this.xAxis2, this.yAxis2, this.zB, renderD, this.asLineOnly);
this.stepAxisCoordinates();
this.x.sub2(this.b, this.a);
this.x.scale(0.05);
this.p1.sub2(this.a, this.x);
this.p2.add2(this.b, this.x);
this.g3d.drawBond(this.p1, this.p2, this.colixA, this.colixB, endcaps, this.mad, -2);
this.stepAxisCoordinates();
J.render.FontLineShapeRenderer.fillCylinder(this.g3d, this.colixA, this.colixB, endcaps, this.xAxis1, this.yAxis1, this.zA, this.xAxis2, this.yAxis2, this.zB, renderD, this.asLineOnly);
return;
}while (true) {
if ((dottedMask & 1) != 0) J.render.FontLineShapeRenderer.drawDashedCylinder(this.g3d, this.xAxis1, this.yAxis1, this.zA, this.xAxis2, this.yAxis2, this.zB, this.dashDots, this.width, this.colixA, this.colixB, renderD, this.asLineOnly, this.s1);
 else J.render.FontLineShapeRenderer.fillCylinder(this.g3d, this.colixA, this.colixB, endcaps, this.xAxis1, this.yAxis1, this.zA, this.xAxis2, this.yAxis2, this.zB, renderD, this.asLineOnly);
dottedMask >>= 1;
if (--this.bondOrder <= 0) break;
this.stepAxisCoordinates();
}
}, "~N");
Clazz_defineMethod(c$, "resetAxisCoordinates", 
function(){
var space = this.mag2d >> 3;
if (this.multipleBondSpacing != -1 && this.multipleBondSpacing < 0) space *= -this.multipleBondSpacing;
var step = this.width + space;
this.dxStep = Clazz_doubleToInt(step * this.dy / this.mag2d);
this.dyStep = Clazz_doubleToInt(step * -this.dx / this.mag2d);
this.xAxis1 = this.xA;
this.yAxis1 = this.yA;
this.xAxis2 = this.xB;
this.yAxis2 = this.yB;
var f = (this.bondOrder - 1);
this.xAxis1 -= Clazz_doubleToInt(this.dxStep * f / 2);
this.yAxis1 -= Clazz_doubleToInt(this.dyStep * f / 2);
this.xAxis2 -= Clazz_doubleToInt(this.dxStep * f / 2);
this.yAxis2 -= Clazz_doubleToInt(this.dyStep * f / 2);
});
Clazz_defineMethod(c$, "stepAxisCoordinates", 
function(){
this.xAxis1 += this.dxStep;
this.yAxis1 += this.dyStep;
this.xAxis2 += this.dxStep;
this.yAxis2 += this.dyStep;
});
Clazz_defineMethod(c$, "getAromaticDottedBondMask", 
function(){
var atomC = this.b.findAromaticNeighbor(this.a.i);
if (atomC == null) return 1;
var dxAC = atomC.sX - this.xA;
var dyAC = atomC.sY - this.yA;
return ((this.dx * dyAC - this.dy * dxAC) < 0 ? 2 : 1);
});
Clazz_defineMethod(c$, "drawBanana", 
function(a, b, x, deg){
this.g3d.addRenderer(553648143);
this.vectorT.sub2(b, a);
if (this.rot == null) {
this.rot =  new JU.M3();
this.a4 =  new JU.A4();
}this.a4.setVA(this.vectorT, (deg * 3.141592653589793 / 180));
this.rot.setAA(this.a4);
this.pointT.setT(a);
this.pointT3.setT(b);
this.pointT2.ave(a, b);
this.rot.rotate2(x, this.vectorT);
this.pointT2.add(this.vectorT);
this.tm.transformPtScrT3(a, this.pointT);
this.tm.transformPtScrT3(this.pointT2, this.pointT2);
this.tm.transformPtScrT3(b, this.pointT3);
var w = Math.max(this.width, 1);
this.g3d.setC(this.colixA);
this.g3d.fillHermite(5, w, w, w, this.pointT, this.pointT, this.pointT2, this.pointT3);
this.g3d.setC(this.colixB);
this.g3d.fillHermite(5, w, w, w, this.pointT, this.pointT2, this.pointT3, this.pointT3);
}, "JM.Atom,JM.Atom,JU.V3,~N");
});
;//5.0.1-v7 Mon Aug 24 10:01:38 CDT 2026
Clazz_declarePackage("J.render");
Clazz_load(["J.render.CageRenderer", "JU.P3"], "J.render.UccageRenderer", ["JU.BS", "$.DF", "JU.BSUtil", "$.BoxInfo", "$.C", "$.SimpleUnitCell"], function(){
var c$ = Clazz_decorateAsClass(function(){
this.verticesT = null;
this.vvertA = null;
this.cellRange = null;
this.offset = null;
this.offsetT = null;
this.unitcell = null;
this.lineheight = 0;
this.xpos = 0;
this.ypos = 0;
this.isPlanarGroup = false;
this.bsVerticals = null;
Clazz_instantialize(this, arguments);}, J.render, "UccageRenderer", J.render.CageRenderer);
Clazz_prepareFields (c$, function(){
this.verticesT =  new Array(8);
this.cellRange =  Clazz_newArray(-1, [ new JU.P3(),  new JU.P3()]);
this.offset =  new JU.P3();
this.offsetT =  new JU.P3();
});
Clazz_overrideMethod(c$, "initRenderer", 
function(){
for (var i = 8; --i >= 0; ) this.verticesT[i] =  new JU.P3();

this.tickEdges = JU.BoxInfo.uccageTickEdges;
this.draw000 = false;
});
Clazz_overrideMethod(c$, "setPeriodicity", 
function(vertices, scale){
this.setShifts();
var p0;
if (this.shifting) {
if (this.vvert == null) {
this.vvert =  new Array(8);
for (var i = 8; --i >= 0; ) {
this.vvert[i] =  new JU.P3();
}
}if (this.shiftC && this.periodicity == 0x1) {
if (this.vvertA == null) {
this.vvertA =  new Array(8);
for (var i = 8; --i >= 0; ) {
this.vvertA[i] =  new JU.P3();
}
}p0 = JU.P3.newP(vertices[1]);
p0.sub(vertices[0]);
p0.scale(0.5);
for (var i = 8; --i >= 0; ) {
this.pt.setT(vertices[i]);
this.pt.sub(vertices[0]);
this.pt.scaleAdd2(scale, this.pt, vertices[0]);
this.pt.sub(p0);
this.tm.transformPtNoClip(this.pt, this.vvertA[i]);
}
} else if (this.shiftA) {
if (this.vvertA == null) {
this.vvertA =  new Array(8);
for (var i = 8; --i >= 0; ) {
this.vvertA[i] =  new JU.P3();
}
}p0 = JU.P3.newP(vertices[4]);
p0.sub(vertices[0]);
p0.scale(0.5);
for (var i = 8; --i >= 0; ) {
this.pt.setT(vertices[i]);
this.pt.sub(vertices[0]);
this.pt.scaleAdd2(scale, this.pt, vertices[0]);
this.pt.sub(p0);
this.tm.transformPtNoClip(this.pt, this.vvertA[i]);
}
} else {
this.vvertA = null;
}p0 = JU.P3.newP(vertices[this.shiftB ? 2 : 1]);
p0.sub(vertices[0]);
p0.scale(0.5);
for (var i = 8; --i >= 0; ) {
this.pt.setT(vertices[i]);
this.pt.sub(vertices[0]);
this.pt.scaleAdd2(scale, this.pt, vertices[0]);
this.pt.sub(p0);
this.tm.transformPtNoClip(this.pt, this.vvert[i]);
}
}}, "~A,~N");
Clazz_overrideMethod(c$, "render", 
function(){
this.imageFontScaling = this.vwr.imageFontScaling;
this.font3d = this.vwr.gdata.getFont3DScaled((this.shape).font3d, this.imageFontScaling);
var mad10 = this.vwr.getObjectMad10(5);
if (mad10 == 0 || this.vwr.isJmolDataFrame() || this.tm.isNavigating() && this.vwr.getBoolean(603979890)) return false;
this.colix = this.vwr.getObjectColix(5);
var needTranslucent = JU.C.renderPass2(this.colix);
if (!this.isExport && needTranslucent != this.vwr.gdata.isPass2) return needTranslucent;
this.render1(mad10);
return false;
});
Clazz_defineMethod(c$, "render1", 
function(mad10){
this.g3d.setC(this.colix);
this.unitcell = this.vwr.getCurrentUnitCell();
if (this.unitcell == null) return;
this.isPolymer = this.unitcell.isPolymer();
this.isSlab = this.unitcell.isSlab();
this.periodicity = this.unitcell.getPeriodicity();
this.nDims = this.unitcell.getDimensionality();
this.isPlanarGroup = (this.periodicity == 0x03 && this.nDims == 2);
var vertices = this.unitcell.getUnitCellVerticesNoOffset();
this.offset.setT(this.unitcell.getCartesianOffset());
this.offsetT.setT(this.unitcell.getFractionalOrigin());
this.unitcell.toCartesian(this.offsetT, true);
this.offset.sub(this.offsetT);
var hiddenLines = this.vwr.getBoolean(603979856);
var fset = this.unitcell.getUnitCellMultiplier();
var haveMultiple = (fset != null && !fset.equals(J.render.UccageRenderer.fset0));
if (!haveMultiple) fset = J.render.UccageRenderer.fset0;
JU.SimpleUnitCell.getCellRange(fset, this.cellRange);
var firstLine;
var allow0;
var allow1;
var scale = Math.abs(fset.z);
var axes = this.vwr.shm.getShape(34);
if (axes != null && this.vwr.areAxesTainted()) axes.reinitShape();
var axisPoints = (axes == null || this.vwr.getObjectMad10(1) == 0 || axes.axisXY.z != 0 && (axes.axes2 == null || axes.axes2.length == 3) || axes.fixedOrigin != null || axes.fixedOriginUC.lengthSquared() > 0 ? null : axes.axisPoints);
var drawAllLines = (this.isExport || this.vwr.getObjectMad10(1) == 0 || this.vwr.getFloat(570425346) < 2 || axisPoints == null);
var aPoints = axisPoints;
var faces = (hiddenLines ? JU.BoxInfo.facePoints : null);
if (fset.z == 0) {
this.offsetT.setT(this.cellRange[0]);
this.unitcell.toCartesian(this.offsetT, true);
this.offsetT.add(this.offset);
aPoints = (this.cellRange[0].x == 0 && this.cellRange[0].y == 0 && this.cellRange[0].z == 0 ? axisPoints : null);
firstLine = 0;
allow0 = 0xFF;
allow1 = 0xFF;
var pts = JU.BoxInfo.unitCubePoints;
for (var i = 8; --i >= 0; ) {
var v = JU.P3.new3(pts[i].x * (this.cellRange[1].x - this.cellRange[0].x), pts[i].y * (this.cellRange[1].y - this.cellRange[0].y), pts[i].z * (this.cellRange[1].z - this.cellRange[0].z));
this.unitcell.toCartesian(v, true);
this.verticesT[i].add2(v, this.offsetT);
}
this.renderCage(mad10, this.verticesT, faces, aPoints, firstLine, allow0, allow1, 1);
} else {
for (var x = Clazz_floatToInt(this.cellRange[0].x); x < this.cellRange[1].x; x++) {
for (var y = Clazz_floatToInt(this.cellRange[0].y); y < this.cellRange[1].y; y++) {
for (var z = Clazz_floatToInt(this.cellRange[0].z); z < this.cellRange[1].z; z++) {
if (haveMultiple) {
this.offsetT.set(x, y, z);
this.offsetT.scale(scale);
this.unitcell.toCartesian(this.offsetT, true);
this.offsetT.add(this.offset);
aPoints = (x == 0 && y == 0 && z == 0 ? axisPoints : null);
firstLine = (drawAllLines || aPoints == null ? 0 : 3);
} else {
this.offsetT.setT(this.offset);
firstLine = (drawAllLines ? 0 : 3);
}allow0 = 0xFF;
allow1 = 0xFF;
for (var i = 8; --i >= 0; ) this.verticesT[i].add2(vertices[i], this.offsetT);

this.renderCage(mad10, this.verticesT, faces, aPoints, firstLine, allow0, allow1, scale);
}
}
}
}this.renderInfo();
}, "~N");
Clazz_overrideMethod(c$, "renderCageLine", 
function(i, edge0, edge1, d, drawTicks){
var p1;
var p2;
if (this.bsVerticals != null && this.bsVerticals.get(i)) {
if (this.vvertA != null && (i == 4 || i == 8 || i == 12 || i == 16 || i == 0 && this.periodicity != 0x2)) {
p1 = this.vvertA[edge0];
p2 = this.vvertA[edge1];
} else {
p1 = this.vvert[edge0];
p2 = this.vvert[edge1];
}} else {
p1 = this.p3Screens[edge0];
p2 = this.p3Screens[edge1];
}this.renderLine(p1, p2, d, drawTicks);
}, "~N,~N,~N,~N,~B");
Clazz_overrideMethod(c$, "setBSPeriod", 
function(){
var bs;
if (this.bsVerticals != null) this.bsVerticals.clearAll();
if (this.bsPeriod != null) this.bsPeriod.clearAll();
switch (this.periodicity) {
case 0x7:
return;
case 0x3:
bs = (this.bsPeriod == null ? (this.bsPeriod =  new JU.BS()) : this.bsPeriod);
if (this.nDims == 3) {
bs.set(0);
bs.set(10);
bs.set(16);
bs.set(22);
if (this.bsVerticals == null) {
this.bsVerticals =  new JU.BS();
}JU.BSUtil.copy2(bs, this.bsVerticals);
}bs.set(2);
bs.set(4);
bs.set(12);
bs.set(18);
break;
case 0x4:
bs = (this.bsPeriod == null ? (this.bsPeriod =  new JU.BS()) : this.bsPeriod);
bs.set(2);
bs.set(6);
bs.set(4);
bs.set(8);
if (this.bsVerticals == null) {
this.bsVerticals =  new JU.BS();
}JU.BSUtil.copy2(bs, this.bsVerticals);
bs.set(0);
break;
case 0x1:
bs = (this.bsPeriod == null ? (this.bsPeriod =  new JU.BS()) : this.bsPeriod);
bs.set(2);
bs.set(18);
if (this.nDims == 3) {
bs.set(0);
bs.set(16);
}if (this.bsVerticals == null) {
this.bsVerticals =  new JU.BS();
}JU.BSUtil.copy2(bs, this.bsVerticals);
bs.set(4);
break;
case 0x2:
bs = (this.bsPeriod == null ? (this.bsPeriod =  new JU.BS()) : this.bsPeriod);
bs.set(0);
bs.set(4);
bs.set(12);
bs.set(10);
if (this.bsVerticals == null) {
this.bsVerticals =  new JU.BS();
}JU.BSUtil.copy2(bs, this.bsVerticals);
bs.set(2);
break;
}
});
Clazz_defineMethod(c$, "renderInfo", 
function(){
var showDetails = this.vwr.getBoolean(603979937);
if (this.isExport || !this.vwr.getBoolean(603979828) || this.vwr.isPreviewOnly || !this.vwr.gdata.setC(this.vwr.cm.colixBackgroundContrast) || this.vwr.gdata.getTextPosition() != 0) return;
this.vwr.gdata.setFontBold("Monospaced", 14 * this.imageFontScaling);
this.xpos = Clazz_doubleToInt(Math.floor(10 * this.imageFontScaling));
this.ypos = this.lineheight = Clazz_doubleToInt(Math.floor(15 * this.imageFontScaling));
if (!this.unitcell.isSimple()) {
var sgName = this.unitcell.getUnitCellDisplayName();
if (sgName != null) this.drawInfo(sgName, 0, null);
var info = this.unitcell.getMoreInfo();
if (info != null) for (var i = 0; i < info.size(); i++) this.drawInfo(info.get(i), 0, null);

if (!showDetails) return;
}this.drawInfo("a=", 0, "\u00C5");
if (!this.isPolymer) this.drawInfo("b=", 1, "\u00C5");
if (!this.isPolymer && !this.isSlab && !this.isPlanarGroup) this.drawInfo("c=", 2, "\u00C5");
if (!this.isPolymer) {
if (!this.isSlab && !this.isPlanarGroup) {
this.drawInfo("\u03B1=", 3, "\u00B0");
this.drawInfo("\u03B2=", 4, "\u00B0");
}this.drawInfo("\u03B3=", 5, "\u00B0");
}});
Clazz_defineMethod(c$, "drawInfo", 
function(s, type, post){
this.ypos += this.lineheight;
if (post != null) s += JU.DF.formatDecimal(this.unitcell.getUnitCellInfoType(type), 3) + post;
this.g3d.drawStringNoSlab(s, null, this.xpos, this.ypos, 0, 0);
}, "~S,~N,~S");
c$.fset0 = JU.P3.new3(555, 555, 1);
});
;//5.0.1-v7 Mon Aug 24 10:01:38 CDT 2026
Clazz_declarePackage("JS");
Clazz_load(["JS.T"], "JS.ContextToken", ["java.util.Hashtable", "JS.SV"], function(){
var c$ = Clazz_decorateAsClass(function(){
this.contextVariables = null;
this.forVars = null;
this.name0 = null;
Clazz_instantialize(this, arguments);}, JS, "ContextToken", JS.T);
c$.newContext = Clazz_defineMethod(c$, "newContext", 
function(isOpen){
var ct = (isOpen ? JS.ContextToken.newCmd(1275335685, "{") : JS.ContextToken.newCmd(1275334681, "}"));
ct.intValue = 0;
return ct;
}, "~B");
c$.newCmd = Clazz_defineMethod(c$, "newCmd", 
function(tok, value){
var ct =  new JS.ContextToken();
ct.tok = tok;
ct.value = value;
return ct;
}, "~N,~O");
Clazz_defineMethod(c$, "addName", 
function(name){
if (this.contextVariables == null) this.contextVariables =  new java.util.Hashtable();
this.contextVariables.put(name, JS.SV.newS("").setName(name));
}, "~S");
});
;//5.0.1-v7 Mon Aug 17 10:07:10 MDT 2026
Clazz_declarePackage("JS");
Clazz_load(null, "JS.ScriptContext", ["java.util.Hashtable", "JS.SV"], function(){
var c$ = Clazz_decorateAsClass(function(){
this.aatoken = null;
this.allowJSThreads = false;
this.chk = false;
this.contextPath = " >> ";
this.vars = null;
this.displayLoadErrorsSave = false;
this.errorMessage = null;
this.errorMessageUntranslated = null;
this.errorType = null;
this.executionPaused = false;
this.executionStepping = false;
this.isEditor = false;
this.isEditorScript = false;
this.functionName = null;
this.iCommandError = -1;
this.id = 0;
this.isComplete = true;
this.isFunction = false;
this.isJSThread = false;
this.isStateScript = false;
this.isTryCatch = false;
this.forVars = null;
this.iToken = 0;
this.lineEnd = 2147483647;
this.lineIndices = null;
this.lineNumbers = null;
this.mustResumeEval = false;
this.outputBuffer = null;
this.parallelProcessor = null;
this.parentContext = null;
this.pc = 0;
this.pc0 = 0;
this.pcEnd = 2147483647;
this.script = null;
this.scriptExtensions = null;
this.scriptFileName = null;
this.scriptLevel = 0;
this.statement = null;
this.htFileCache = null;
this.statementLength = 0;
this.token = null;
this.tryPt = 0;
this.theToken = null;
this.theTok = 0;
this.pointers = null;
this.why = null;
this.privateFuncs = null;
Clazz_instantialize(this, arguments);}, JS, "ScriptContext", null);
Clazz_makeConstructor(c$, 
function(){
this.id = ++JS.ScriptContext.contextCount;
});
Clazz_defineMethod(c$, "setMustResume", 
function(){
var sc = this;
while (sc != null) {
sc.mustResumeEval = true;
sc.pc = sc.pc0;
sc = sc.parentContext;
}
});
Clazz_defineMethod(c$, "getVariable", 
function($var){
var context = this;
var v;
while (context != null && !context.isFunction) {
if (context.vars != null && (v = context.vars.get($var)) != null) return v;
context = context.parentContext;
}
return null;
}, "~S");
Clazz_defineMethod(c$, "getFullMap", 
function(){
var ht =  new java.util.Hashtable();
var context = this;
if (this.contextPath != null) ht.put("_path", JS.SV.newS(this.contextPath));
while (context != null && !context.isFunction) {
if (context.vars != null) for (var key, $key = context.vars.keySet().iterator (); $key.hasNext()&& ((key = $key.next ()) || true);) if (!ht.containsKey(key)) {
var val = context.vars.get(key);
if (val.tok != 2 || val.intValue != 2147483647) ht.put(key, val);
}
context = context.parentContext;
}
return ht;
});
Clazz_defineMethod(c$, "saveTokens", 
function(aa){
this.aatoken = aa;
if (aa == null) {
this.pointers = null;
return;
}this.pointers =  Clazz_newIntArray (aa.length, 0);
for (var i = this.pointers.length; --i >= 0; ) this.pointers[i] = (aa[i] == null ? -1 : aa[i][0].intValue);

}, "~A");
Clazz_defineMethod(c$, "restoreTokens", 
function(){
if (this.pointers != null) for (var i = this.pointers.length; --i >= 0; ) if (this.aatoken[i] != null) this.aatoken[i][0].intValue = this.pointers[i];

return this.aatoken;
});
Clazz_defineMethod(c$, "getTokenCount", 
function(){
return (this.aatoken == null ? -1 : this.aatoken.length);
});
Clazz_defineMethod(c$, "getToken", 
function(i){
return this.aatoken[i];
}, "~N");
c$.contextCount = 0;
});
;//5.0.1-v7 Mon Aug 17 10:07:10 MDT 2026
Clazz_declarePackage("JS");
Clazz_load(["java.lang.Exception"], "JS.ScriptException", null, function(){
var c$ = Clazz_decorateAsClass(function(){
this.eval = null;
this.message = null;
this.untranslated = null;
this.isError = false;
Clazz_instantialize(this, arguments);}, JS, "ScriptException", Exception);
Clazz_makeConstructor(c$, 
function(se, msg, untranslated, isError){
this.eval = se;
this.message = msg;
this.isError = isError;
if (!isError) return;
this.eval.setException(this, msg, untranslated);
}, "JS.ScriptError,~S,~S,~B");
Clazz_defineMethod(c$, "getErrorMessageUntranslated", 
function(){
return this.untranslated;
});
Clazz_overrideMethod(c$, "getMessage", 
function(){
return this.message;
});
Clazz_overrideMethod(c$, "toString", 
function(){
return this.message;
});
});
;//5.0.1-v7 Mon Aug 17 10:07:10 MDT 2026
Clazz_declarePackage("JS");
Clazz_load(["javajs.api.JSONEncodable", "JS.T", "JU.P3"], "JS.SV", ["java.util.Arrays", "$.Collections", "$.Hashtable", "JU.AU", "$.BArray", "$.BS", "$.Base64", "$.Lst", "$.Measure", "$.PT", "$.SB", "J.api.Interface", "JM.BondSet", "JU.BSUtil", "$.Escape", "JV.Viewer"], function(){
var c$ = Clazz_decorateAsClass(function(){
this.index = 2147483647;
this.myName = null;
if (!Clazz_isClassDefined("JS.SV.Sort")) {
JS.SV.$SV$Sort$ ();
}
Clazz_instantialize(this, arguments);}, JS, "SV", JS.T, javajs.api.JSONEncodable);
c$.newV = Clazz_defineMethod(c$, "newV", 
function(tok, value){
var sv =  new JS.SV();
sv.tok = tok;
sv.value = value;
return sv;
}, "~N,~O");
c$.newI = Clazz_defineMethod(c$, "newI", 
function(i){
var sv =  new JS.SV();
sv.tok = 2;
sv.intValue = i;
return sv;
}, "~N");
c$.newF = Clazz_defineMethod(c$, "newF", 
function(f){
if (f != f) return JS.SV.vNaN;
var sv =  new JS.SV();
sv.tok = 3;
sv.value = Float.$valueOf(f);
return sv;
}, "~N");
c$.newS = Clazz_defineMethod(c$, "newS", 
function(s){
return JS.SV.newV(4, s);
}, "~S");
c$.newT = Clazz_defineMethod(c$, "newT", 
function(x){
return JS.SV.newSV(x.tok, x.intValue, x.value);
}, "JS.T");
c$.newSV = Clazz_defineMethod(c$, "newSV", 
function(tok, intValue, value){
var sv = JS.SV.newV(tok, value);
sv.intValue = intValue;
return sv;
}, "~N,~N,~O");
Clazz_defineMethod(c$, "setv", 
function(v){
this.index = v.index;
this.intValue = v.intValue;
this.tok = v.tok;
this.value = v.value;
return this;
}, "JS.SV");
c$.copySafely = Clazz_defineMethod(c$, "copySafely", 
function(v){
return (v.myName == null ? v :  new JS.SV().setv(v));
}, "JS.SV");
c$.sizeOf = Clazz_defineMethod(c$, "sizeOf", 
function(x){
switch (x == null ? 0 : x.tok) {
case 10:
return JS.SV.bsSelectToken(x).cardinality();
case 15:
return (x.value).data.length;
case 4:
return (x.value).length;
case 7:
return x.intValue == 2147483647 ? (x).getList().size() : JS.SV.sizeOf(JS.SV.selectItemTok(x, -2147483648));
case 6:
return (x.value).size();
case 14:
return (x.value).getFullMap().size();
case 1073742335:
case 1073742334:
return -1;
case 2:
return -2;
case 3:
return -4;
case 8:
return -8;
case 9:
return -16;
case 11:
return -32;
case 12:
return -64;
default:
return 0;
}
}, "JS.T");
c$.isVariableType = Clazz_defineMethod(c$, "isVariableType", 
function(x){
return (Clazz_instanceOf(x,"JS.SV") || Clazz_instanceOf(x, Boolean) || Clazz_instanceOf(x, Integer) || Clazz_instanceOf(x, Float) || (typeof(x)=='string') || Clazz_instanceOf(x,"JU.T3") || Clazz_instanceOf(x,"JU.BS") || Clazz_instanceOf(x,"JU.P4") || Clazz_instanceOf(x,"JU.Quat") || Clazz_instanceOf(x,"JU.M34") || Clazz_instanceOf(x,"java.util.Map") || Clazz_instanceOf(x,"JU.Lst") || Clazz_instanceOf(x,"JU.BArray") || Clazz_instanceOf(x,"JS.ScriptContext") || JS.SV.isArray(x));
}, "~O");
c$.isArray = Clazz_defineMethod(c$, "isArray", 
function(x){
{
return Clazz_instanceOf(x, Array);
}}, "~O");
c$.getVariable = Clazz_defineMethod(c$, "getVariable", 
function(x){
if (x == null) return JS.SV.newS("");
if (Clazz_instanceOf(x,"JS.SV")) return x;
if (Clazz_instanceOf(x, Boolean)) return JS.SV.getBoolean((x).booleanValue());
if (Clazz_instanceOf(x, Integer)) return JS.SV.newI((x).intValue());
if (Clazz_instanceOf(x, Float)) return JS.SV.newV(3, x);
if ((typeof(x)=='string')) {
x = JS.SV.unescapePointOrBitsetAsVariable(x);
if (Clazz_instanceOf(x,"JS.SV")) return x;
return JS.SV.newV(4, x);
}if (Clazz_instanceOf(x,"JU.P3")) return JS.SV.newV(8, x);
if (Clazz_instanceOf(x,"JU.V3")) return JS.SV.newV(8, JU.P3.newP(x));
if (Clazz_instanceOf(x,"JU.BS")) return JS.SV.newV(10, x);
if (Clazz_instanceOf(x,"JU.P4")) return JS.SV.newV(9, x);
if (Clazz_instanceOf(x,"JU.Quat")) return JS.SV.newV(9, (x).toPoint4f());
if (Clazz_instanceOf(x,"JU.M34")) return JS.SV.newV(Clazz_instanceOf(x,"JU.M4") ? 12 : 11, x);
if (Clazz_instanceOf(x,"java.util.Map")) return JS.SV.getVariableMap(x);
if (Clazz_instanceOf(x,"JU.Lst")) return JS.SV.getVariableList(x);
if (Clazz_instanceOf(x,"JU.BArray")) return JS.SV.newV(15, x);
if (Clazz_instanceOf(x,"JS.ScriptContext")) return JS.SV.newV(14, x);
if (JS.SV.isASV(x)) return JS.SV.getVariableAV(x);
if (JU.AU.isAI(x)) return JS.SV.getVariableAI(x);
if (JU.AU.isAB(x)) return JS.SV.getVariableAB(x);
if (JU.AU.isAF(x)) return JS.SV.getVariableAF(x);
if (JU.AU.isAD(x)) return JS.SV.getVariableAD(x);
if (JU.AU.isAS(x)) return JS.SV.getVariableAS(x);
if (JU.AU.isAP(x)) return JS.SV.getVariableAP(x);
if (JU.AU.isAII(x)) return JS.SV.getVariableAII(x);
if (JU.AU.isAFF(x)) return JS.SV.getVariableAFF(x);
if (JU.AU.isASS(x)) return JS.SV.getVariableASS(x);
if (JU.AU.isADD(x)) return JS.SV.getVariableADD(x);
if (JU.AU.isAFloat(x)) return JS.SV.newV(13, x);
return JS.SV.newJSVar(x);
}, "~O");
c$.isASV = Clazz_defineMethod(c$, "isASV", 
function(x){
if (!JV.Viewer.isSwingJS) {
{
return x && x[0] && x[0].__CLASS_NAME__ == "JS.SV";
}}return Clazz_instanceOf(x,Array);
}, "~O");
c$.newJSVar = Clazz_defineMethod(c$, "newJSVar", 
function(x){
var itype;
var itest;
var inum;
var array;
var keys;
{
switch(x.BYTES_PER_ELEMENT ? Array : x.constructor) {
case Boolean:
itype = 0;
itest = x;
break;
case Number:
itype = 1;
inum = x;
break;
case Array:
itype = 2;
array = x;
break;
case Object:
itype = 3;
array = x;
keys = Object.keys(x);
break;
}
}switch (itype) {
case 0:
return (itest ? JS.SV.vT : JS.SV.vF);
case 1:
return (inum > 2147483647 || inum != Math.floor(inum) ? JS.SV.newF(inum) : JS.SV.newI(Clazz_floatToInt(inum)));
case 2:
var v =  new JU.Lst();
for (var i = 0, n = array.length; i < n; i++) v.addLast(JS.SV.newJSVar(array[i]));

return JS.SV.getVariableList(v);
case 3:
var map =  new java.util.Hashtable();
for (var i = keys.length; --i >= 0; ) {
var o = null;
{
o = array[keys[i]];
}map.put(keys[i], JS.SV.newJSVar(o));
}
return JS.SV.getVariableMap(map);
}
return JS.SV.newS(x.toString());
}, "~O");
c$.getVariableMap = Clazz_defineMethod(c$, "getVariableMap", 
function(x){
var ht = x;
var o = null;
for (var oo, $oo = ht.values().iterator (); $oo.hasNext()&& ((oo = $oo.next ()) || true);) {
o = oo;
break;
}
if (!(Clazz_instanceOf(o,"JS.SV"))) {
var x2 =  new java.util.Hashtable();
for (var entry, $entry = ht.entrySet().iterator (); $entry.hasNext()&& ((entry = $entry.next ()) || true);) x2.put(entry.getKey(), JS.SV.getVariable(entry.getValue()));

x = x2;
}return JS.SV.newV(6, x);
}, "java.util.Map");
c$.getVariableList = Clazz_defineMethod(c$, "getVariableList", 
function(v){
var len = v.size();
if (len > 0 && Clazz_instanceOf(v.get(0),"JS.SV")) return JS.SV.newV(7, v);
var objects =  new JU.Lst();
for (var i = 0; i < len; i++) objects.addLast(JS.SV.getVariable(v.get(i)));

return JS.SV.newV(7, objects);
}, "JU.Lst");
c$.getVariableAV = Clazz_defineMethod(c$, "getVariableAV", 
function(v){
var objects =  new JU.Lst();
for (var i = 0; i < v.length; i++) objects.addLast(v[i]);

return JS.SV.newV(7, objects);
}, "~A");
c$.getVariableAD = Clazz_defineMethod(c$, "getVariableAD", 
function(f){
var objects =  new JU.Lst();
for (var i = 0; i < f.length; i++) objects.addLast(JS.SV.newV(3, Float.$valueOf(f[i])));

return JS.SV.newV(7, objects);
}, "~A");
c$.getVariableAO = Clazz_defineMethod(c$, "getVariableAO", 
function(o){
var objects =  new JU.Lst();
for (var i = 0; i < o.length; i++) objects.addLast(JS.SV.getVariable(o[i]));

return JS.SV.newV(7, objects);
}, "~A");
c$.getVariableAS = Clazz_defineMethod(c$, "getVariableAS", 
function(s){
var objects =  new JU.Lst();
for (var i = 0; i < s.length; i++) objects.addLast(JS.SV.newV(4, s[i]));

return JS.SV.newV(7, objects);
}, "~A");
c$.getVariableAP = Clazz_defineMethod(c$, "getVariableAP", 
function(p){
var objects =  new JU.Lst();
for (var i = 0; i < p.length; i++) objects.addLast(JS.SV.newV(8, p[i]));

return JS.SV.newV(7, objects);
}, "~A");
c$.getVariableAFF = Clazz_defineMethod(c$, "getVariableAFF", 
function(fx){
var objects =  new JU.Lst();
for (var i = 0; i < fx.length; i++) objects.addLast(JS.SV.getVariableAF(fx[i]));

return JS.SV.newV(7, objects);
}, "~A");
c$.getVariableADD = Clazz_defineMethod(c$, "getVariableADD", 
function(fx){
var objects =  new JU.Lst();
for (var i = 0; i < fx.length; i++) objects.addLast(JS.SV.getVariableAD(fx[i]));

return JS.SV.newV(7, objects);
}, "~A");
c$.getVariableASS = Clazz_defineMethod(c$, "getVariableASS", 
function(fx){
var objects =  new JU.Lst();
for (var i = 0; i < fx.length; i++) objects.addLast(JS.SV.getVariableAS(fx[i]));

return JS.SV.newV(7, objects);
}, "~A");
c$.getVariableAII = Clazz_defineMethod(c$, "getVariableAII", 
function(ix){
var objects =  new JU.Lst();
for (var i = 0; i < ix.length; i++) objects.addLast(JS.SV.getVariableAI(ix[i]));

return JS.SV.newV(7, objects);
}, "~A");
c$.getVariableAF = Clazz_defineMethod(c$, "getVariableAF", 
function(f){
var objects =  new JU.Lst();
for (var i = 0; i < f.length; i++) objects.addLast(JS.SV.newV(3, Float.$valueOf(f[i])));

return JS.SV.newV(7, objects);
}, "~A");
c$.getVariableAI = Clazz_defineMethod(c$, "getVariableAI", 
function(ix){
var objects =  new JU.Lst();
for (var i = 0; i < ix.length; i++) objects.addLast(JS.SV.newI(ix[i]));

return JS.SV.newV(7, objects);
}, "~A");
c$.getVariableAB = Clazz_defineMethod(c$, "getVariableAB", 
function(ix){
var objects =  new JU.Lst();
for (var i = 0; i < ix.length; i++) objects.addLast(JS.SV.newI(ix[i]));

return JS.SV.newV(7, objects);
}, "~A");
Clazz_defineMethod(c$, "setName", 
function(name){
this.myName = name;
return this;
}, "~S");
Clazz_defineMethod(c$, "increment", 
function(n){
switch (this.tok) {
case 2:
this.intValue += n;
return true;
case 3:
this.value = Float.$valueOf((this.value).floatValue() + n);
return true;
default:
return false;
}
}, "~N");
Clazz_defineMethod(c$, "asBoolean", 
function(){
return JS.SV.bValue(this);
});
Clazz_defineMethod(c$, "asInt", 
function(){
return JS.SV.iValue(this);
});
Clazz_defineMethod(c$, "asFloat", 
function(){
return JS.SV.fValue(this);
});
Clazz_defineMethod(c$, "asString", 
function(){
return JS.SV.sValue(this);
});
c$.oValue = Clazz_defineMethod(c$, "oValue", 
function(xx){
if (!(Clazz_instanceOf(xx,"JS.SV"))) return xx;
var x = xx;
switch (x.tok) {
case 1073742335:
return Boolean.TRUE;
case 0:
case 1073742334:
return Boolean.FALSE;
case 2:
return Integer.$valueOf(x.intValue);
case 10:
case 1275068418:
return JS.SV.selectItemVar(x).value;
default:
return x.value;
}
}, "~O");
c$.nValue = Clazz_defineMethod(c$, "nValue", 
function(x){
var iValue;
switch (x == null ? 0 : x.tok) {
case 3:
return x.value;
case 2:
iValue = x.intValue;
break;
case 4:
if ((x.value).indexOf(".") >= 0) return Float.$valueOf(JS.SV.toFloat(x.value));
iValue = Clazz_floatToInt(JS.SV.toFloat(x.value));
break;
case 8:
return Float.$valueOf((x.value).length());
default:
iValue = 0;
}
return Integer.$valueOf(iValue);
}, "JS.T");
c$.bValue = Clazz_defineMethod(c$, "bValue", 
function(x){
switch (x == null ? 0 : x.tok) {
case 1073742335:
case 14:
return true;
case 1073742334:
return false;
case 2:
return x.intValue != 0;
case 3:
case 4:
case 7:
return JS.SV.fValue(x) != 0;
case 10:
case 15:
return JS.SV.iValue(x) != 0;
case 8:
case 9:
case 11:
case 12:
return Math.abs(JS.SV.fValue(x)) > 0.0001;
case 6:
return !(x).getMap().isEmpty();
default:
return false;
}
}, "JS.T");
c$.iValue = Clazz_defineMethod(c$, "iValue", 
function(x){
switch (x == null ? 0 : x.tok) {
case 1073742335:
return 1;
case 1073742334:
return 0;
case 2:
return x.intValue;
case 3:
case 7:
case 4:
case 8:
case 9:
case 11:
case 12:
case 134221850:
return Clazz_floatToInt(JS.SV.fValue(x));
case 10:
return JS.SV.bsSelectToken(x).cardinality();
case 15:
return (x.value).data.length;
default:
return 0;
}
}, "JS.T");
c$.fValue = Clazz_defineMethod(c$, "fValue", 
function(x){
switch (x == null ? 0 : x.tok) {
case 1073742335:
return 1;
case 1073742334:
return 0;
case 2:
return x.intValue;
case 3:
return (x.value).floatValue();
case 7:
var i = x.intValue;
if (i == 2147483647) return (x).getList().size();
case 4:
return JS.SV.toFloat(JS.SV.sValue(x));
case 10:
case 15:
return JS.SV.iValue(x);
case 8:
return (x.value).length();
case 9:
return JU.Measure.distanceToPlane(x.value, JS.SV.pt0);
case 11:
var pt =  new JU.P3();
(x.value).rotate(pt);
return pt.length();
case 12:
var pt1 =  new JU.P3();
(x.value).rotTrans(pt1);
return pt1.length();
default:
return 0;
}
}, "JS.T");
c$.sValue = Clazz_defineMethod(c$, "sValue", 
function(x){
if (x == null) return "";
var i;
var sb;
switch (x.tok) {
case 1073742335:
return "true";
case 1073742334:
return "false";
case 2:
return "" + x.intValue;
case 10:
var bs = JS.SV.bsSelectToken(x);
return (Clazz_instanceOf(x.value,"JM.BondSet") ? JU.Escape.eBond(bs) : JU.Escape.eBS(bs));
case 7:
var sv = (x).getList();
i = x.intValue;
if (i <= 0) i = sv.size() - i;
if (i != 2147483647) return (i < 1 || i > sv.size() ? "" : JS.SV.sValue(sv.get(i - 1)));
case 6:
case 14:
if ((typeof(x.value)=='string')) return x.value;
sb =  new JU.SB();
JS.SV.sValueArray(sb, x, "", "", false, true, true, 2147483647, false);
return JU.PT.rep(sb.toString(), "\n\0", " ");
case 4:
var s = x.value;
i = x.intValue;
if (i <= 0) i = s.length - i;
if (i == 2147483647) return s;
if (i < 1 || i > s.length) return "";
return "" + s.charAt(i - 1);
case 8:
return JU.Escape.eP(x.value);
case 9:
return JU.Escape.eP4(x.value);
case 11:
case 12:
return JU.Escape.e(x.value);
default:
return x.value.toString();
}
}, "JS.T");
c$.sValueArray = Clazz_defineMethod(c$, "sValueArray", 
function(sb, vx, path, tabs, isEscaped, isRaw, addValues, maxLevels, skipEmpty){
switch (vx.tok) {
case 6:
case 14:
case 7:
var thiskey = ";" + vx.hashCode() + ";";
if (path.indexOf(thiskey) >= 0) {
sb.append(isEscaped ? (vx.tok == 7 ? "[ ]" : "{ }") : (vx.tok == 7 ? "" : "\0") + "\"<" + (vx.myName == null ? "circular reference" : vx.myName) + ">\"");
break;
}path += thiskey;
if (vx.tok == 7) {
if (!addValues) return;
if (!isRaw) sb.append(isEscaped ? "[ " : tabs + "[\n");
var sx = vx.getList();
for (var i = 0; i < sx.size(); i++) {
if (isEscaped && i > 0) sb.append(",");
var sv = sx.get(i);
JS.SV.sValueArray(sb, sv, path, tabs + "  ", isEscaped, tabs.length == 0 && !isEscaped && JS.SV.isRawType(sv.tok), addValues, maxLevels, skipEmpty);
if (!isEscaped) sb.append("\n");
}
if (!isRaw) sb.append(isEscaped ? " ]" : tabs + "]");
} else if (--maxLevels >= 0) {
var ht = (vx.tok == 14 ? (vx.value).getFullMap() : vx.getMap());
JS.SV.sValueAddKeys(sb, path, ht, tabs, isEscaped, addValues, maxLevels, skipEmpty);
}break;
default:
if (!addValues) return;
if (!isRaw && !isEscaped) sb.append(tabs);
sb.append(isEscaped ? vx.escape() : JS.SV.sValue(vx));
}
}, "JU.SB,JS.SV,~S,~S,~B,~B,~B,~N,~B");
c$.sValueAddKeys = Clazz_defineMethod(c$, "sValueAddKeys", 
function(sb, path, ht, tabs, isEscaped, addValues, maxLevels, skipEmpty){
if (maxLevels < 0) return;
var keyset = ht.keySet();
var keys = ht.keySet().toArray( new Array(keyset.size()));
java.util.Arrays.sort(keys);
if (isEscaped) {
sb.append("{ ");
var sep = "";
for (var i = 0; i < keys.length; i++) {
var key = keys[i];
var val = ht.get(key);
if (skipEmpty && (val.tok == 7 && val.getList().size() == 0 || val.tok == 6 && val.getMap().isEmpty())) continue;
if (addValues) sb.append(sep).append(JU.PT.esc(key)).append(":");
 else sb.appendC(' ').append(key);
JS.SV.sValueArray(sb, val, path, tabs + "  ", true, false, addValues, maxLevels, skipEmpty);
sep = ",";
}
sb.append(" }");
if (!addValues) sb.append("\n");
return;
}sb.append(tabs).append("{\n");
tabs += "  ";
for (var i = 0; i < keys.length; i++) {
sb.append(tabs);
var key = keys[i];
sb.append(JU.PT.esc(key)).append("  :");
var sb2 =  new JU.SB();
if (!(Clazz_instanceOf(ht.get(key),"JS.SV"))) ht.put(key, JS.SV.getVariable(ht.get(key)));
var v = ht.get(key);
isEscaped = JS.SV.isRawType(v.tok);
JS.SV.sValueArray(sb2, v, path, tabs, isEscaped, false, addValues, maxLevels, skipEmpty);
var value = sb2.toString();
if (isEscaped && addValues) sb.append("  ");
 else sb.append("\n");
sb.append(value).append("\n");
}
sb.append(tabs.substring(1)).append("}");
}, "JU.SB,~S,java.util.Map,~S,~B,~B,~N,~B");
c$.isRawType = Clazz_defineMethod(c$, "isRawType", 
function(tok){
switch (tok) {
case 4:
case 3:
case 2:
case 8:
case 9:
case 10:
case 15:
case 1073742335:
case 1073742334:
return true;
}
return false;
}, "~N");
c$.ptValue = Clazz_defineMethod(c$, "ptValue", 
function(x){
switch (x.tok) {
case 8:
return x.value;
case 4:
var o = JU.Escape.uP(x.value);
if (Clazz_instanceOf(o,"JU.P3")) return o;
}
return null;
}, "JS.SV");
c$.pt4Value = Clazz_defineMethod(c$, "pt4Value", 
function(x){
switch (x.tok) {
case 9:
return x.value;
case 4:
var o = JU.Escape.uP(x.value);
if (!(Clazz_instanceOf(o,"JU.P4"))) break;
return o;
}
return null;
}, "JS.SV");
c$.toFloat = Clazz_defineMethod(c$, "toFloat", 
function(s){
return (s.equalsIgnoreCase("true") ? 1 : s.length == 0 || s.equalsIgnoreCase("false") ? 0 : JU.PT.parseFloatStrict(JU.PT.trim(s, " \t\n")));
}, "~S");
c$.concatList = Clazz_defineMethod(c$, "concatList", 
function(x1, x2, asNew){
var v1 = x1.getList();
var v2 = x2.getList();
if (!asNew) {
if (v2 == null) v1.addLast(JS.SV.newT(x2));
 else for (var i = 0; i < v2.size(); i++) v1.addLast(v2.get(i));

return x1;
}var vlist =  new JU.Lst();
if (v1 == null) vlist.addLast(x1);
 else for (var i = 0; i < v1.size(); i++) vlist.addLast(v1.get(i));

if (v2 == null) vlist.addLast(x2);
 else for (var i = 0; i < v2.size(); i++) vlist.addLast(v2.get(i));

return JS.SV.getVariableList(vlist);
}, "JS.SV,JS.SV,~B");
c$.bsSelectToken = Clazz_defineMethod(c$, "bsSelectToken", 
function(x){
return JS.SV.selectItemTok(x, -2147483648).value;
}, "JS.T");
c$.bsSelectRange = Clazz_defineMethod(c$, "bsSelectRange", 
function(x, n){
x = JS.SV.selectItemTok(x, -2147483648);
x = JS.SV.selectItemTok(x, (n <= 0 ? n : 1));
x = JS.SV.selectItemTok(x, (n <= 0 ? 2147483646 : n));
return x.value;
}, "JS.T,~N");
c$.selectItemVar = Clazz_defineMethod(c$, "selectItemVar", 
function($var){
return ($var.index != 2147483647 || ($var.tok == 7 || $var.tok == 15) && $var.intValue == 2147483647 ? $var : JS.SV.selectItemTok($var, -2147483648));
}, "JS.SV");
c$.selectItemTok = Clazz_defineMethod(c$, "selectItemTok", 
function(tokenIn, i2){
switch (tokenIn.tok) {
case 11:
case 12:
case 10:
case 7:
case 15:
case 4:
break;
default:
return ((Clazz_instanceOf(tokenIn,"JS.SV")) && (tokenIn).myName != null ? JS.SV.copySafely(tokenIn) : tokenIn);
}
var bs = null;
var s = null;
var i1 = tokenIn.intValue;
var isOne = (i2 == -2147483648);
if (i1 == 2147483647) {
return (isOne && tokenIn.tok == 4 ? tokenIn : JS.SV.newSV(tokenIn.tok, (isOne ? i1 : i2), tokenIn.value));
}var len = 0;
var isInputSelected = (Clazz_instanceOf(tokenIn,"JS.SV") && (tokenIn).index != 2147483647);
var tokenOut = JS.SV.newSV(tokenIn.tok, 2147483647, null);
switch (tokenIn.tok) {
case 10:
if (Clazz_instanceOf(tokenIn.value,"JM.BondSet")) {
bs = JM.BondSet.newBS(tokenIn.value);
len = bs.cardinality();
} else {
bs = JU.BSUtil.copy(tokenIn.value);
len = (isInputSelected ? 1 : bs.cardinality());
}break;
case 15:
len = (((tokenIn).value)).data.length;
break;
case 7:
len = (tokenIn).getList().size();
break;
case 4:
s = tokenIn.value;
len = s.length;
break;
case 11:
len = -3;
break;
case 12:
len = -4;
break;
}
if (len < 0) {
len = -len;
if (i1 > 0 && Math.abs(i1) > len) {
var col = i1 % 10;
var row = Clazz_doubleToInt((i1 - col) / 10);
if (col > 0 && col <= len && row <= len) {
if (tokenIn.tok == 11) return JS.SV.newV(3, Float.$valueOf((tokenIn.value).getElement(row - 1, col - 1)));
return JS.SV.newV(3, Float.$valueOf((tokenIn.value).getElement(row - 1, col - 1)));
}return JS.SV.newV(4, "");
}if (Math.abs(i1) > len) return JS.SV.newV(4, "");
var data =  Clazz_newFloatArray (len, 0);
if (len == 3) {
if (i1 < 0) (tokenIn.value).getColumn(-1 - i1, data);
 else (tokenIn.value).getRow(i1 - 1, data);
} else {
if (i1 < 0) (tokenIn.value).getColumn(-1 - i1, data);
 else (tokenIn.value).getRow(i1 - 1, data);
}if (isOne) return JS.SV.getVariableAF(data);
if (i2 < 1 || i2 > len) return JS.SV.newV(4, "");
return JS.SV.newV(3, Float.$valueOf(data[i2 - 1]));
}if (i1 <= 0) i1 = len + i1;
if (!isOne) {
if (i1 < 1) i1 = 1;
if (i2 == 0) i2 = len;
 else if (i2 < 0) i2 = len + i2;
if (i2 < i1) i2 = i1;
}switch (tokenIn.tok) {
case 10:
tokenOut.value = bs;
if (isInputSelected) {
if (i1 > 1) bs.clearAll();
break;
}if (isOne) {
if (i1 == len) {
i2 = bs.length() - 1;
} else if (i1 == 1) {
i2 = bs.nextSetBit(0);
}if (i2 >= -1) {
bs.clearAll();
if (i2 >= 0) bs.set(i2);
break;
}i2 = i1;
}var n = 0;
for (var j = bs.nextSetBit(0); j >= 0; j = bs.nextSetBit(j + 1)) if (++n < i1 || n > i2) bs.clear(j);

break;
case 4:
tokenOut.value = (--i1 < 0 || i1 >= len ? "" : isOne ? s.substring(i1, i1 + 1) : s.substring(i1, Math.min(i2, len)));
break;
case 7:
if (--i1 < 0 || i1 >= len) return JS.SV.newV(4, "");
if (isOne) return (tokenIn).getList().get(i1);
var o2 =  new JU.Lst();
var o1 = (tokenIn).getList();
var nn = Math.min(i2, len) - i1;
for (var i = 0; i < nn; i++) o2.addLast(JS.SV.newT(o1.get(i + i1)));

tokenOut.value = o2;
break;
case 15:
if (--i1 < 0 || i1 >= len) return JS.SV.newV(4, "");
var data = (((tokenIn).value)).data;
if (isOne) return JS.SV.newI(data[i1]);
var b =  Clazz_newByteArray (Math.min(i2, len) - i1, 0);
for (var i = b.length; --i >= 0; ) b[i] = data[i1 + i];

tokenOut.value =  new JU.BArray(b);
break;
}
return tokenOut;
}, "JS.T,~N");
Clazz_defineMethod(c$, "setSelectedValue", 
function(pt1, pt2, $var){
if (pt1 == 2147483647) return;
var len;
switch (this.tok) {
case 11:
case 12:
len = (this.tok == 11 ? 3 : 4);
if (pt2 != 2147483647) {
var col = pt2;
var row = pt1;
if (col > 0 && col <= len && row <= len) {
if (this.tok == 11) (this.value).setElement(row - 1, col - 1, JS.SV.fValue($var));
 else (this.value).setElement(row - 1, col - 1, JS.SV.fValue($var));
return;
}}if (pt1 != 0 && Math.abs(pt1) <= len && (this.tok == 11 && $var.tok == 8 || this.tok == 12 && $var.tok == 9 || $var.tok == 7)) {
var data;
switch ($var.tok) {
default:
case 7:
var sv = $var.getList();
if (sv.size() != len) return;
data =  Clazz_newFloatArray (len, 0);
for (var i = 0; i < len; i++) data[i] = JS.SV.fValue(sv.get(i));

break;
case 8:
var p = $var.value;
data =  Clazz_newFloatArray(-1, [p.x, p.y, p.z]);
break;
case 9:
var p4 = $var.value;
data =  Clazz_newFloatArray(-1, [p4.x, p4.y, p4.z, p4.w]);
break;
}
if (pt1 > 0) {
if (this.tok == 11) (this.value).setRowA(pt1 - 1, data);
 else (this.value).setRowA(pt1 - 1, data);
} else {
if (this.tok == 11) (this.value).setColumnA(-1 - pt1, data);
 else (this.value).setColumnA(-1 - pt1, data);
}break;
}break;
case 4:
var str = this.value;
var pt = str.length;
if (pt1 <= 0) pt1 = pt + pt1;
if (--pt1 < 0) pt1 = 0;
while (pt1 >= str.length) str += " ";

if (pt2 == 2147483647) {
pt2 = pt1;
} else {
if (--pt2 < 0) pt2 = pt + pt2;
while (pt2 >= str.length) str += " ";

}if (pt2 >= pt1) this.value = str.substring(0, pt1) + JS.SV.sValue($var) + str.substring(++pt2);
this.intValue = this.index = 2147483647;
break;
case 7:
var v = this.value;
len = v.size();
if (pt1 <= 0) pt1 = len + pt1;
if (--pt1 < 0) pt1 = 0;
if (len <= pt1) for (var i = len; i <= pt1; i++) v.addLast(JS.SV.newV(4, ""));

v.set(pt1, $var);
break;
}
}, "~N,~N,JS.SV");
Clazz_defineMethod(c$, "escape", 
function(){
switch (this.tok) {
case 4:
return JU.PT.esc(this.value);
case 11:
case 12:
return JU.PT.toJSON(null, this.value);
case 7:
case 6:
case 14:
var sb =  new JU.SB();
JS.SV.sValueArray(sb, this, "", "", true, false, true, 2147483647, false);
return sb.toString();
default:
return JS.SV.sValue(this);
}
});
c$.getJvxlCoder = Clazz_defineMethod(c$, "getJvxlCoder", 
function(){
return (JS.SV.jvxlCoder == null ? (JS.SV.jvxlCoder = J.api.Interface.getInterface("J.jvxl.data.JvxlCoder", null, "script")) : JS.SV.jvxlCoder);
});
c$.encodeBitSet90_35 = Clazz_defineMethod(c$, "encodeBitSet90_35", 
function(bs){
return JS.SV.getJvxlCoder().jvxlEncodeBitSet90_35(bs);
}, "JU.BS");
c$.decodeBase90_35 = Clazz_defineMethod(c$, "decodeBase90_35", 
function(s){
return JS.SV.getJvxlCoder().jvxlDecodeBitSet90_35(s);
}, "~S");
c$.unescapePointOrBitsetAsVariable = Clazz_defineMethod(c$, "unescapePointOrBitsetAsVariable", 
function(o){
if (o == null) return o;
var v = null;
var s = null;
if (Clazz_instanceOf(o,"JS.SV")) {
var sv = o;
switch (sv.tok) {
case 8:
case 9:
case 11:
case 12:
case 10:
v = sv.value;
break;
case 4:
s = sv.value;
break;
default:
s = JS.SV.sValue(sv);
break;
}
} else if ((typeof(o)=='string')) {
s = o;
}if (s != null) {
if (s.length == 0) return s;
if (s.startsWith(";base90+35,")) return JS.SV.decodeBase90_35(s);
}if (v == null) v = JU.Escape.uABsM(s);
if (Clazz_instanceOf(v,"JU.P3")) return (JS.SV.newV(8, v));
if (Clazz_instanceOf(v,"JU.P4")) return JS.SV.newV(9, v);
if (Clazz_instanceOf(v,"JU.BS")) {
if (s != null && s.indexOf("[{") == 0) v = JM.BondSet.newBS(v);
return JS.SV.newV(10, v);
}if (Clazz_instanceOf(v,"JU.M34")) return (JS.SV.newV(Clazz_instanceOf(v,"JU.M3") ? 11 : 12, v));
return o;
}, "~O");
c$.getBoolean = Clazz_defineMethod(c$, "getBoolean", 
function(value){
return JS.SV.newT(value ? JS.SV.vT : JS.SV.vF);
}, "~B");
c$.sprintf = Clazz_defineMethod(c$, "sprintf", 
function(strFormat, $var){
if ($var == null) return strFormat;
var isArray = ($var.tok == 7);
var vd = (strFormat.indexOf("d") >= 0 || strFormat.indexOf("i") >= 0 ?  Clazz_newIntArray (1, 0) : null);
var vf = (strFormat.indexOf("f") >= 0 ?  Clazz_newFloatArray (1, 0) : null);
var ve = (strFormat.indexOf("e") >= 0 ?  Clazz_newDoubleArray (1, 0) : null);
var getS = (strFormat.indexOf("s") >= 0);
var getP = (strFormat.indexOf("p") >= 0 && (isArray || $var.tok == 8));
var getQ = (strFormat.indexOf("q") >= 0 && (isArray || $var.tok == 9));
var of =  Clazz_newArray(-1, [vd, vf, ve, null, null, null]);
if (!isArray) return JS.SV.sprintf(strFormat, $var, of, vd, vf, ve, getS, getP, getQ);
var sv = $var.getList();
var list2 =  new Array(sv.size());
for (var i = 0; i < list2.length; i++) list2[i] = JS.SV.sprintf(strFormat, sv.get(i), of, vd, vf, ve, getS, getP, getQ);

return list2;
}, "~S,JS.SV");
c$.sprintf = Clazz_defineMethod(c$, "sprintf", 
function(strFormat, $var, of, vd, vf, ve, getS, getP, getQ){
if ($var.tok == 6) {
var pt = strFormat.indexOf("[");
if (pt >= 0) {
var pt1;
$var = $var.getMap().get(strFormat.substring(pt + 1, pt1 = strFormat.indexOf("]")));
strFormat = strFormat.substring(0, pt) + strFormat.substring(pt1 + 1);
}}if (vd != null) vd[0] = JS.SV.iValue($var);
if (vf != null) vf[0] = JS.SV.fValue($var);
if (ve != null) ve[0] = JS.SV.fValue($var);
if (getS) of[3] = JS.SV.sValue($var);
if (getP) of[4] = $var.value;
if (getQ) of[5] = $var.value;
return JU.PT.sprintf(strFormat, "IFDspq", of);
}, "~S,JS.SV,~A,~A,~A,~A,~B,~B,~B");
c$.getFormatType = Clazz_defineMethod(c$, "getFormatType", 
function(format){
return (format.indexOf(";") >= 0 ? -1 : ";json;base64;base90+35;bytearray;array;string;bitset;xyz;abc;uvw;rxyz;".indexOf(";" + format.toLowerCase() + ";"));
}, "~S");
c$.format = Clazz_defineMethod(c$, "format", 
function(args, pt){
switch (args.length) {
case 0:
return "";
case 1:
return JS.SV.sValue(args[0]);
case 2:
if (pt == 2147483647) pt = JS.SV.getFormatType(args[0].asString());
if (pt >= 0) return JS.SV.getFormat(args[1], pt);
}
var format = JU.PT.split(JU.PT.rep(JS.SV.sValue(args[0]), "%%", "\1"), "%");
if (format.length == 0) return "";
var sb =  new JU.SB();
sb.append(format[0]);
for (var i = 1; i < format.length; i++) {
var ret = JS.SV.sprintf(JU.PT.formatCheck("%" + format[i]), (args[1].tok == 6 ? args[1] : args[1].tok == 7 ? args[1].getList().get(i - 1) : i < args.length ? args[i] : null));
if (JU.AU.isAS(ret)) {
var list = ret;
for (var j = 0; j < list.length; j++) sb.append(list[j]).append("\n");

continue;
}sb.append(ret);
}
return sb.toString();
}, "~A,~N");
c$.getFormat = Clazz_defineMethod(c$, "getFormat", 
function(sv, pt){
switch (pt) {
case 0:
var name = sv.myName;
sv.myName = null;
var o = sv.toJSON();
sv.myName = name;
return o;
case 5:
case 22:
case 32:
case 38:
var bytes;
switch (sv.tok) {
case 15:
bytes = JU.AU.arrayCopyByte((sv.value).data, -1);
break;
case 7:
var l = sv.getList();
if (pt == 32) {
var l1 =  new JU.Lst();
for (var i = l.size(); --i >= 0; ) l1.addLast(l.get(i));

return l1;
}bytes =  Clazz_newByteArray (l.size(), 0);
for (var i = bytes.length; --i >= 0; ) bytes[i] = l.get(i).asInt();

break;
default:
var s = sv.asString();
if (s.startsWith(";base64,")) {
if (pt == 5) return s;
bytes = JU.Base64.decodeBase64(s);
} else {
if (pt >= 38) {
return s;
}bytes = s.getBytes();
}}
return JS.SV.fromBytes(bytes, pt);
}
return null;
}, "JS.SV,~N");
c$.fromBytes = Clazz_defineMethod(c$, "fromBytes", 
function(bytes, pt){
switch (pt) {
case 22:
return  new JU.BArray(bytes);
case 5:
return ";base64," + JU.Base64.getBase64(bytes).toString();
case 32:
return JS.SV.getVariable(bytes);
case 38:
return  String.instantialize(bytes);
}
return null;
}, "~A,~N");
c$.getBitSet = Clazz_defineMethod(c$, "getBitSet", 
function(x, allowNull){
switch (x.tok) {
case 10:
return (x.index == 2147483647 ? JS.SV.selectItemTok(x, -2147483648) : x).value;
case 7:
return JS.SV.unEscapeBitSetArray(x.getList(), allowNull);
default:
return (allowNull ? null :  new JU.BS());
}
}, "JS.SV,~B");
c$.unEscapeBitSetArray = Clazz_defineMethod(c$, "unEscapeBitSetArray", 
function(x, allowNull){
var bs =  new JU.BS();
for (var i = 0; i < x.size(); i++) {
var v = x.get(i);
if (v.tok == 2 && v.intValue >= 0) {
bs.set(v.intValue);
} else if (v.tok == 7) {
var bs2 = JS.SV.unEscapeBitSetArray(v.getList(), true);
if (bs2 == null) return (allowNull ? null :  new JU.BS());
bs.or(bs2);
} else if (!JS.SV.unEscapeBitSet(v, bs)) {
return (allowNull ? null :  new JU.BS());
}}
return bs;
}, "JU.Lst,~B");
c$.areEqual = Clazz_defineMethod(c$, "areEqual", 
function(x1, x2){
if (x1 == null || x2 == null) return false;
if (x1.value != null && x1.value === x2.value) return true;
if (x1.tok == x2.tok) {
switch (x1.tok) {
case 2:
if (x2.tok == 2) {
return x1.intValue == x2.intValue;
}break;
case 4:
return (x1.value).equalsIgnoreCase(x2.value);
case 10:
case 15:
case 6:
case 7:
case 14:
return x1.equals(x2);
case 8:
return ((x1.value).distance(x2.value) < 0.000001);
case 9:
return ((x1.value).distance4(x2.value) < 0.000001);
case 11:
return (x1.value).equals(x2.value);
case 12:
return (x1.value).equals(x2.value);
}
} else if (x1.tok == 10 && x2.tok == 4 && (x2.value).startsWith(";base90+35,")) {
return (x1.value.equals(JS.SV.decodeBase90_35(x2.value)));
}return (x1.isNaN() ? x2.isNaN() : Math.abs(JS.SV.fValue(x1) - JS.SV.fValue(x2)) < 0.000001);
}, "JS.SV,JS.SV");
c$.isLike = Clazz_defineMethod(c$, "isLike", 
function(x1, x2){
return (x1 != null && x2 != null && x1.tok == 4 && x2.tok == 4 && JU.PT.isLike(x1.value, x2.value));
}, "JS.SV,JS.SV");
c$.contains = Clazz_defineMethod(c$, "contains", 
function(x1, x2){
return (x1 != null && x2 != null && x1.tok == 4 && x2.tok == 4 && (x1.value).contains(x2.value));
}, "JS.SV,JS.SV");
Clazz_defineMethod(c$, "sortOrReverse", 
function(arrayPt){
var x = this.getList();
if (x != null && x.size() > 1) {
if (arrayPt == -2147483648) {
var n = x.size();
for (var i = 0; i < n; i++) {
var v = x.get(i);
x.set(i, x.get(--n));
x.set(n, v);
}
} else {
java.util.Collections.sort(this.getList(), Clazz_innerTypeInstance(JS.SV.Sort, this, null, --arrayPt, null));
}}return this;
}, "~N");
Clazz_defineMethod(c$, "pushPop", 
function(mapKey, value){
if (mapKey == null) {
if (this.tok == 4) {
if (value == null) {
var v = this.value;
var n = v.length - 1;
if (n < 0) {
return JS.SV.newS("");
}var s = v.substring(n);
this.value = v.substring(0, n);
return JS.SV.newS(s);
}this.value = this.value + JS.SV.sValue(value);
return this;
}var m = this.getMap();
if (m == null) {
var x = this.getList();
if (value == null || x == null) {
return (x == null || x.size() == 0 ? JS.SV.newS("") : x.removeItemAt(x.size() - 1));
}x.addLast(JS.SV.copySafely(value));
} else {
if (value == null) {
m.clear();
} else {
var m1 = value.getMap();
if (m1 != null) m.putAll(m1);
}}} else {
var m = this.getMap();
if (value == null) {
var v = null;
if (m == null) {
var lst = this.getList();
var len = lst.size();
var i = JS.SV.iValue(mapKey) - 1;
if (i < 0) i += len;
if (i >= 0 && i < len) {
v = lst.removeItemAt(i);
}} else {
v = m.remove(mapKey.asString());
}return (v == null ? JS.SV.newS("") : v);
}if (m != null) {
this.addToMap(m, mapKey, value);
}}return this;
}, "JS.SV,JS.SV");
Clazz_defineMethod(c$, "addToMap", 
function(m, mapKey, value){
m.put(mapKey.asString(), JS.SV.copySafely(value));
}, "java.util.Map,JS.SV,JS.SV");
c$.unEscapeBitSet = Clazz_defineMethod(c$, "unEscapeBitSet", 
function(x, bs){
switch (x.tok) {
case 4:
var bs1 = JU.BS.unescape(x.value);
if (bs1 == null) return false;
bs.or(bs1);
return true;
case 10:
bs.or(x.value);
return true;
}
return false;
}, "JS.SV,JU.BS");
c$.strListValue = Clazz_defineMethod(c$, "strListValue", 
function(x){
if (x.tok != 7) return  Clazz_newArray(-1, [JS.SV.sValue(x)]);
var sv = (x).getList();
var list =  new Array(sv.size());
for (var i = sv.size(); --i >= 0; ) list[i] = JS.SV.sValue(sv.get(i));

return list;
}, "JS.T");
c$.getArrayDepth = Clazz_defineMethod(c$, "getArrayDepth", 
function(x){
var n = 0;
var sv;
while (x.tok == 7 && (sv = (x).getList()).size() > 0) {
n++;
x = sv.get(0);
}
return n;
}, "JS.T");
c$.fflistValue = Clazz_defineMethod(c$, "fflistValue", 
function(x, nMin){
if (x.tok != 7) {
return  Clazz_newArray(-1, [ Clazz_newFloatArray(-1, [JS.SV.fValue(x)])]);
}var sv = (x).getList();
var svlen = sv.size();
var list;
list = JU.AU.newFloat2(svlen);
if (nMin == 0) nMin = list.length;
for (var i = list.length; --i >= 0; ) list[i] = JS.SV.flistValue(i >= svlen ? null : sv.get(i), 0);

return list;
}, "JS.T,~N");
c$.flistValue = Clazz_defineMethod(c$, "flistValue", 
function(x, nMin){
if (x == null || x.tok != 7) return  Clazz_newFloatArray(-1, [JS.SV.fValue(x)]);
var sv = (x).getList();
var list;
list =  Clazz_newFloatArray (Math.max(nMin, sv.size()), 0);
if (nMin == 0) nMin = list.length;
for (var i = Math.min(sv.size(), nMin); --i >= 0; ) list[i] = JS.SV.fValue(sv.get(i));

return list;
}, "JS.T,~N");
Clazz_defineMethod(c$, "toArray", 
function(){
var dim;
var o2;
var m3 = null;
var m4 = null;
switch (this.tok) {
case 10:
o2 =  new JU.Lst();
var bs = JS.SV.getBitSet(this, true);
for (var i = bs.nextSetBit(0); i >= 0; i = bs.nextSetBit(i + 1)) {
o2.addLast(JS.SV.newI(i));
}
return JS.SV.newV(7, o2);
case 11:
m3 = this.value;
dim = 3;
break;
case 12:
m4 = this.value;
dim = 4;
break;
case 7:
return this;
case 1275068418:
return this.arrayToList( new JS.SV());
default:
o2 =  new JU.Lst();
o2.addLast(this);
return JS.SV.newV(7, o2);
}
o2 =  new JU.Lst();
for (var i = 0; i < dim; i++) {
var a =  Clazz_newFloatArray (dim, 0);
if (m3 == null) m4.getRow(i, a);
 else m3.getRow(i, a);
o2.addLast(JS.SV.getVariableAF(a));
}
return JS.SV.newV(7, o2);
});
Clazz_defineMethod(c$, "arrayToList", 
function(target){
if (this.tok != 1275068418 || target == null) return null;
var ao = this.value;
var v =  new JU.Lst();
for (var i = 0, n = ao.length; i < n; i++) {
v.addLast(JS.SV.getVariable(ao[i]));
}
target.tok = 7;
target.value = v;
return target;
}, "JS.SV");
Clazz_defineMethod(c$, "mapValue", 
function(key){
switch (this.tok) {
case 6:
var sv = (this.value).get(key);
if (sv == null && key.equals("length") && (this.value).containsKey("_DATA_")) {
sv = (this.value).get("_DATA_");
return JS.SV.newI((sv.value).data.length);
}return sv;
case 14:
var sc = (this.value);
return (key.equals("_path") ? JS.SV.newS(sc.contextPath) : sc.getVariable(key));
}
return null;
}, "~S");
Clazz_defineMethod(c$, "getList", 
function(){
switch (this.tok) {
case 7:
return this.value;
case 1275068418:
this.tok = 7;
this.value = this.toArray().value;
return this.value;
default:
return null;
}
});
c$.isScalar = Clazz_defineMethod(c$, "isScalar", 
function(x){
switch (x.tok) {
case 7:
return false;
case 4:
return ((x.value).indexOf("\n") < 0);
default:
return true;
}
}, "JS.SV");
Clazz_overrideMethod(c$, "toJSON", 
function(){
switch (this.tok) {
case 1073742335:
case 1073742334:
case 2:
case 3:
return JS.SV.sValue(this);
case 15:
return JU.PT.byteArrayToJSON((this.value).data);
case 14:
return JU.PT.toJSON(null, (this.value).getFullMap());
case 7:
case 6:
if (this.myName != null) {
this.myName = null;
return (this.tok == 6 ? "{  }" : "[  ]");
}this.myName = "x";
var s = JU.PT.toJSON(null, this.value);
this.myName = null;
return s;
default:
return JU.PT.toJSON(null, this.value);
}
});
Clazz_defineMethod(c$, "mapGet", 
function(key){
return this.getMap().get(key);
}, "~S");
Clazz_defineMethod(c$, "mapPut", 
function(key, v){
switch (this.tok) {
case 6:
case 14:
this.getMap().put(key, JS.SV.copySafely(v));
break;
}
}, "~S,JS.SV");
Clazz_defineMethod(c$, "getMap", 
function(){
switch (this.tok) {
case 6:
return this.value;
case 14:
return (this.value).vars;
}
return null;
});
Clazz_defineMethod(c$, "getMapKeys", 
function(nLevels, skipEmpty){
if (this.tok != 6) return "";
var sb =  new JU.SB();
JS.SV.sValueArray(sb, this, "", "", true, false, false, nLevels + 1, skipEmpty);
return sb.toString();
}, "~N,~B");
Clazz_overrideMethod(c$, "toString", 
function(){
return this.toString2() + "[" + this.myName + " index =" + this.index + " intValue=" + this.intValue + "]";
});
Clazz_defineMethod(c$, "getKeys", 
function(isAll){
switch (this.tok) {
case 6:
case 14:
case 7:
break;
default:
return null;
}
var keys =  new JU.Lst();
this.getKeyList(isAll, keys, "");
var skeys = keys.toArray( new Array(keys.size()));
java.util.Arrays.sort(skeys);
return skeys;
}, "~B");
Clazz_defineMethod(c$, "getKeyList", 
function(isAll, keys, prefix){
var map = this.getMap();
if (map == null) {
if (isAll) {
var lst;
var n;
if ((lst = this.getList()) != null && (n = lst.size()) > 0) lst.get(n - 1).getKeyList(true, keys, prefix + "." + n + ".");
}return;
}for (var e, $e = map.entrySet().iterator (); $e.hasNext()&& ((e = $e.next ()) || true);) {
var k = e.getKey();
if (isAll) {
var hasDot = prefix.endsWith(".");
if (k.length == 0 || !JU.PT.isLetter(k.charAt(0))) {
if (hasDot) prefix = prefix.substring(0, prefix.length - 1);
k = "[" + JU.PT.esc(k) + "]";
} else if (!hasDot && prefix.length > 0) {
prefix += ".";
}keys.addLast(prefix + k);
e.getValue().getKeyList(true, keys, prefix + k + ".");
} else {
keys.addLast(prefix + k);
}}
}, "~B,JU.Lst,~S");
c$.deepCopy = Clazz_defineMethod(c$, "deepCopy", 
function(v, isHash, isDeep){
if (isHash) {
var vold = v;
var vnew =  new java.util.Hashtable();
for (var e, $e = vold.entrySet().iterator (); $e.hasNext()&& ((e = $e.next ()) || true);) {
var v1 = e.getValue();
vnew.put(e.getKey(), isDeep ? JS.SV.deepCopySV(v1) : v1);
}
return vnew;
}var vold2 = v;
var vnew2 =  new JU.Lst();
for (var i = 0, n = vold2.size(); i < n; i++) {
var vm = vold2.get(i);
vnew2.addLast(isDeep ? JS.SV.deepCopySV(vm) : vm);
}
return vnew2;
}, "~O,~B,~B");
c$.deepCopySV = Clazz_defineMethod(c$, "deepCopySV", 
function(vm){
switch (vm.tok) {
case 6:
case 7:
if ("\r".equals(vm.myName)) {
vm.myName = null;
vm = JS.SV.newV(vm.tok, (vm.tok == 6 ?  new java.util.Hashtable() :  new JU.Lst()));
} else {
var name0 = vm.myName;
vm.myName = "\r";
var vm0 = vm;
vm = JS.SV.newV(vm.tok, JS.SV.deepCopy(vm.value, vm.tok == 6, true));
vm0.myName = name0;
}break;
}
return vm;
}, "JS.SV");
Clazz_defineMethod(c$, "sortMapArray", 
function(key){
var lst = this.getList();
if (lst != null) {
java.util.Collections.sort(this.getList(), Clazz_innerTypeInstance(JS.SV.Sort, this, null, 0, key));
}return this;
}, "~S");
c$.safeJSON = Clazz_defineMethod(c$, "safeJSON", 
function(key, property){
return "{" + (Clazz_instanceOf(property,"JS.SV") ? JU.PT.esc(key) + " : " + JS.SV.format( Clazz_newArray(-1, [null, property]), 0) : JU.PT.toJSON(key, property)) + "}";
}, "~S,~O");
Clazz_defineMethod(c$, "isNaN", 
function(){
return (this === JS.SV.vNaN || "NaN".equals(this.value));
});
c$.$SV$Sort$ = function(){
/*if4*/;(function(){
var c$ = Clazz_decorateAsClass(function(){
Clazz_prepareCallback(this, arguments);
this.arrayPt = 0;
this.myKey = null;
Clazz_instantialize(this, arguments);}, JS.SV, "Sort", null, java.util.Comparator);
Clazz_makeConstructor(c$, 
function(arrayPt, myKey){
this.arrayPt = arrayPt;
this.myKey = myKey;
}, "~N,~S");
Clazz_overrideMethod(c$, "compare", 
function(x, y){
if (x.tok != y.tok) {
if (x.tok == 3 || x.tok == 2 || y.tok == 3 || y.tok == 2) {
var fx = JS.SV.fValue(x);
var fy = JS.SV.fValue(y);
return (fx < fy ? -1 : fx > fy ? 1 : 0);
}if (x.tok == 4 || y.tok == 4) return JS.SV.sValue(x).compareTo(JS.SV.sValue(y));
}switch (x.tok) {
case 2:
return (x.intValue < y.intValue ? -1 : x.intValue > y.intValue ? 1 : 0);
case 4:
return JS.SV.sValue(x).compareTo(JS.SV.sValue(y));
case 7:
var sx = x.getList();
var sy = y.getList();
if (sx.size() != sy.size()) return (sx.size() < sy.size() ? -1 : 1);
var iPt = this.arrayPt;
if (iPt < 0) iPt += sx.size();
if (iPt < 0 || iPt >= sx.size()) return 0;
return this.compare(sx.get(iPt), sy.get(iPt));
case 6:
if (this.myKey != null) {
return this.compare(x.getMap().get(this.myKey), y.getMap().get(this.myKey));
}default:
var fx = JS.SV.fValue(x);
var fy = JS.SV.fValue(y);
return (fx < fy ? -1 : fx > fy ? 1 : 0);
}
}, "JS.SV,JS.SV");
/*eoif4*/})();
};
c$.vT = JS.SV.newSV(1073742335, 1, "true");
c$.vF = JS.SV.newSV(1073742334, 0, "false");
c$.vNaN = JS.SV.newSV(3, 2147483647, Float.$valueOf(NaN));
c$.pt0 =  new JU.P3();
c$.jvxlCoder = null;
});
;//5.0.1-v7 Mon Aug 24 10:01:38 CDT 2026
Clazz_declarePackage("JS");
Clazz_load(["java.util.Hashtable"], "JS.T", ["java.util.Arrays", "JU.AU", "$.Lst", "JU.Logger"], function(){
var c$ = Clazz_decorateAsClass(function(){
this.tok = 0;
this.value = null;
this.intValue = 2147483647;
Clazz_instantialize(this, arguments);}, JS, "T", null);
c$.t = Clazz_defineMethod(c$, "t", 
function(tok){
var token =  new JS.T();
token.tok = tok;
return token;
}, "~N");
c$.tv = Clazz_defineMethod(c$, "tv", 
function(tok, intValue, value){
var token = JS.T.t(tok);
token.intValue = intValue;
token.value = value;
return token;
}, "~N,~N,~O");
c$.o = Clazz_defineMethod(c$, "o", 
function(tok, value){
var token = JS.T.t(tok);
token.value = value;
return token;
}, "~N,~O");
c$.n = Clazz_defineMethod(c$, "n", 
function(tok, intValue){
var token = JS.T.t(tok);
token.intValue = intValue;
return token;
}, "~N,~N");
c$.i = Clazz_defineMethod(c$, "i", 
function(intValue){
var token = JS.T.t(2);
token.intValue = intValue;
return token;
}, "~N");
c$.tokAttr = Clazz_defineMethod(c$, "tokAttr", 
function(a, b){
return (a & b) == (b & b);
}, "~N,~N");
c$.tokAttrOr = Clazz_defineMethod(c$, "tokAttrOr", 
function(a, b1, b2){
return (a & b1) == (b1 & b1) || (a & b2) == (b2 & b2);
}, "~N,~N,~N");
c$.getPrecedence = Clazz_defineMethod(c$, "getPrecedence", 
function(tokOperator){
return ((tokOperator >> 9) & 0xF);
}, "~N");
c$.getMaxMathParams = Clazz_defineMethod(c$, "getMaxMathParams", 
function(tokCommand){
return ((tokCommand >> 9) & 0x3);
}, "~N");
c$.addToken = Clazz_defineMethod(c$, "addToken", 
function(ident, token){
JS.T.tokenMap.put(ident, token);
}, "~S,JS.T");
c$.getTokenFromName = Clazz_defineMethod(c$, "getTokenFromName", 
function(name){
return JS.T.tokenMap.get(name);
}, "~S");
c$.getTokFromName = Clazz_defineMethod(c$, "getTokFromName", 
function(name){
var token = JS.T.getTokenFromName(name.toLowerCase());
return (token == null ? 0 : token.tok);
}, "~S");
c$.nameOf = Clazz_defineMethod(c$, "nameOf", 
function(tok){
for (var token, $token = JS.T.tokenMap.values().iterator (); $token.hasNext()&& ((token = $token.next ()) || true);) {
if (token.tok == tok) return "" + token.value;
}
return "0x" + Integer.toHexString(tok);
}, "~N");
Clazz_overrideMethod(c$, "toString", 
function(){
return this.toString2();
});
Clazz_defineMethod(c$, "toString2", 
function(){
return "Token[" + JS.T.astrType[this.tok < 16 ? this.tok : 16] + "(" + (this.tok % 1000) + "/0x" + Integer.toHexString(this.tok) + ")" + ((this.intValue == 2147483647) ? "" : " intValue=" + this.intValue + "(0x" + Integer.toHexString(this.intValue) + ")") + ((this.value == null) ? "" : (typeof(this.value)=='string') ? " value=\"" + this.value + "\"" : Clazz_instanceOf(this.value,"JS.SV") ? " value=\"" + (this.value).asString() + "\"" : " value=" + this.value) + "]";
});
c$.getCommandSet = Clazz_defineMethod(c$, "getCommandSet", 
function(strBegin){
var cmds = "";
var htSet =  new java.util.Hashtable();
var nCmds = 0;
var s = (strBegin == null || strBegin.length == 0 ? null : strBegin.toLowerCase());
var isMultiCharacter = (s != null && s.length > 1);
for (var entry, $entry = JS.T.tokenMap.entrySet().iterator (); $entry.hasNext()&& ((entry = $entry.next ()) || true);) {
var name = entry.getKey();
var token = entry.getValue();
if ((token.tok & 4096) != 0 && (s == null || name.indexOf(s) == 0) && (isMultiCharacter || (token.value).equals(name))) htSet.put(name, Boolean.TRUE);
}
for (var entry, $entry = htSet.entrySet().iterator (); $entry.hasNext()&& ((entry = $entry.next ()) || true);) {
var name = entry.getKey();
if (name.charAt(name.length - 1) != 's' || !htSet.containsKey(name.substring(0, name.length - 1))) cmds += (nCmds++ == 0 ? "" : ";") + name;
}
return cmds;
}, "~S");
c$.getAtomPropertiesLike = Clazz_defineMethod(c$, "getAtomPropertiesLike", 
function(type){
type = type.toLowerCase();
var v =  new JU.Lst();
var isAll = (type.length == 0);
for (var entry, $entry = JS.T.tokenMap.entrySet().iterator (); $entry.hasNext()&& ((entry = $entry.next ()) || true);) {
var name = entry.getKey();
if (name.charAt(0) == '_') continue;
var token = entry.getValue();
if (JS.T.tokAttr(token.tok, 1077936128) && (isAll || name.toLowerCase().startsWith(type))) {
if (isAll || !(token.value).toLowerCase().startsWith(type)) token = JS.T.o(token.tok, name);
v.addLast(token);
}}
return (v.size() == 0 ? null : v);
}, "~S");
c$.getTokensLike = Clazz_defineMethod(c$, "getTokensLike", 
function(type){
var attr = (type.equals("setparam") ? 536870912 : type.equals("misc") ? 1073741824 : type.equals("mathfunc") ? 134217728 : 4096);
var notattr = (attr == 536870912 ? 1610612736 : 0);
var v =  new JU.Lst();
for (var entry, $entry = JS.T.tokenMap.entrySet().iterator (); $entry.hasNext()&& ((entry = $entry.next ()) || true);) {
var name = entry.getKey();
var token = entry.getValue();
if (JS.T.tokAttr(token.tok, attr) && (notattr == 0 || !JS.T.tokAttr(token.tok, notattr))) v.addLast(name);
}
var a = v.toArray( new Array(v.size()));
java.util.Arrays.sort(a);
return a;
}, "~S");
c$.getSettableTokFromString = Clazz_defineMethod(c$, "getSettableTokFromString", 
function(s){
var tok = JS.T.getTokFromName(s);
return (tok != 0 && JS.T.tokAttr(tok, 2048) && !JS.T.tokAttr(tok, 1140850688) ? tok : 0);
}, "~S");
c$.completeCommand = Clazz_defineMethod(c$, "completeCommand", 
function(map, isSet, asCommand, str, n){
if (map == null) map = JS.T.tokenMap;
 else asCommand = false;
var v =  new JU.Lst();
str = str.toLowerCase();
for (var name, $name = map.keySet().iterator (); $name.hasNext()&& ((name = $name.next ()) || true);) {
if (!name.startsWith(str)) continue;
var tok = JS.T.getTokFromName(name);
if (asCommand ? JS.T.tokAttr(tok, 4096) : isSet ? JS.T.tokAttr(tok, 536870912) && !JS.T.tokAttr(tok, 1610612736) : true) v.addLast(name);
}
return JU.AU.sortedItem(v, n);
}, "java.util.Map,~B,~B,~S,~N");
c$.getParamType = Clazz_defineMethod(c$, "getParamType", 
function(tok){
if (!JS.T.tokAttr(tok, 536870912)) return 0;
return tok & 662700032;
}, "~N");
c$.getTokensType = Clazz_defineMethod(c$, "getTokensType", 
function(map, attr){
for (var e, $e = JS.T.tokenMap.entrySet().iterator (); $e.hasNext()&& ((e = $e.next ()) || true);) {
var t = e.getValue();
if (JS.T.tokAttr(t.tok, attr)) map.put(e.getKey(), e.getValue());
}
}, "java.util.Map,~N");
c$.isIDcmd = Clazz_defineMethod(c$, "isIDcmd", 
function(cmdtok){
switch (cmdtok) {
case 135180:
case 135176:
case 135174:
case 135188:
case 134353926:
return true;
default:
return false;
}
}, "~N");
Clazz_defineMethod(c$, "equals", 
function(o){
if (!(Clazz_instanceOf(o,"JS.T"))) return false;
var t = o;
if (this.tok == t.tok) return (t.intValue == this.intValue && (this.tok == 2 || this.tok == 1073742335 || this.tok == 1073742334 || t.value.equals(this.value)));
switch (this.tok) {
case 2:
return (t.tok == 3 && (t.value).floatValue() == this.intValue);
case 3:
return (t.tok == 2 && (this.value).floatValue() == t.intValue);
default:
return false;
}
}, "~O");
{
JS.T.astrType = "nada identifier integer decimal string inscode hash array point point4 bitset matrix3f matrix4f array hash bytearray keyword".$plit(" ");
}c$.tokenSpaceBeforeSquare = JS.T.o(1073742195, " ");
c$.tokenOn = JS.T.tv(1073742335, 1, "on");
c$.tokenOff = JS.T.tv(1073742334, 0, "off");
c$.tokenAll = JS.T.o(1073742327, "all");
c$.tokenIf = JS.T.o(134320649, "if");
c$.tokenAnd = JS.T.o(268438528, "and");
c$.tokenAndSpec = JS.T.o(268439552, "");
c$.tokenOr = JS.T.o(268438016, "or");
c$.tokenAndFALSE = JS.T.o(268438528, "and");
c$.tokenOrTRUE = JS.T.o(268438016, "or");
c$.tokenOpIf = JS.T.o(805307393, "?");
c$.tokenComma = JS.T.o(268436992, ",");
c$.tokenDefineString = JS.T.tv(12290, 4, "@");
c$.tokenPlus = JS.T.o(268440577, "+");
c$.tokenMinus = JS.T.o(268440576, "-");
c$.tokenMul3 = JS.T.o(1275068930, "mul3");
c$.tokenTimes = JS.T.o(268441089, "*");
c$.tokenDivide = JS.T.o(268441088, "/");
c$.tokenLength = JS.T.tv(268442113, 1275068435, "len3");
c$.tokenLeftParen = JS.T.o(268435968, "(");
c$.tokenRightParen = JS.T.o(268435969, ")");
c$.tokenArraySquare = JS.T.o(1275068418, "[");
c$.tokenArrayOpen = JS.T.o(268437504, "[");
c$.tokenArrayClose = JS.T.o(268437505, "]");
c$.tokenLeftBrace = JS.T.o(1073742332, "{");
c$.tokenExpressionBegin = JS.T.o(1073742325, "expressionBegin");
c$.tokenExpressionEnd = JS.T.o(1073742326, "expressionEnd");
c$.tokenConnected = JS.T.o(134217736, "connected");
c$.tokenCoordinateBegin = JS.T.o(1073742332, "{");
c$.tokenRightBrace = JS.T.o(1073742338, "}");
c$.tokenCoordinateEnd = JS.T.tokenRightBrace;
c$.tokenColon = JS.T.o(268436482, ":");
c$.tokenSetCmd = JS.T.o(36867, "set");
c$.tokenSet = JS.T.tv(36867, 61, "");
c$.tokenSetArray = JS.T.tv(36867, 91, "");
c$.tokenSetProperty = JS.T.tv(36867, 46, "");
c$.tokenSetVar = JS.T.tv(36868, 61, "var");
c$.tokenEquals = JS.T.o(268440324, "=");
c$.tokenScript = JS.T.o(134222850, "script");
c$.tokenSwitch = JS.T.o(102410, "switch");
c$.tokenMap =  new java.util.Hashtable();
{
var arrayPairs =  Clazz_newArray(-1, ["(", JS.T.tokenLeftParen, ")", JS.T.tokenRightParen, "and", JS.T.tokenAnd, "&", null, "&&", null, "or", JS.T.tokenOr, "|", null, "||", null, "?", JS.T.tokenOpIf, ",", JS.T.tokenComma, "=", JS.T.tokenEquals, "==", null, ":", JS.T.tokenColon, "+", JS.T.tokenPlus, "-", JS.T.tokenMinus, "*", JS.T.tokenTimes, "/", JS.T.tokenDivide, "script", JS.T.tokenScript, "source", null, "set", JS.T.tokenSetCmd, "switch", JS.T.tokenSwitch, "all", JS.T.tokenAll, "off", JS.T.tokenOff, "false", null, "on", JS.T.tokenOn, "true", null]);
var tokenThis;
var tokenLast = null;
var sTok;
var lcase;
var n = arrayPairs.length - 1;
for (var i = 0; i < n; i += 2) {
sTok = arrayPairs[i];
lcase = sTok.toLowerCase();
tokenThis = arrayPairs[i + 1];
if (tokenThis == null) tokenThis = tokenLast;
 else if (tokenThis.value == null) tokenThis.value = sTok;
JS.T.tokenMap.put(lcase, tokenThis);
tokenLast = tokenThis;
}
arrayPairs = null;
var sTokens =  Clazz_newArray(-1, ["+=", "-=", "*=", "/=", "\\=", "&=", "|=", "not", "!", "xor", "tog", "<", "<=", ">=", ">", "!=", "<>", "LIKE", "CONTAINS", "within", ".", "..", "[", "]", "{", "}", "$", "%", ";", "++", "--", "**", "\\", "animation", "anim", "assign", "axes", "backbone", "background", "bind", "bondorder", "boundbox", "boundingBox", "break", "calculate", "capture", "cartoon", "cartoons", "case", "catch", "cd", "center", "centre", "centerat", "cgo", "color", "colour", "compare", "configuration", "conformation", "config", "connect", "console", "contact", "contacts", "continue", "data", "default", "define", "@", "delay", "delete", "density", "depth", "dipole", "dipoles", "display", "dot", "dots", "draw", "echo", "ellipsoid", "ellipsoids", "else", "elseif", "end", "endif", "exit", "eval", "file", "files", "font", "for", "format", "frame", "frames", "frank", "function", "functions", "geosurface", "getProperty", "goto", "halo", "halos", "helix", "helixalpha", "helix310", "helixpi", "hbond", "hbonds", "help", "hide", "history", "hover", "if", "in", "initialize", "invertSelected", "isosurface", "javascript", "label", "labels", "lcaoCartoon", "lcaoCartoons", "load", "log", "loop", "matrix", "measure", "measures", "monitor", "monitors", "meshribbon", "meshribbons", "message", "minimize", "minimization", "mo", "mode2d", "model", "models", "modulation", "move", "moveTo", "mutate", "navigate", "navigation", "nbo", "origin", "out", "parallel", "pause", "wait", "plot", "private", "plot3d", "pmesh", "polygon", "polyhedra", "polyhedron", "print", "process", "prompt", "quaternion", "quaternions", "quit", "ramachandran", "rama", "refresh", "reset", "unset", "restore", "restrict", "return", "ribbon", "ribbons", "rocket", "rockets", "rotate", "rotateSelected", "save", "select", "selectionHalos", "selectionHalo", "showSelections", "sheet", "show", "slab", "spacefill", "cpk", "spin", "ssbond", "ssbonds", "star", "stars", "step", "steps", "stereo", "strand", "strands", "structure", "_structure", "strucNo", "struts", "strut", "subset", "subsystem", "synchronize", "sync", "this", "trace", "translate", "translateSelected", "try", "unbind", "unitcell", "var", "varna", "vector", "vectors", "vibration", "while", "wireframe", "write", "zap", "zoom", "zoomTo", "atom", "atoms", "axisangle", "basepair", "basepairs", "orientation", "orientations", "pdbheader", "polymer", "polymers", "residue", "residues", "rotation", "row", "sequence", "seqcode", "shape", "state", "symbol", "symmetry", "symmetryHM", "spaceGroup", "transform", "translation", "url", "_", "abs", "absolute", "_args", "acos", "add", "adpmax", "adpmin", "align", "altloc", "altlocs", "ambientOcclusion", "amino", "angle", "array", "as", "_a", "atomID", "_atomID", "atomIndex", "atomName", "atomno", "atomType", "atomX", "atomY", "atomZ", "average", "babel", "babel21", "back", "backlit", "backshell", "balls", "baseModel", "best", "beta", "bin", "bondCount", "bonded", "bottom", "branch", "brillouin", "bzone", "cache", "carbohydrate", "cell", "chain", "chains", "chainNo", "chemicalShift", "cs", "clash", "clear", "clickable", "clipboard", "connected", "context", "constraint", "contourLines", "coord", "coordinates", "coords", "cos", "cross", "covalentRadius", "covalent", "direction", "displacement", "displayed", "distance", "div", "DNA", "domains", "dotted", "DSSP", "DSSR", "element", "elemno", "_e", "error", "exportScale", "fill", "find", "fixedTemperature", "forcefield", "formalCharge", "charge", "eta", "front", "frontlit", "frontOnly", "fullylit", "fx", "fy", "fz", "fxyz", "fux", "fuy", "fuz", "fuxyz", "group", "groups", "group1", "_g", "groupID", "_groupID", "groupIndex", "hidden", "highlight", "hkl", "hydrophobicity", "hydrophobic", "hydro", "id", "identify", "ident", "image", "info", "infoFontSize", "inline", "insertion", "insertions", "intramolecular", "intra", "intermolecular", "inter", "bondingRadius", "ionicRadius", "ionic", "isAromatic", "Jmol", "JSON", "join", "keys", "last", "left", "length", "lines", "list", "magneticShielding", "ms", "mass", "max", "mep", "mesh", "middle", "min", "mlp", "mode", "modify", "modifyOrCreate", "modt", "modt1", "modt2", "modt3", "modx", "mody", "modz", "modo", "modxyz", "molecule", "molecules", "modelIndex", "monomer", "morph", "movie", "mouse", "mul", "mul3", "nboCharges", "nci", "next", "noDelay", "noDots", "noFill", "noMesh", "none", "null", "inherit", "normal", "noBackshell", "noContourLines", "notFrontOnly", "noTriangles", "now", "nucleic", "occupancy", "omega", "only", "opaque", "options", "partialCharge", "pattern", "phi", "pivot", "plane", "planar", "play", "playRev", "point", "points", "pointGroup", "polymerLength", "pop", "previous", "prev", "probe", "property", "properties", "protein", "psi", "purine", "push", "PyMOL", "pyrimidine", "random", "range", "rasmol", "replace", "resno", "resume", "rewind", "reverse", "right", "rmsd", "RNA", "rna3d", "rock", "rubberband", "rxyz", "saSurface", "saved", "scale", "scene", "search", "smarts", "selected", "seqid", "shapely", "sidechain", "sin", "site", "size", "smiles", "substructure", "solid", "sort", "specialPosition", "spinOp", "sqrt", "split", "starWidth", "starScale", "stddev", "straightness", "structureId", "supercell", "sub", "sum", "sum2", "surface", "surfaceDistance", "symop", "symops", "sx", "sy", "sz", "sxyz", "tan", "temperature", "relativeTemperature", "tensor", "theta", "thisModel", "ticks", "top", "torsion", "trajectory", "trajectories", "translucent", "transparent", "triangles", "trim", "type", "ux", "uy", "uz", "uxyz", "user", "uvw", "valence", "vanderWaals", "vdw", "vdwRadius", "visible", "volume", "vx", "vy", "vz", "vxyz", "xyz", "w", "wyckoff", "wyckoffm", "x", "y", "z", "addHydrogens", "allConnected", "angstroms", "anisotropy", "append", "arc", "area", "aromatic", "arrow", "async", "audio", "auto", "axis", "barb", "binary", "blockData", "cancel", "cap", "cavity", "centroid", "check", "checkCIR", "chemical", "circle", "collapsed", "col", "colorScheme", "command", "commands", "contour", "contours", "corners", "count", "criterion", "create", "crossed", "curve", "cutoff", "cylinder", "diameter", "discrete", "distanceFactor", "downsample", "drawing", "dynamicMeasurements", "eccentricity", "ed", "edges", "edgesOnly", "energy", "exitJmol", "faceCenterOffset", "filter", "first", "fixed", "fix", "flat", "fps", "from", "frontEdges", "full", "fullPlane", "functionXY", "functionXYZ", "gridPoints", "hiddenLinesDashed", "homo", "ignore", "InChI", "InChIKey", "increment", "insideout", "interior", "intersection", "intersect", "internal", "lattice", "line", "lineData", "link", "lobe", "lonePair", "lp", "lumo", "macro", "macros", "manifest", "mapProperty", "maxSet", "menu", "minSet", "modelBased", "molecular", "mrc", "msms", "name", "nmr", "noCross", "noDebug", "noEdges", "noHead", "noLoad", "noPlane", "object", "obj", "offset", "offsetSide", "once", "orbital", "atomicOrbital", "packed", "palindrome", "parameters", "path", "pdb", "period", "periodic", "perpendicular", "perp", "phase", "planarParam", "pocket", "pointsPerAngstrom", "radical", "rad", "reference", "remove", "resolution", "reverseColor", "rotate45", "selection", "sigma", "sign", "silent", "sphere", "squared", "stdInChI", "stdInChIKey", "stop", "title", "titleFormat", "to", "validation", "value", "variable", "variables", "vertices", "width", "wigner", "wignerSeitz", "backgroundModel", "celShading", "celShadingPower", "debug", "debugHigh", "defaultLattice", "measurements", "measurement", "scale3D", "toggleLabel", "userColorScheme", "throw", "timeout", "timeouts", "window", "animationMode", "appletProxy", "atomTypes", "axesColor", "axis1Color", "axis2Color", "axis3Color", "backgroundColor", "bondmode", "boundBoxColor", "boundingBoxColor", "chirality", "cipRule", "currentLocalPath", "dataSeparator", "defaultAngleLabel", "defaultColorScheme", "defaultColors", "defaultDirectory", "defaultDistanceLabel", "defaultDropScript", "defaultLabelPDB", "defaultLabelXYZ", "defaultLoadFilter", "defaultLoadScript", "defaults", "defaultTorsionLabel", "defaultVDW", "drawFontSize", "eds", "edsDiff", "energyUnits", "fileCacheDirectory", "fontsize", "helpPath", "hoverLabel", "language", "loadFormat", "loadLigandFormat", "logFile", "measurementUnits", "nihResolverFormat", "nmrPredictFormat", "nmrUrlFormat", "pathForAllFiles", "picking", "pickingStyle", "pickLabel", "platformSpeed", "propertyColorScheme", "quaternionFrame", "smilesUrlFormat", "smiles2dImageFormat", "unitCellColor", "axesOffset", "axisOffset", "axesScale", "axisScale", "bondTolerance", "cameraDepth", "defaultDrawArrowScale", "defaultTranslucent", "dipoleScale", "ellipsoidAxisDiameter", "gestureSwipeFactor", "hbondsAngleMinimum", "hbondHXDistanceMaximum", "hbondsDistanceMaximum", "hbondNODistanceMaximum", "hoverDelay", "loadAtomDataTolerance", "minBondDistance", "minimizationCriterion", "minimizationMaxAtoms", "modulationScale", "mouseDragFactor", "mouseWheelFactor", "navFPS", "navigationDepth", "navigationSlab", "navigationSpeed", "navX", "navY", "navZ", "particleRadius", "pointGroupDistanceTolerance", "pointGroupLinearTolerance", "radius", "rotationRadius", "scaleAngstromsPerInch", "sheetSmoothing", "slabRange", "solventProbeRadius", "spinFPS", "spinX", "spinY", "spinZ", "stereoDegrees", "strutDefaultRadius", "strutLengthMaximum", "vectorScale", "vectorsCentered", "vectorSymmetry", "vectorTrail", "vibrationPeriod", "vibrationScale", "visualRange", "ambientPercent", "ambient", "animationFps", "axesMode", "bondRadiusMilliAngstroms", "bondingVersion", "delayMaximumMs", "diffusePercent", "diffuse", "dotDensity", "dotScale", "ellipsoidDotCount", "helixStep", "hermiteLevel", "historyLevel", "labelpointerwidth", "lighting", "logLevel", "meshScale", "minimizationReportSteps", "minimizationSteps", "minPixelSelRadius", "percentVdwAtom", "perspectiveModel", "phongExponent", "pickingSpinRate", "propertyAtomNumberField", "propertyAtomNumberColumnCount", "propertyDataColumnCount", "propertyDataField", "repaintWaitMs", "ribbonAspectRatio", "contextDepthMax", "scriptReportingLevel", "showScript", "smallMoleculeMaxAtoms", "specular", "specularExponent", "specularPercent", "specPercent", "specularPower", "specpower", "strandCount", "strandCountForMeshRibbon", "strandCountForStrands", "strutSpacing", "zDepth", "zSlab", "zshadePower", "allowEmbeddedScripts", "allowGestures", "allowKeyStrokes", "allowModelKit", "allowMoveAtoms", "allowMultiTouch", "allowRotateSelected", "antialiasDisplay", "antialiasImages", "antialiasTranslucent", "appendNew", "applySymmetryToBonds", "atomPicking", "allowAudio", "autobond", "autoFPS", "autoplayMovie", "axesMolecular", "axesOrientationRasmol", "axesUnitCell", "axesWindow", "bondModeOr", "bondPicking", "bonds", "bond", "cartoonBaseEdges", "cartoonBlocks", "cartoonBlockHeight", "cartoonsFancy", "cartoonFancy", "cartoonLadders", "cartoonRibose", "cartoonRockets", "cartoonSteps", "chainCaseSensitive", "cipRule6Full", "colorRasmol", "debugScript", "defaultStructureDssp", "disablePopupMenu", "displayCellParameters", "showUnitcellInfo", "dotsSelectedOnly", "dotSurface", "doublePrecision", "dragSelected", "drawHover", "drawPicking", "dsspCalculateHydrogenAlways", "elementKey", "ellipsoidArcs", "ellipsoidArrows", "ellipsoidAxes", "ellipsoidBall", "ellipsoidDots", "ellipsoidFill", "fileCaching", "fontCaching", "fontScaling", "forceAutoBond", "fractionalRelative", "greyscaleRendering", "hbondsBackbone", "hbondsRasmol", "hbondsSolid", "hetero", "hideNameInPopup", "hideNavigationPoint", "hideNotSelected", "highResolution", "hydrogen", "hydrogens", "imageState", "isKiosk", "isosurfaceKey", "isosurfacePropertySmoothing", "isosurfacePropertySmoothingPower", "jmolInJSpecView", "justifyMeasurements", "labelKey", "languageTranslation", "leadAtom", "leadAtoms", "legacyAutoBonding", "legacyHAddition", "legacyJavaFloat", "logCommands", "logGestures", "macroDirectory", "measureAllModels", "measurementLabels", "measurementNumbers", "messageStyleChime", "minimizationRefresh", "minimizationSilent", "modelkit", "modelkitMode", "modulateOccupancy", "monitorEnergy", "multiplebondbananas", "multipleBondRadiusFactor", "multipleBondSpacing", "multiProcessor", "navigationMode", "navigationPeriodic", "occupancyThreshold", "partialDots", "pdbAddHydrogens", "pdbGetHeader", "pdbSequential", "perspectiveDepth", "preserveState", "rangeSelected", "redo", "redoMove", "refreshing", "ribbonBorder", "rocketBarrels", "saveProteinStructureState", "scriptQueue", "selectAllModels", "selectHetero", "selectHydrogen", "showAxes", "showBoundBox", "showBoundingBox", "showFrank", "showHiddenSelectionHalos", "showHydrogens", "showKeyStrokes", "showMeasurements", "showModulationVectors", "showMultipleBonds", "showNavigationPointAlways", "showTiming", "showUnitcell", "showUnitcellDetails", "slabByAtom", "slabByMolecule", "slabEnabled", "smartAromatic", "solvent", "solventProbe", "ssBondsBackbone", "statusReporting", "strutsMultiple", "syncMouse", "syncScript", "testFlag1", "testFlag2", "testFlag3", "testFlag4", "traceAlpha", "twistedSheets", "undoAuto", "undo", "undoMax", "undoMove", "useMinimizationThread", "useNumberLocalization", "waitForMoveTo", "windowCentered", "wireframeRotation", "zeroBasedXyzRasmol", "zoomEnabled", "zoomHeight", "zoomLarge", "zShade"]);
var iTokens =  Clazz_newIntArray(-1, [268442114, -1, -1, -1, -1, -1, -1, 268439040, -1, 268438017, 268438018, 268440323, 268440322, 268440321, 268440320, 268440325, -1, 268440326, 268440327, 134217759, 1073742336, 1073742337, 268437504, 268437505, 1073742332, 1073742338, 1073742330, 268441090, 1073742339, 268441602, 268441601, 268441603, 268441091, 4097, -1, 4098, 1611272194, 1114249217, 1610616835, 4100, 4101, 1812599299, -1, 102407, 4102, 4103, 1112152066, -1, 102411, 102412, 20488, 12289, -1, 4105, 135174, 1765808134, -1, 134221831, 1094717448, -1, -1, 4106, 528395, 134353926, -1, 102408, 134221834, 102413, 12290, -1, 528397, 12291, 1073741914, 554176526, 135175, -1, 1610625028, 1275069444, 1112150019, 135176, 537022465, 1112150020, -1, 364547, 102402, 102409, 364548, 266255, 134218759, 1228935687, -1, 4114, 134320648, 1287653388, 4115, -1, 1611272202, 134320141, -1, 1112150021, 1275072526, 20500, 1112152070, -1, 136314895, 2097159, 2097160, 2097162, 1613238294, -1, 20482, 12294, 1610616855, 544771, 134320649, 1275068432, 4121, 4122, 135180, 134238732, 1825200146, -1, 135182, -1, 134223363, 36869, 528411, 134217766, 1745489939, -1, -1, -1, 1112152071, -1, 20485, 4126, -1, 1073877010, 603979882, 1094717454, -1, 1275072532, 4128, 4129, 4130, 4131, -1, 1073877011, 1073742078, 1073742079, 102436, 20487, -1, 4133, 4134, 135190, 135188, 1073742106, 1275203608, -1, 36865, 102439, 134256129, 134221850, -1, 266281, 4138, -1, 266284, 4141, -1, 4142, 12295, 36866, 1112152073, -1, 1112152074, -1, 528432, 4145, 4146, 1275082241, 1611141172, -1, -1, 2097184, 134222350, 554176565, 1112152075, -1, 1095241729, 1611141176, -1, 1112152076, -1, 266298, -1, 528443, 1649022989, -1, 1639976963, -1, 1094713370, 659482, -1, 2109448, 1094713371, 4156, -1, 1073742340, 1112152078, 4160, 4162, 364558, 4163, 1814695966, 36868, 20489, 135198, -1, 4166, 102406, 659488, 134221856, 12297, 4168, 4170, 1153433601, -1, 134217731, 1073741863, -1, 1073742077, -1, 1073742088, 1094713362, -1, 1073742120, -1, 1073742132, 1275068935, 1086324744, 1086324747, 1086324748, 1073742158, 1086326798, 1088421903, 603979956, 134217764, 1073742176, 1073742178, 1073742184, 1275068446, 134218250, 1073741826, 134217765, 134218241, 1275069441, 1111490561, 1111490562, 1073741832, 1086324739, -1, 553648129, 2097154, 134217729, 1275068418, 1073741848, 1094713346, -1, -1, 1094713347, 1086326786, 1094715393, 1086326785, 1111492609, 1111492610, 1111492611, 96, 1073741856, 1073741857, 1073741858, 1073741861, 1073741862, 1073741859, 2097200, 1073741864, 1073741865, 1275068420, 1228931586, 2097155, 1073741871, 1073742328, 1073741872, -1, 134221829, 2097188, 1094713349, 1086326788, -1, 1094713351, 1111490563, -1, 1073741881, 1073741882, 2097190, 1073741884, 134217736, 14, 1073741894, 1073741898, 1073742329, -1, -1, 134218245, 1275069442, 1111490564, -1, 1073741918, 1073741922, 2097192, 1275069443, 1275068928, 2097156, 1073741925, 1073741926, 1073741915, 1111490587, 1086326789, 1094715402, 1094713353, 1073741936, 570425357, 1073741938, 1275068427, 1073741946, 545259560, 1631586315, -1, 1111490565, 1073741954, 1073741958, 1073741960, 1073741964, 1111492612, 1111492613, 1111492614, 1145047050, 1111492615, 1111492616, 1111492617, 1145047053, 1086324742, -1, 1086324743, 1094713356, -1, -1, 1094713357, 2097194, 536870920, 134219777, 1113589786, -1, -1, 1073741974, 1086324745, -1, 4120, 1073741982, 553648145, 1073741984, 1086324746, -1, 1073741989, -1, 1073741990, -1, 1111492618, -1, -1, 1073742331, 1073741991, 1073741992, 1275069446, 1140850706, 1073741993, 1073741996, 1275068435, 1140850692, 1073742001, 1111490566, -1, 1111490567, 64, 1073742016, 1073742018, 1073742019, 32, 1073742022, 1073742024, 1073742025, 1073742026, 1111490580, -1, 1111490581, 1111490582, 1111490583, 1111490584, 1111490585, 1111490586, 1145045008, 1094713360, -1, 1094713359, 1094713361, 1073742029, 1073742031, 1073742030, 1275068929, 1275068930, 603979891, 1073742036, 1073742037, 603979892, 1073742042, 1073742046, 1073742052, 1073742333, -1, -1, 1073742056, 1073742057, 1073742039, 1073742058, 1073742060, 134218760, 2097166, 1128269825, 1111490568, 1073742072, 1073742074, 1073742075, 1111492619, 134218753, 1111490569, 1275068725, 134217750, -1, 1073742096, 1073742098, 134217751, -1, 1275068447, 1094713363, 1275334681, 1073742108, -1, 1073742109, 1715472409, -1, 2097168, 1111490570, 2097170, 1275335685, 1073742110, 2097172, 134219266, 1073742114, 1073742116, 1275068443, 1094715412, 4143, 1073742125, 1140850693, 1073742126, 1073742127, 2097174, 1073742128, 1073742129, 1073742134, 1145045003, 1073742135, 1073742136, 536875059, 1073742139, 134218756, -1, 1113589787, 1094713368, 1073742144, 2097178, 134218244, 1094713369, 1140850694, 134218757, 1237320707, 1073742150, 1275068444, 2097196, 1296041985, 134218246, 1275069447, 570425403, -1, 192, 1111490574, 1086324749, 1073742163, 1275068931, 128, 160, 2097180, 1111490575, 1296041986, -1, 1094713365, 1094713366, 1094713367, 1145047052, 134218255, 1111492620, -1, 1275068445, 1111490576, 2097182, 1073742164, 1073742172, 1073742174, 536870926, -1, 1111490588, -1, 1073742182, 1275068932, 1140850696, 1111490577, 1111490578, 1111490579, 1145045006, 1073742186, 1073742187, 1094715420, 1648363544, -1, -1, 2097198, 1312817669, 1111492626, 1111492627, 1111492628, 1145047055, 1145047049, 1140850705, 1086324754, 1086324755, 1111492629, 1111492630, 1111492631, 1073741828, 1073741834, 1073741836, 1073741837, 1073741839, 1073741840, 1073741842, 1075838996, 1073741846, 1073741849, 4108, 1073741852, 1073741854, 1073741860, 1073741866, 1073741868, 1073741874, 1073741875, 1073741876, 1094713350, 1073741877, 603979821, 1073741879, 1073741880, 1073741886, 1275068934, 1073741888, 1073741890, 1073741892, 1073741896, 1073741900, 1073741902, 1275068425, 1073741905, 1073741904, 1073741906, 1073741908, 1073741910, 1073741912, 1073741917, 1073741920, 1073741924, 1073741928, 1073741929, 603979836, 1073741931, 1073741932, 1073741933, 1073741934, 1073741935, 266256, 1073741937, 1073741940, 1073741942, 12293, -1, 1073741948, 1073741950, 1073741952, 1073741956, 1073741961, 1073741962, 1073741966, 1073741968, 1073741970, 603979856, 1073741973, 1073741976, 1275068433, 1073741978, 1073741981, 1073741985, 1073741986, 134217763, -1, 1073741988, 1073741994, 1073741998, 1073742000, 1073741999, 1073742002, 1073742004, 1073742006, 1073742008, 4124, -1, 1073742010, 4125, 1073742014, 1073742015, 1073742020, 1073742027, 1073742028, 1073742032, 1073742033, 1073742034, 1073742038, 1073742040, 1073742041, 1073742044, 1073742048, 1073742050, 1073742054, 1073742064, 1073742062, 1073742066, 1073742068, 1073742070, 1073742076, 1073741850, 1073742080, 1073742082, 1073742083, 1073742084, 1073742086, 1073742090, -1, 1073742092, -1, 1073742094, 1073742099, 1073742100, 1073742104, 1073742112, 1073742111, 1073742118, 1073742119, 1073742122, 1073742124, 1073742130, 1073742140, 1073742146, 1073742147, 1073742148, 1073742154, 1073742156, 1073742159, 1073742160, 1073742162, 1073742166, 1073742168, 1073742170, 1073742189, 1073742188, 1073742190, 1073742192, 1073742194, 1073742196, 1073742197, -1, 536870914, 603979820, 553648135, 536870916, 536870917, 536870918, 537006096, -1, 1610612740, 1610612741, 536870930, 36870, 536875070, -1, 536870932, 545259521, 545259522, 545259524, 545259526, 545259528, 545259530, 545259532, 545259534, 1610612737, 545259536, -1, 1086324752, 1086324753, 545259538, 545259540, 545259542, 545259545, -1, 545259546, 545259547, 545259548, 545259543, 545259544, 545259549, 545259550, 545259552, 545259554, 545259555, 570425355, 545259556, 545259557, 545259558, 545259559, 1610612738, 545259561, 545259562, 545259563, 545259564, 545259565, 545259566, 545259568, 545259570, 545259569, 545259571, 545259572, 545259573, 545259574, 545259576, 553648158, 545259578, 545259580, 545259582, 545259584, 545259586, 570425345, -1, 570425346, -1, 570425348, 570425350, 570425352, 570425353, 570425354, 570425356, 570425358, 570425359, 570425361, 570425360, -1, 570425362, 570425363, 570425364, 570425365, 553648152, 570425366, 570425367, 570425368, 570425371, 570425372, 570425373, 570425374, 570425376, 570425378, 570425380, 570425381, 570425382, 570425384, 1665140738, 570425388, 570425390, 570425392, 570425393, 570425394, 570425396, 570425398, 570425400, 570425402, 570425404, 570425406, 570425408, 1648361473, 603979972, 603979973, 553648185, 570425412, 570425414, 570425416, 553648130, -1, 553648132, 553648133, 553648134, 553648136, 553648137, 553648138, -1, 553648139, 553648140, 553648141, 553648142, 553648143, 553648144, 553648147, 1073741995, 553648148, 553648149, 553648150, 553648151, 553648153, 553648154, 553648155, 553648156, 553648157, 553648160, 553648161, 553648162, 553648164, 553648165, 553648166, 553648167, 553648168, 536870922, 553648170, 536870924, 553648172, 553648174, -1, 553648176, -1, 553648178, 553648180, 553648182, 553648183, 553648186, 553648188, 553648190, 603979778, 603979780, 603979781, 603979782, 603979783, 603979784, 603979785, 603979786, 603979788, 603979790, 603979792, 603979794, 603979796, 603979797, 603979798, 603979800, 603979802, 603979804, 603979806, 603979808, 603979809, 603979812, 603979814, 1677721602, -1, 603979815, 603979810, 570425347, 603979816, -1, 603979817, 603979818, 603979819, 603979811, 603979822, 603979823, 603979824, 603979825, 603979826, 603979827, 603979828, -1, 603979829, 603979830, 603979831, 603979832, 603979833, 603979834, 603979835, 603979838, 603979839, 603979840, 603979841, 603979842, 603979843, 603979844, 603979845, 603979846, 603979847, 603979848, 603979849, 603979850, 603979852, 603979853, 603979854, 1612709894, 603979858, 603979860, 603979862, 603979863, 1612709900, -1, 603979864, 603979865, 603979866, 603979867, 553648146, 603979868, 603979869, 603979870, 603979871, 2097165, -1, 603979872, 603979873, 603979874, 603979875, 603979876, 545259567, 603979877, 603979878, 1610612739, 603979879, 603979880, 603979881, 603983903, -1, 603979884, 603979885, 603979886, 570425369, 570425370, 603979887, 603979889, 603979890, 553648159, 603979893, 603979894, 603979895, 603979896, 603979897, 603979898, 603979899, 4139, 4140, 603979900, 603979901, 603979902, 603979903, 603979904, 603979906, 603979908, 603979910, 603979914, 603979916, -1, 603979918, 603979920, 603979922, 603979924, 603979926, 603979927, 603979928, 603979930, 603979934, 603979936, 603979937, 603979939, 603979940, 603979942, 603979944, 1612709912, 603979948, 603979952, 603979954, 603979955, 603979957, 603979958, 603979960, 603979962, 603979964, 603979965, 603979966, 603979968, 603979969, 603984065, 553648184, 4165, 603979970, 603979971, 603979975, 603979976, 603979977, 603979978, 603979980, 603979982, 603979983, 603979984]);
if (sTokens.length != iTokens.length) {
JU.Logger.error("sTokens.length (" + sTokens.length + ") != iTokens.length! (" + iTokens.length + ")");
System.exit(1);
}n = sTokens.length;
for (var i = 0; i < n; i++) {
sTok = sTokens[i];
lcase = sTok.toLowerCase();
var t = iTokens[i];
tokenThis = tokenLast = (t == -1 ? tokenLast : JS.T.o(t, sTok));
if (JS.T.tokenMap.get(lcase) != null) JU.Logger.error("duplicate token definition:" + lcase);
JS.T.tokenMap.put(lcase, tokenThis);
}
sTokens = null;
iTokens = null;
}});
;//5.0.1-v7 Mon Aug 24 10:19:01 CDT 2026
Clazz_declarePackage("J.shape");
Clazz_load(["J.shape.Shape"], "J.shape.AtomShape", ["JU.AU", "$.BS", "J.atomdata.RadiusData", "J.c.PAL", "$.VDW", "JU.BSUtil", "$.C"], function(){
var c$ = Clazz_decorateAsClass(function(){
this.mad = -1;
this.mads = null;
this.colixes = null;
this.paletteIDs = null;
this.isActive = false;
this.rd = null;
this.isSet = false;
this.monomerCount = 0;
this.bsSizeDefault = null;
Clazz_instantialize(this, arguments);}, J.shape, "AtomShape", J.shape.Shape);
Clazz_overrideMethod(c$, "initShape", 
function(){
});
Clazz_overrideMethod(c$, "initModelSet", 
function(){
this.isSet = true;
var ac = this.ms.ac;
if (this.mads != null) this.mads = JU.AU.arrayCopyShort(this.mads, ac);
if (this.colixes != null) this.colixes = JU.AU.arrayCopyShort(this.colixes, ac);
if (this.paletteIDs != null) this.paletteIDs = JU.AU.arrayCopyByte(this.paletteIDs, ac);
});
Clazz_overrideMethod(c$, "getSize", 
function(atomIndex){
return (this.mads == null ? 0 : this.mads[atomIndex]);
}, "~N");
Clazz_overrideMethod(c$, "setSize", 
function(size, bsSelected){
this.setSize2(size, bsSelected);
}, "~N,JU.BS");
Clazz_defineMethod(c$, "setSize2", 
function(size, bsSelected){
if (size == 0) {
this.setSizeRD(null, bsSelected);
return;
}if (this.rd == null) this.rd =  new J.atomdata.RadiusData(null, size, J.atomdata.RadiusData.EnumType.SCREEN, null);
 else this.rd.value = size;
this.setSizeRD(this.rd, bsSelected);
}, "~N,JU.BS");
Clazz_overrideMethod(c$, "setSizeRD", 
function(rd, bsSelected){
if (!this.isSet) return;
this.isActive = true;
var isVisible = (rd != null && rd.value != 0);
var isAll = (bsSelected == null);
var ac = this.ms.ac;
var i0 = (isAll ? ac - 1 : bsSelected.nextSetBit(0));
if (this.bsSizeSet == null) this.bsSizeSet = JU.BS.newN(ac);
if (this.mads == null && i0 >= 0) this.mads =  Clazz_newShortArray (ac, 0);
for (var i = i0; i >= 0; i = (isAll ? i - 1 : bsSelected.nextSetBit(i + 1))) this.setSizeRD2(i, rd, isVisible);

}, "J.atomdata.RadiusData,JU.BS");
Clazz_defineMethod(c$, "setSizeRD2", 
function(i, rd, isVisible){
var atom = this.ms.at[i];
this.mads[i] = atom.calculateMad(this.vwr, rd);
this.bsSizeSet.setBitTo(i, isVisible);
atom.setShapeVisibility(this.vf, isVisible);
}, "~N,J.atomdata.RadiusData,~B");
Clazz_defineMethod(c$, "setPropAS", 
function(propertyName, value, bs){
if ("color" === propertyName) {
this.isActive = true;
var colix = JU.C.getColixO(value);
var pid = J.c.PAL.pidOf(value);
var n = this.checkColixLength(colix, bs.length());
for (var i = bs.nextSetBit(0); i >= 0 && i < n; i = bs.nextSetBit(i + 1)) this.setColixAndPalette(colix, pid, i);

return;
}if ("pymolparams" === propertyName) {
this.isActive = true;
var data = value;
var colixes = data[0];
var atrans = data[1];
var sizes = data[2];
var rd =  new J.atomdata.RadiusData(null, 0, J.atomdata.RadiusData.EnumType.FACTOR, J.c.VDW.AUTO);
if (this.bsColixSet == null) this.bsColixSet =  new JU.BS();
if (this.bsSizeSet == null) this.bsSizeSet =  new JU.BS();
var i0 = bs.nextSetBit(0);
if (this.mads == null && i0 >= 0) this.mads =  Clazz_newShortArray (this.ms.ac, 0);
var n = this.checkColixLength(colixes == null ? 0 : 4, bs.length());
for (var i = i0, pt = 0; i >= 0 && i < n; i = bs.nextSetBit(i + 1), pt++) {
var colix = (colixes == null ? 0 : colixes[pt]);
var f = (atrans == null ? 0 : atrans[pt]);
if (f > 0.01) colix = JU.C.getColixTranslucent3(colix, true, f);
this.setColixAndPalette(colix, J.c.PAL.UNKNOWN.id, i);
if (sizes == null) continue;
var isVisible = ((rd.value = sizes[pt]) > 0);
if (rd.value == 0 && this.bsSizeSet.get(i)) continue;
this.setSizeRD2(i, rd, isVisible);
}
return;
}if ("translucency" === propertyName) {
this.isActive = true;
var isTranslucent = (value.equals("translucent"));
this.checkColixLength(4, this.ms.ac);
for (var i = bs.nextSetBit(0); i >= 0; i = bs.nextSetBit(i + 1)) {
this.colixes[i] = JU.C.getColixTranslucent3(this.colixes[i], isTranslucent, this.translucentLevel);
if (isTranslucent) this.bsColixSet.set(i);
}
return;
}if (propertyName === "deleteModelAtoms") {
var info = (value)[2];
var firstAtomDeleted = info[1];
var nAtomsDeleted = info[2];
this.mads = JU.AU.deleteElements(this.mads, firstAtomDeleted, nAtomsDeleted);
this.colixes = JU.AU.deleteElements(this.colixes, firstAtomDeleted, nAtomsDeleted);
this.paletteIDs = JU.AU.deleteElements(this.paletteIDs, firstAtomDeleted, nAtomsDeleted);
JU.BSUtil.deleteBits(this.bsSizeSet, bs);
JU.BSUtil.deleteBits(this.bsColixSet, bs);
return;
}this.setPropS(propertyName, value, bs);
}, "~S,~O,JU.BS");
Clazz_defineMethod(c$, "checkColixLength", 
function(colix, n){
n = Math.min(this.ms.ac, n);
if (colix == 0) return (this.colixes == null ? 0 : this.colixes.length);
if (this.colixes == null || n > this.colixes.length) {
this.colixes = JU.AU.ensureLengthShort(this.colixes, n);
this.paletteIDs = JU.AU.ensureLengthByte(this.paletteIDs, n);
}if (this.bsColixSet == null) this.bsColixSet = JU.BS.newN(this.ms.ac);
return n;
}, "~N,~N");
Clazz_defineMethod(c$, "setColixAndPalette", 
function(colix, paletteID, atomIndex){
if (this.colixes == null) {
this.checkColixLength(-1, this.ms.ac);
}this.colixes[atomIndex] = colix = this.getColixI(colix, paletteID, atomIndex);
this.bsColixSet.setBitTo(atomIndex, colix != 0 || this.shapeID == 0);
this.paletteIDs[atomIndex] = paletteID;
}, "~N,~N,~N");
Clazz_overrideMethod(c$, "setAtomClickability", 
function(){
if (!this.isActive) return;
var atoms = this.ms.at;
for (var i = this.ms.ac; --i >= 0; ) {
var atom = atoms[i];
if (atom == null || (atom.shapeVisibilityFlags & this.vf) == 0 || this.ms.isAtomHidden(i)) continue;
atom.setClickable(this.vf);
}
});
Clazz_overrideMethod(c$, "getShapeState", 
function(){
return null;
});
});
;//5.0.1-v7 Mon Aug 24 10:01:38 CDT 2026
Clazz_declarePackage("J.shape");
Clazz_load(["J.shape.FontLineShape", "JU.P3", "$.V3"], "J.shape.Axes", ["JU.PT", "JU.Escape", "JV.JC"], function(){
var c$ = Clazz_decorateAsClass(function(){
this.axisXY = null;
this.scale = 0;
this.fixedOrigin = null;
this.originPoint = null;
this.axisPoints = null;
this.labels = null;
this.axisType = null;
this.axes2 = null;
this.pt0 = null;
this.fixedOriginUC = null;
this.corner = null;
Clazz_instantialize(this, arguments);}, J.shape, "Axes", J.shape.FontLineShape);
Clazz_prepareFields (c$, function(){
this.axisXY =  new JU.P3();
this.originPoint =  new JU.P3();
this.axisPoints =  new Array(6);
{
for (var i = 6; --i >= 0; ) this.axisPoints[i] =  new JU.P3();

}this.pt0 =  new JU.P3();
this.fixedOriginUC =  new JU.P3();
this.corner =  new JU.V3();
});
Clazz_overrideMethod(c$, "setProperty", 
function(propertyName, value, bs){
if ("position" === propertyName) {
var doSetScale = (this.axisXY.z == 0 && (value).z != 0);
this.axisXY = value;
this.setScale(doSetScale ? 1 : this.scale);
return;
}if ("origin" === propertyName) {
if (value == null || (value).length() == 0) {
this.fixedOrigin = null;
} else {
if (this.fixedOrigin == null) this.fixedOrigin =  new JU.P3();
this.fixedOrigin.setT(value);
}this.reinitShape();
return;
}if ("labels" === propertyName) {
this.labels = value;
return;
}if ("labelsOn" === propertyName) {
this.labels = null;
return;
}if ("labelsOff" === propertyName) {
this.labels =  Clazz_newArray(-1, ["", "", ""]);
return;
}if ("type" === propertyName) {
this.axisType = value;
if ("abc".equals(this.axisType)) this.axisType = null;
}if ("axes2" === propertyName) {
this.axes2 = (value == null || value.equals("") ? null : value);
return;
}this.setPropFLS(propertyName, value);
}, "~S,~O,JU.BS");
Clazz_overrideMethod(c$, "initShape", 
function(){
this.translucentAllowed = false;
this.myType = "axes";
this.font3d = this.vwr.gdata.getFont3D(16);
this.setPoints(this.vwr.g.axesMode);
});
Clazz_defineMethod(c$, "setPoints", 
function(axesMode){
var unitcell;
if (axesMode != 603979808 || (unitcell = this.vwr.getCurrentUnitCell()) == null) {
this.originPoint.setT(this.fixedOrigin != null ? this.fixedOrigin : axesMode == 603979809 ? this.vwr.getBoundBoxCenter() : this.pt0);
this.setScale(this.vwr.getFloat(570425346) / 2);
return;
}var fset = unitcell.getUnitCellMultiplier();
unitcell = unitcell.getUnitCellMultiplied();
var voffset = this.vwr.getFloat(570425345);
this.fixedOriginUC.set(voffset, voffset, voffset);
var offset = unitcell.getCartesianOffset();
var vertices = unitcell.getUnitCellVerticesNoOffset();
this.originPoint.add2(offset, vertices[0]);
if (voffset != 0) unitcell.toCartesian(this.fixedOriginUC, false);
 else if (this.fixedOrigin != null) this.originPoint.setT(this.fixedOrigin);
if (voffset != 0) {
this.originPoint.add(this.fixedOriginUC);
}var scale = this.scale = this.vwr.getFloat(570425346) / 2;
if (fset != null && fset.z > 0) scale *= Math.abs(fset.z);
this.axisPoints[0].scaleAdd2(scale, vertices[4], this.originPoint);
this.axisPoints[1].scaleAdd2(scale, vertices[2], this.originPoint);
this.axisPoints[2].scaleAdd2(scale, vertices[1], this.originPoint);
}, "~N");
Clazz_defineMethod(c$, "reinitShape", 
function(){
var f = this.font3d;
this.initShape();
if (f != null) this.font3d = f;
});
Clazz_defineMethod(c$, "getAxisPoint", 
function(i, actual, ptTemp){
if (actual) {
ptTemp.setT(this.axisPoints[i]);
} else {
ptTemp.sub2(this.axisPoints[i], this.originPoint);
ptTemp.scale(0.5);
}return ptTemp;
}, "~N,~B,JU.P3");
Clazz_overrideMethod(c$, "getProperty", 
function(property, index){
if (property === "originPoint") return this.originPoint;
if (property === "axisPoints") {
this.setPoints(this.vwr.g.axesMode);
return this.axisPoints;
}if (property === "axesTypeXY") return (this.axisXY.z == 0 ? Boolean.FALSE : Boolean.TRUE);
if (property === "origin") return this.fixedOrigin;
return null;
}, "~S,~N");
Clazz_defineMethod(c$, "setScale", 
function(scale){
this.scale = scale;
this.corner.setT(this.vwr.getBoundBoxCornerVector());
for (var i = 6; --i >= 0; ) {
var axisPoint = this.axisPoints[i];
axisPoint.setT(JV.JC.unitAxisVectors[i]);
if (this.corner.x < 1.5) this.corner.x = 1.5;
if (this.corner.y < 1.5) this.corner.y = 1.5;
if (this.corner.z < 1.5) this.corner.z = 1.5;
if (this.axisXY.z == 0) {
axisPoint.x *= this.corner.x * scale;
axisPoint.y *= this.corner.y * scale;
axisPoint.z *= this.corner.z * scale;
}axisPoint.add(this.originPoint);
}
}, "~N");
Clazz_defineMethod(c$, "getAxesState", 
function(sb){
sb.append("  axes scale ").appendF(this.vwr.getFloat(570425346)).append(";\n");
if (this.fixedOrigin != null) sb.append("  axes center ").append(JU.Escape.eP(this.fixedOrigin)).append(";\n");
if (this.axisXY.z != 0) sb.append("  axes position [").appendI(Clazz_floatToInt(this.axisXY.x)).append(" ").appendI(Clazz_floatToInt(this.axisXY.y)).append(" ").append(this.axisXY.z < 0 ? " %" : "").append("]");
if (this.axes2 != null) sb.append(" ").append(JU.PT.esc(this.axes2));
sb.append(";\n");
if (this.labels != null) {
sb.append("  axes labels ");
for (var i = 0; i < this.labels.length; i++) if (this.labels[i] != null) sb.append(JU.PT.esc(this.labels[i])).append(" ");

sb.append(";\n");
}if (this.axisType != null) {
sb.append("  axes type " + JU.PT.esc(this.axisType));
}return sb.toString();
}, "JU.SB");
});
;//5.0.1-v7 Mon Aug 24 10:19:01 CDT 2026
Clazz_declarePackage("J.shape");
Clazz_load(["J.shape.AtomShape"], "J.shape.Balls", ["JU.BS", "J.c.PAL", "JU.C"], function(){
var c$ = Clazz_declareType(J.shape, "Balls", J.shape.AtomShape);
Clazz_overrideMethod(c$, "setSize", 
function(size, bsSelected){
if (size == 2147483647) {
this.isActive = true;
if (this.bsSizeSet == null) this.bsSizeSet =  new JU.BS();
this.bsSizeSet.or(bsSelected);
return;
}this.setSize2(size, bsSelected);
}, "~N,JU.BS");
Clazz_overrideMethod(c$, "setSizeRD", 
function(rd, bsSelected){
this.isActive = true;
if (this.bsSizeSet == null) this.bsSizeSet =  new JU.BS();
var bsLength = Math.min(this.ms.at.length, bsSelected.length());
for (var i = bsSelected.nextSetBit(0); i >= 0 && i < bsLength; i = bsSelected.nextSetBit(i + 1)) {
var atom = this.ms.at[i];
atom.setMadAtom(this.vwr, rd);
this.bsSizeSet.set(i);
}
}, "J.atomdata.RadiusData,JU.BS");
Clazz_overrideMethod(c$, "setProperty", 
function(propertyName, value, bs){
if ("color" === propertyName) {
var colix = JU.C.getColixO(value);
if (colix == 0) colix = 2;
if (this.bsColixSet == null) this.bsColixSet =  new JU.BS();
var pid = J.c.PAL.pidOf(value);
for (var i = bs.nextSetBit(0); i >= 0; i = bs.nextSetBit(i + 1)) {
var atom = this.ms.at[i];
atom.colixAtom = this.getColixA(colix, pid, atom);
this.bsColixSet.setBitTo(i, colix != 2 || pid != J.c.PAL.NONE.id);
atom.paletteID = pid;
}
this.vwr.setModelkitPropertySafely("updateatomkeys", bs);
return;
}if ("colorValues" === propertyName) {
var values = value;
if (values.length == 0) return;
if (this.bsColixSet == null) this.bsColixSet =  new JU.BS();
var n = 0;
var color = null;
for (var i = bs.nextSetBit(0); i >= 0; i = bs.nextSetBit(i + 1)) {
if (n >= values.length) return;
color = Integer.$valueOf(values[n++]);
var colix = JU.C.getColixO(color);
if (colix == 0) colix = 2;
var pid = J.c.PAL.pidOf(color);
var atom = this.ms.at[i];
atom.colixAtom = this.getColixA(colix, pid, atom);
this.bsColixSet.setBitTo(i, colix != 2 || pid != J.c.PAL.NONE.id);
atom.paletteID = pid;
}
return;
}if ("colors" === propertyName) {
var data = value;
var colixes = data[0];
if (this.bsColixSet == null) this.bsColixSet =  new JU.BS();
var c;
var atoms = this.ms.at;
for (var i = bs.nextSetBit(0); i >= 0; i = bs.nextSetBit(i + 1)) {
if (i >= colixes.length || (c = colixes[i]) == 0) continue;
atoms[i].colixAtom = c;
atoms[i].paletteID = J.c.PAL.UNKNOWN.id;
this.bsColixSet.set(i);
}
return;
}if ("translucency" === propertyName) {
var isTranslucent = ((value).equals("translucent"));
if (this.bsColixSet == null) this.bsColixSet =  new JU.BS();
var atoms = this.ms.at;
for (var i = bs.nextSetBit(0); i >= 0; i = bs.nextSetBit(i + 1)) {
atoms[i].setTranslucent(isTranslucent, this.translucentLevel);
if (isTranslucent) this.bsColixSet.set(i);
}
return;
}if (propertyName.startsWith("ball")) {
propertyName = propertyName.substring(4).intern();
}this.setPropAS(propertyName, value, bs);
}, "~S,~O,JU.BS");
Clazz_overrideMethod(c$, "setAtomClickability", 
function(){
var bsDeleted = this.vwr.slm.bsDeleted;
for (var i = this.ms.ac; --i >= 0; ) {
var atom = this.ms.at[i];
if (atom == null) continue;
atom.setClickable(0);
if (bsDeleted != null && bsDeleted.get(i) || (atom.shapeVisibilityFlags & this.vf) == 0 || this.ms.isAtomHidden(i)) continue;
atom.setClickable(this.vf);
}
});
});
;//5.0.1-v7 Mon Aug 24 10:01:38 CDT 2026
Clazz_declarePackage("J.shape");
Clazz_load(["J.shape.Shape"], "J.shape.FontLineShape", null, function(){
var c$ = Clazz_decorateAsClass(function(){
this.tickInfos = null;
this.font3d = null;
Clazz_instantialize(this, arguments);}, J.shape, "FontLineShape", J.shape.Shape);
Clazz_overrideMethod(c$, "initShape", 
function(){
this.translucentAllowed = false;
});
Clazz_defineMethod(c$, "setPropFLS", 
function(propertyName, value){
if ("tickInfo" === propertyName) {
var t = value;
var type = t.type;
if (t.ticks == null) {
if (t.type == ' ') {
this.tickInfos = null;
return;
}if (this.tickInfos != null) {
var haveTicks = false;
for (var i = 0; i < 4; i++) {
if (this.tickInfos[i] != null && this.tickInfos[i].type == t.type) {
this.tickInfos[i] = null;
} else {
haveTicks = true;
}}
if (!haveTicks) this.tickInfos = null;
}return;
}if (this.tickInfos == null) this.tickInfos =  new Array(4);
this.tickInfos["xyz".indexOf(type) + 1] = t;
return;
}if ("font" === propertyName) {
this.font3d = value;
return;
}}, "~S,~O");
Clazz_overrideMethod(c$, "getShapeState", 
function(){
return null;
});
});
;//5.0.1-v7 Mon Aug 17 10:07:10 MDT 2026
Clazz_declarePackage("J.shape");
Clazz_load(["J.shape.Shape"], "J.shape.Frank", ["J.i18n.GT", "JV.Viewer"], function(){
var c$ = Clazz_decorateAsClass(function(){
this.currentMetricsFont3d = null;
this.baseFont3d = null;
this.frankWidth = 0;
this.frankAscent = 0;
this.frankDescent = 0;
this.x = 0;
this.y = 0;
this.dx = 0;
this.dy = 0;
this.scaling = 0;
this.font3d = null;
Clazz_instantialize(this, arguments);}, J.shape, "Frank", J.shape.Shape);
Clazz_overrideMethod(c$, "initShape", 
function(){
this.myType = "frank";
this.baseFont3d = this.font3d = this.vwr.gdata.getFont3DFSS("SansSerif", "Plain", 16);
if (JV.Viewer.isJS || JV.Viewer.isSwingJS) J.shape.Frank.frankString = "JSmol";
 else if (false) J.shape.Frank.frankString = "JmolD";
this.calcMetrics();
});
Clazz_overrideMethod(c$, "setProperty", 
function(propertyName, value, bs){
if ("font" === propertyName) {
var f = value;
if (f.fontSize >= 10) {
this.baseFont3d = f;
this.scaling = 0;
}}return;
}, "~S,~O,JU.BS");
Clazz_overrideMethod(c$, "wasClicked", 
function(x, y){
var width = this.vwr.getScreenWidth();
var height = this.vwr.getScreenHeight();
return (width > 0 && height > 0 && x > width - this.frankWidth - 4 && y > height - this.frankAscent - 4);
}, "~N,~N");
Clazz_overrideMethod(c$, "checkObjectHovered", 
function(x, y, bsVisible){
if (!this.vwr.getShowFrank() || !this.wasClicked(x, y) || !this.vwr.menuEnabled()) return false;
this.vwr.hoverOnPt(x, y, J.i18n.GT.$("Click for menu..."), null, null);
return true;
}, "~N,~N,JU.BS");
Clazz_defineMethod(c$, "calcMetrics", 
function(){
if (this.font3d === this.currentMetricsFont3d) return;
this.currentMetricsFont3d = this.font3d;
this.frankWidth = this.font3d.stringWidth(J.shape.Frank.frankString);
this.frankDescent = this.font3d.getDescent();
this.frankAscent = this.font3d.getAscent();
});
Clazz_defineMethod(c$, "getFont", 
function(imageFontScaling){
if (imageFontScaling != this.scaling) {
this.scaling = imageFontScaling;
this.font3d = this.vwr.gdata.getFont3DScaled(this.baseFont3d, imageFontScaling);
this.calcMetrics();
}}, "~N");
Clazz_overrideMethod(c$, "getShapeState", 
function(){
return null;
});
c$.frankString = "Jmol";
});
;//5.0.1-v7 Mon Aug 24 10:01:38 CDT 2026
Clazz_declarePackage("J.shape");
Clazz_load(null, "J.shape.Shape", ["J.c.PAL", "JU.C", "$.Logger", "JV.JC"], function(){
var c$ = Clazz_decorateAsClass(function(){
this.myType = null;
this.vwr = null;
this.ms = null;
this.shapeID = 0;
this.vf = 0;
this.translucentLevel = 0;
this.translucentAllowed = true;
this.isBioShape = false;
this.bsSizeSet = null;
this.bsColixSet = null;
Clazz_instantialize(this, arguments);}, J.shape, "Shape", null);
Clazz_defineMethod(c$, "initializeShape", 
function(vwr, modelSet, shapeID){
this.vwr = vwr;
this.shapeID = shapeID;
this.vf = JV.JC.getShapeVisibilityFlag(shapeID);
this.setModelSet(modelSet);
this.initShape();
}, "JV.Viewer,JM.ModelSet,~N");
Clazz_defineMethod(c$, "setModelVisibilityFlags", 
function(bsModels){
}, "JU.BS");
Clazz_defineMethod(c$, "getSize", 
function(atomIndex){
return 0;
}, "~N");
Clazz_defineMethod(c$, "getSizeG", 
function(group){
return 0;
}, "JM.Group");
Clazz_defineMethod(c$, "replaceGroup", 
function(g0, g1){
}, "JM.Group,JM.Group");
Clazz_defineMethod(c$, "setModelSet", 
function(modelSet){
this.ms = modelSet;
this.initModelSet();
}, "JM.ModelSet");
Clazz_defineMethod(c$, "initModelSet", 
function(){
});
Clazz_defineMethod(c$, "setShapeSizeRD", 
function(size, rd, bsSelected){
if (rd == null) this.setSize(size, bsSelected);
 else this.setSizeRD(rd, bsSelected);
}, "~N,J.atomdata.RadiusData,JU.BS");
Clazz_defineMethod(c$, "setSize", 
function(size, bsSelected){
}, "~N,JU.BS");
Clazz_defineMethod(c$, "setSizeRD", 
function(rd, bsSelected){
}, "J.atomdata.RadiusData,JU.BS");
Clazz_defineMethod(c$, "setPropS", 
function(propertyName, value, bsSelected){
if (propertyName === "setProperties") {
this.setProperties(value);
return;
}if (propertyName === "translucentLevel") {
this.translucentLevel = (value).floatValue();
return;
}if (propertyName === "refreshTrajectories") {
return;
}JU.Logger.warn("unassigned " + JV.JC.shapeClassBases[this.shapeID] + " + shape setProperty:" + propertyName + ":" + value);
}, "~S,~O,JU.BS");
Clazz_defineMethod(c$, "setProperties", 
function(value){
var bsSelected = this.vwr.bsA();
if (Clazz_instanceOf(value,"JU.Lst")) {
var propertyList = value;
while (propertyList.size() > 0) {
var data = propertyList.removeItemAt(0);
this.setProperty((data[0]).intern(), data[1], bsSelected);
}
} else {
var data = (value);
for (var i = 0, n = data.length; i < n; i++) {
this.setProperty((data[i][0]).intern(), data[i][1], bsSelected);
}
}}, "~O");
Clazz_defineMethod(c$, "getPropertyData", 
function(property, data){
return this.getPropShape(property, data);
}, "~S,~A");
Clazz_defineMethod(c$, "getPropShape", 
function(property, data){
if (Clazz_instanceOf(data[1], Integer)) {
var index = (data[1]).intValue();
data[1] = this.getProperty(property, index);
return (data[1] != null);
}return false;
}, "~S,~A");
Clazz_defineMethod(c$, "getProperty", 
function(property, index){
return null;
}, "~S,~N");
Clazz_defineMethod(c$, "getIndexFromName", 
function(thisID){
return -1;
}, "~S");
Clazz_defineMethod(c$, "wasClicked", 
function(x, y){
return false;
}, "~N,~N");
Clazz_defineMethod(c$, "findNearestAtomIndex", 
function(xMouse, yMouse, closest, bsNot){
}, "~N,~N,~A,JU.BS");
Clazz_defineMethod(c$, "checkBoundsMinMax", 
function(pointMin, pointMax){
}, "JU.P3,JU.P3");
Clazz_defineMethod(c$, "setAtomClickability", 
function(){
});
Clazz_defineMethod(c$, "checkObjectClicked", 
function(x, y, modifiers, bsVisible, drawPicking){
return null;
}, "~N,~N,~N,JU.BS,~B");
Clazz_defineMethod(c$, "checkObjectHovered", 
function(x, y, bsVisible){
return false;
}, "~N,~N,JU.BS");
Clazz_defineMethod(c$, "checkObjectDragged", 
function(prevX, prevY, x, y, dragAction, bsVisible){
return false;
}, "~N,~N,~N,~N,~N,JU.BS");
Clazz_defineMethod(c$, "coordinateInRange", 
function(x, y, vertex, dmin2, ptXY){
this.vwr.tm.transformPtScrSafe(vertex, ptXY);
var d2 = (x - ptXY.x) * (x - ptXY.x) + (y - ptXY.y) * (y - ptXY.y);
return (d2 <= dmin2 ? d2 : -1);
}, "~N,~N,JU.T3,~N,JU.P3i");
Clazz_defineMethod(c$, "getColixI", 
function(colix, paletteID, atomIndex){
return this.getColixA(colix, paletteID, this.ms.at[atomIndex]);
}, "~N,~N,~N");
Clazz_defineMethod(c$, "getColixA", 
function(colix, paletteID, atom){
return (colix == 2 ? this.vwr.cm.getColixAtomPalette(atom, paletteID) : colix);
}, "~N,~N,JM.Atom");
Clazz_defineMethod(c$, "getColixB", 
function(colix, pid, bond){
return (colix == 2 ? this.vwr.cm.getColixBondPalette(bond, pid) : colix);
}, "~N,~N,JM.Bond");
Clazz_defineMethod(c$, "getShapeDetail", 
function(){
return null;
});
c$.getColix = Clazz_defineMethod(c$, "getColix", 
function(colixes, i, atom){
return JU.C.getColixInherited((colixes == null || i >= colixes.length ? 0 : colixes[i]), atom.colixAtom);
}, "~A,~N,JM.Atom");
c$.getFontCommand = Clazz_defineMethod(c$, "getFontCommand", 
function(type, font){
if (font == null) return "";
return "font " + type + " " + font.getInfo();
}, "~S,JU.Font");
c$.getColorCommandUnk = Clazz_defineMethod(c$, "getColorCommandUnk", 
function(type, colix, translucentAllowed){
return J.shape.Shape.getColorCommand(type, J.c.PAL.UNKNOWN.id, colix, translucentAllowed);
}, "~S,~N,~B");
c$.getColorCommand = Clazz_defineMethod(c$, "getColorCommand", 
function(type, pid, colix, translucentAllowed){
if (pid == J.c.PAL.UNKNOWN.id && colix == 0) return "";
var s = (pid == J.c.PAL.UNKNOWN.id && colix == 0 ? "" : (translucentAllowed ? J.shape.Shape.getTranslucentLabel(colix) + " " : "") + (pid != J.c.PAL.UNKNOWN.id && !J.c.PAL.isPaletteVariable(pid) ? J.c.PAL.getPaletteName(pid) : J.shape.Shape.encodeColor(colix)));
return "color " + type + " " + s;
}, "~S,~N,~N,~B");
c$.encodeColor = Clazz_defineMethod(c$, "encodeColor", 
function(colix){
return (JU.C.isColixColorInherited(colix) ? "none" : JU.C.getHexCode(colix));
}, "~N");
c$.getTranslucentLabel = Clazz_defineMethod(c$, "getTranslucentLabel", 
function(colix){
return (JU.C.isColixTranslucent(colix) ? JU.C.getColixTranslucencyLabel(colix) : "opaque");
}, "~N");
c$.appendCmd = Clazz_defineMethod(c$, "appendCmd", 
function(s, cmd){
if (cmd.length == 0) return;
s.append("  ").append(cmd).append(";\n");
}, "JU.SB,~S");
});
;//5.0.1-v7 Mon Aug 24 10:01:38 CDT 2026
Clazz_declarePackage("J.shape");
Clazz_load(["J.shape.Shape", "JU.P3i"], "J.shape.Sticks", ["java.util.Hashtable", "JU.BS", "$.P3", "J.c.PAL", "JU.BSUtil", "$.C", "$.Edge", "$.Escape"], function(){
var c$ = Clazz_decorateAsClass(function(){
this.myMask = 0;
this.reportAll = false;
this.haveStrutPoints = false;
this.bsOrderSet = null;
this.selectedBonds = null;
this.closestAtom = null;
this.ptXY = null;
Clazz_instantialize(this, arguments);}, J.shape, "Sticks", J.shape.Shape);
Clazz_prepareFields (c$, function(){
this.closestAtom =  Clazz_newIntArray (1, 0);
this.ptXY =  new JU.P3i();
});
Clazz_overrideMethod(c$, "initShape", 
function(){
this.myMask = 1023;
this.reportAll = false;
});
Clazz_overrideMethod(c$, "setSize", 
function(size, bsSelected){
if (size == 2147483647) {
this.selectedBonds = JU.BSUtil.copy(bsSelected);
return;
}if (size == -2147483648) {
if (this.bsOrderSet == null) this.bsOrderSet =  new JU.BS();
this.bsOrderSet.or(bsSelected);
return;
}if (this.bsSizeSet == null) this.bsSizeSet =  new JU.BS();
var iter = (this.selectedBonds != null ? this.ms.getBondIterator(this.selectedBonds) : this.ms.getBondIteratorForType(this.myMask, bsSelected));
var mad = size;
while (iter.hasNext()) {
this.bsSizeSet.set(iter.nextIndex());
var b = iter.next();
if (b != null) b.setMad(mad);
}
}, "~N,JU.BS");
Clazz_overrideMethod(c$, "setProperty", 
function(propertyName, value, bs){
if ("type" === propertyName) {
this.myMask = (value).intValue();
return;
}if ("reportAll" === propertyName) {
this.reportAll = true;
return;
}if ("reset" === propertyName) {
this.bsOrderSet = null;
this.bsSizeSet = null;
this.bsColixSet = null;
this.selectedBonds = null;
return;
}if ("bondOrder" === propertyName) {
if (this.bsOrderSet == null) this.bsOrderSet =  new JU.BS();
var order = (value).intValue();
var iter = (this.selectedBonds != null ? this.ms.getBondIterator(this.selectedBonds) : this.ms.getBondIteratorForType(65535, bs));
while (iter.hasNext()) {
this.bsOrderSet.set(iter.nextIndex());
iter.next().setOrder(order);
}
return;
}if ("color" === propertyName) {
if (this.bsColixSet == null) this.bsColixSet =  new JU.BS();
var colix = JU.C.getColixO(value);
var pal = (Clazz_instanceOf(value,"J.c.PAL") ? value : null);
if (pal === J.c.PAL.TYPE || pal === J.c.PAL.ENERGY) {
var isEnergy = (pal === J.c.PAL.ENERGY);
var iter = (this.selectedBonds != null ? this.ms.getBondIterator(this.selectedBonds) : this.ms.getBondIteratorForType(this.myMask, bs));
while (iter.hasNext()) {
this.bsColixSet.set(iter.nextIndex());
var bond = iter.next();
bond.colix = (isEnergy ? this.getColixB(colix, pal.id, bond) : JU.C.getColix(JU.Edge.getArgbHbondType(bond.order)));
}
return;
}if (colix == 2 && pal !== J.c.PAL.CPK) return;
var iter = (this.selectedBonds != null ? this.ms.getBondIterator(this.selectedBonds) : this.ms.getBondIteratorForType(this.myMask, bs));
while (iter.hasNext()) {
var iBond = iter.nextIndex();
iter.next().colix = colix;
this.bsColixSet.setBitTo(iBond, (colix != 0 && colix != 2));
}
return;
}if ("translucency" === propertyName) {
if (this.bsColixSet == null) this.bsColixSet =  new JU.BS();
var isTranslucent = ((value).equals("translucent"));
var iter = (this.selectedBonds != null ? this.ms.getBondIterator(this.selectedBonds) : this.ms.getBondIteratorForType(this.myMask, bs));
while (iter.hasNext()) {
this.bsColixSet.set(iter.nextIndex());
iter.next().setTranslucent(isTranslucent, this.translucentLevel);
}
return;
}if ("deleteModelAtoms" === propertyName) {
return;
}this.setPropS(propertyName, value, bs);
}, "~S,~O,JU.BS");
Clazz_overrideMethod(c$, "getProperty", 
function(property, index){
if (property.equals("selectionState")) return (this.selectedBonds != null ? "select BONDS " + JU.Escape.eBS(this.selectedBonds) + "\n" : "");
if (property.equals("sets")) return  Clazz_newArray(-1, [this.bsOrderSet, this.bsSizeSet, this.bsColixSet]);
return null;
}, "~S,~N");
Clazz_overrideMethod(c$, "setAtomClickability", 
function(){
var bonds = this.ms.bo;
for (var i = this.ms.bondCount; --i >= 0; ) {
var bond = bonds[i];
if (bond == null || (bond.shapeVisibilityFlags & this.vf) == 0 || this.ms.isAtomHidden(bond.atom1.i) || this.ms.isAtomHidden(bond.atom2.i)) continue;
bond.atom1.setClickable(this.vf);
bond.atom2.setClickable(this.vf);
}
});
Clazz_overrideMethod(c$, "getShapeState", 
function(){
return null;
});
Clazz_overrideMethod(c$, "checkObjectHovered", 
function(x, y, bsVisible){
var pt =  new JU.P3();
var bond = this.findPickedBond(x, y, bsVisible, pt, this.closestAtom);
if (bond == null) return false;
this.vwr.highlightBond(bond.index, this.closestAtom[0], x, y);
return true;
}, "~N,~N,JU.BS");
Clazz_overrideMethod(c$, "checkObjectClicked", 
function(x, y, modifiers, bsVisible, drawPicking){
var pt =  new JU.P3();
var bond = this.findPickedBond(x, y, bsVisible, pt, this.closestAtom);
if (bond == null) return null;
var modelIndex = bond.atom1.mi;
var info = bond.getIdentity();
var map =  new java.util.Hashtable();
map.put("pt", pt);
map.put("index", Integer.$valueOf(bond.index));
map.put("modelIndex", Integer.$valueOf(modelIndex));
map.put("model", this.vwr.getModelNumberDotted(modelIndex));
map.put("type", "bond");
map.put("info", info);
this.vwr.setStatusAtomPicked(-3, "[\"bond\",\"" + bond.getIdentity() + "\"," + pt.x + "," + pt.y + "," + pt.z + "]", map, false);
return map;
}, "~N,~N,~N,JU.BS,~B");
Clazz_defineMethod(c$, "findPickedBond", 
function(x, y, bsVisible, pt, closestAtom){
var dmin2 = 100;
if (this.vwr.gdata.isAntialiased()) {
x <<= 1;
y <<= 1;
dmin2 <<= 1;
}var pickedBond = null;
var v =  new JU.P3();
var bonds = this.ms.bo;
for (var i = this.ms.bondCount; --i >= 0; ) {
var bond = bonds[i];
if (bond == null || bond.shapeVisibilityFlags == 0) continue;
var atom1 = bond.atom1;
var atom2 = bond.atom2;
if (!atom1.checkVisible() || !atom2.checkVisible()) continue;
v.ave(atom1, atom2);
var d2 = this.coordinateInRange(x, y, v, dmin2, this.ptXY);
if (d2 >= 0 && Math.abs(atom1.sY - atom2.sY) + Math.abs(atom1.sX - atom2.sX) > 40) {
var f = 1 * (this.ptXY.x - atom1.sX) / (atom2.sX - atom1.sX);
if (f < 0.4 || f > 0.6) continue;
dmin2 = d2;
pickedBond = bond;
if (closestAtom != null) closestAtom[0] = (f < 0.5 ? atom1.i : atom2.i);
pt.setT(v);
}}
return pickedBond;
}, "~N,~N,JU.BS,JU.P3,~A");
});
;//5.0.1-v7 Mon Aug 24 10:01:38 CDT 2026
Clazz_declarePackage("J.shape");
Clazz_load(["J.shape.FontLineShape"], "J.shape.Uccage", null, function(){
var c$ = Clazz_declareType(J.shape, "Uccage", J.shape.FontLineShape);
Clazz_overrideMethod(c$, "setProperty", 
function(propertyName, value, bs){
this.setPropFLS(propertyName, value);
}, "~S,~O,JU.BS");
Clazz_defineMethod(c$, "initShape", 
function(){
Clazz_superCall(this, J.shape.Uccage, "initShape", []);
this.font3d = this.vwr.gdata.getFont3D(16);
this.myType = "unitcell";
});
});
;//5.0.1-v7 Mon Aug 24 10:01:38 CDT 2026
Clazz_declarePackage("J.thread");
Clazz_load(["J.thread.JmolThread"], "J.thread.HoverWatcherThread", null, function(){
var c$ = Clazz_decorateAsClass(function(){
this.actionManager = null;
this.current = null;
this.moved = null;
this.hoverDelay = 0;
Clazz_instantialize(this, arguments);}, J.thread, "HoverWatcherThread", J.thread.JmolThread);
Clazz_makeConstructor(c$, 
function(actionManager, current, moved, vwr){
this.setViewer(vwr, "HoverWatcher");
this.actionManager = actionManager;
this.current = current;
this.moved = moved;
this.start();
}, "JV.ActionManager,JV.MouseState,JV.MouseState,JV.Viewer");
Clazz_overrideMethod(c$, "run1", 
function(mode){
while (true) switch (mode) {
case -1:
if (!this.isJS) Thread.currentThread().setPriority(1);
mode = 0;
break;
case 0:
this.hoverDelay = this.vwr.getHoverDelay();
if (this.stopped || this.hoverDelay <= 0 || !this.runSleep(this.hoverDelay, 1)) return;
mode = 1;
break;
case 1:
if (this.moved.is(this.current)) {
this.currentTime = System.currentTimeMillis();
var howLong = (this.currentTime - this.moved.time);
if (howLong > (this.vwr.acm.zoomTrigger ? 100 : this.hoverDelay) && !this.stopped) {
this.actionManager.checkHover();
}}mode = 0;
break;
}

}, "~N");
});
;//5.0.1-v7 Mon Aug 24 10:01:38 CDT 2026
Clazz_declarePackage("J.thread");
Clazz_load(["java.lang.Thread"], "J.thread.JmolThread", ["JU.Logger", "JV.Viewer"], function(){
var c$ = Clazz_decorateAsClass(function(){
this.$name = "JmolThread";
this.vwr = null;
this.eval = null;
this.sc = null;
this.haveReference = false;
this.hoverEnabled = false;
this.startTime = 0;
this.targetTime = 0;
this.lastRepaintTime = 0;
this.currentTime = 0;
this.sleepTime = 0;
this.isJS = false;
this.stopped = false;
this.isReset = false;
this.useTimeout = true;
this.junk = 0;
Clazz_instantialize(this, arguments);}, J.thread, "JmolThread", Thread);
Clazz_defineMethod(c$, "setManager", 
function(manager, vwr, params){
return 0;
}, "~O,JV.Viewer,~O");
Clazz_defineMethod(c$, "setViewer", 
function(vwr, name){
this.setName(name);
this.$name = name + "_" + (++J.thread.JmolThread.threadIndex);
this.vwr = vwr;
this.isJS = vwr.isSingleThreaded;
}, "JV.Viewer,~S");
Clazz_defineMethod(c$, "setEval", 
function(eval){
this.eval = eval;
this.sc = this.vwr.getEvalContextAndHoldQueue(eval);
if (this.sc != null) this.useTimeout = eval.getAllowJSThreads();
}, "J.api.JmolScriptEvaluator");
Clazz_defineMethod(c$, "resumeEval", 
function(){
if (this.eval == null || !this.isJS && !this.vwr.testAsync || !this.useTimeout) return;
this.sc.mustResumeEval = !this.stopped;
var eval = this.eval;
var sc = this.sc;
this.eval = null;
this.sc = null;
{
setTimeout(function() { eval.resumeEval(sc); }, 1);
}});
Clazz_overrideMethod(c$, "start", 
function(){
{
this.run();
}});
Clazz_overrideMethod(c$, "run", 
function(){
this.startTime = System.currentTimeMillis();
try {
this.run1(-1);
} catch (e$$) {
if (Clazz_exceptionOf(e$$,"InterruptedException")){
var e = e$$;
{
if (JU.Logger.debugging && !(Clazz_instanceOf(this,"J.thread.HoverWatcherThread"))) this.oops(e);
}
} else if (Clazz_exceptionOf(e$$, Exception)){
var e = e$$;
{
this.oops(e);
}
} else {
throw e$$;
}
}
});
Clazz_defineMethod(c$, "oops", 
function(e){
JU.Logger.debug(this.$name + " exception " + e);
if (!JV.Viewer.isJS || JV.Viewer.isSwingJS) e.printStackTrace();
this.vwr.queueOnHold = false;
}, "Exception");
Clazz_defineMethod(c$, "runSleep", 
function(millis, runPtr){
if (this.isJS && !this.useTimeout) {
return true;
}{
var me = this;
setTimeout(function(){me.run1(runPtr)}, Math.max(millis, 0));
return false;
}}, "~N,~N");
Clazz_defineMethod(c$, "interrupt", 
function(){
this.stopped = true;
this.vwr.startHoverWatcher(true);
if (!this.isJS) Clazz_superCall(this, J.thread.JmolThread, "interrupt", []);
});
Clazz_defineMethod(c$, "checkInterrupted", 
function(ref){
if (this.haveReference && (ref == null || !ref.$name.equals(this.$name))) return true;
{
return this.stopped;
}}, "J.thread.JmolThread");
Clazz_defineMethod(c$, "reset", 
function(){
this.isReset = true;
this.interrupt();
});
Clazz_defineMethod(c$, "toString", 
function(){
return Clazz_superCall(this, J.thread.JmolThread, "toString", []) + "[" + this.$name + "]";
});
c$.threadIndex = 0;
});
;//5.0.1-v7 Mon Aug 24 10:01:38 CDT 2026
Clazz_declarePackage("J.thread");
Clazz_load(["J.thread.JmolThread"], "J.thread.TimeoutThread", ["JU.SB"], function(){
var c$ = Clazz_decorateAsClass(function(){
this.script = null;
this.status = 0;
this.triggered = true;
Clazz_instantialize(this, arguments);}, J.thread, "TimeoutThread", J.thread.JmolThread);
Clazz_makeConstructor(c$, 
function(vwr, name, ms, script){
this.setViewer(vwr, name);
this.$name = name;
this.set(ms, script);
}, "JV.Viewer,~S,~N,~S");
Clazz_defineMethod(c$, "set", 
function(ms, script){
this.sleepTime = ms;
if (script != null) this.script = script;
}, "~N,~S");
Clazz_overrideMethod(c$, "toString", 
function(){
return "timeout name=" + this.$name + " executions=" + this.status + " mSec=" + this.sleepTime + " secRemaining=" + (this.targetTime - System.currentTimeMillis()) / 1000 + " script=" + this.script;
});
Clazz_overrideMethod(c$, "run1", 
function(mode){
while (true) {
switch (mode) {
case -1:
if (!this.isJS) Thread.currentThread().setPriority(1);
this.targetTime = System.currentTimeMillis() + Math.abs(this.sleepTime);
mode = 0;
break;
case 0:
if (this.checkInterrupted(null) || this.script == null || this.script.length == 0) return;
if (!this.runSleep(26, 1)) return;
mode = 1;
break;
case 1:
mode = (System.currentTimeMillis() < this.targetTime ? 0 : 2);
break;
case 2:
this.currentTime = System.currentTimeMillis();
if (this.vwr.timeouts.get(this.$name) == null) return;
this.status++;
var continuing = (this.sleepTime < 0);
if (continuing) this.targetTime = System.currentTimeMillis() + Math.abs(this.sleepTime);
 else this.vwr.timeouts.remove(this.$name);
if (this.triggered) {
this.triggered = false;
if (this.$name.equals("_SET_IN_MOTION_")) {
this.vwr.checkInMotion(2);
} else {
this.vwr.evalStringQuiet((continuing ? this.script + ";\ntimeout ID \"" + this.$name + "\";" : this.script));
}}mode = (continuing ? 0 : -2);
break;
case -2:
this.vwr.timeouts.remove(this.$name);
return;
}
}
}, "~N");
c$.clear = Clazz_defineMethod(c$, "clear", 
function(timeouts){
for (var o, $o = timeouts.values().iterator (); $o.hasNext()&& ((o = $o.next ()) || true);) {
var t = o;
if (!t.script.equals("exitJmol")) t.interrupt();
}
timeouts.clear();
}, "java.util.Map");
c$.setTimeout = Clazz_defineMethod(c$, "setTimeout", 
function(vwr, timeouts, name, mSec, script){
var t = timeouts.get(name);
if (mSec == 0) {
if (t != null) {
t.interrupt();
timeouts.remove(name);
}return;
}if (t != null) {
t.set(mSec, script);
return;
}t =  new J.thread.TimeoutThread(vwr, name, mSec, script);
timeouts.put(name, t);
t.start();
}, "JV.Viewer,java.util.Map,~S,~N,~S");
c$.trigger = Clazz_defineMethod(c$, "trigger", 
function(timeouts, name){
var t = timeouts.get(name);
if (t != null) t.triggered = (t.sleepTime < 0);
}, "java.util.Map,~S");
c$.showTimeout = Clazz_defineMethod(c$, "showTimeout", 
function(timeouts, name){
var sb =  new JU.SB();
if (timeouts != null) {
for (var o, $o = timeouts.values().iterator (); $o.hasNext()&& ((o = $o.next ()) || true);) {
var t = o;
if (name == null || t.$name.equalsIgnoreCase(name)) sb.append(t.toString()).append("\n");
}
}return (sb.length() > 0 ? sb.toString() : "<no timeouts set>");
}, "java.util.Map,~S");
});
;//5.0.1-v7 Mon Aug 24 10:01:38 CDT 2026
Clazz_declarePackage("JM");
Clazz_load(["JU.Node", "$.Point3fi", "J.c.PAL"], "JM.Atom", ["JU.BS", "$.CU", "$.P3", "$.PT", "$.SB", "J.atomdata.RadiusData", "J.c.VDW", "JM.Group", "JU.C", "$.Elements", "JV.JC"], function(){
var c$ = Clazz_decorateAsClass(function(){
this.altloc = '\0';
this.atomID = 0;
this.atomSite = 0;
this.group = null;
this.userDefinedVanDerWaalRadius = 0;
this.valence = 0;
this.atomNumberFlags = 0;
this.atomSymmetry = null;
this.formalChargeAndFlags = 0;
this.madAtom = 0;
this.colixAtom = 0;
this.paletteID = 0;
this.bonds = null;
this.nBondsDisplayed = 0;
this.nBackbonesDisplayed = 0;
this.clickabilityFlags = 0;
this.shapeVisibilityFlags = 0;
Clazz_instantialize(this, arguments);}, JM, "Atom", JU.Point3fi, JU.Node);
Clazz_prepareFields (c$, function(){
this.paletteID = J.c.PAL.CPK.id;
});
Clazz_overrideMethod(c$, "setAtom", 
function(modelIndex, atomIndex, xyz, radius, atomSymmetry, atomSite, atomicAndIsotopeNumber, formalCharge, isHetero, isNegDisorder){
this.mi = modelIndex;
this.atomSymmetry = atomSymmetry;
this.atomSite = atomSite;
this.i = atomIndex;
this.atomNumberFlags = atomicAndIsotopeNumber;
if (isHetero) this.formalChargeAndFlags = 2;
if (formalCharge != 0 && formalCharge != -2147483648) this.setFormalCharge(formalCharge);
this.userDefinedVanDerWaalRadius = radius;
if (xyz != null) this.setT(xyz);
return this;
}, "~N,~N,JU.P3,~N,JU.BS,~N,~N,~N,~B,~B");
Clazz_defineMethod(c$, "setShapeVisibility", 
function(flag, isVisible){
if (isVisible) this.shapeVisibilityFlags |= flag;
 else this.shapeVisibilityFlags &= ~flag;
}, "~N,~B");
Clazz_defineMethod(c$, "isCovalentlyBonded", 
function(atomOther){
if (this.bonds != null) for (var i = this.bonds.length; --i >= 0; ) if (this.bonds[i].isCovalent() && this.bonds[i].getOtherAtom(this) === atomOther) return true;

return false;
}, "JM.Atom");
Clazz_defineMethod(c$, "isBonded", 
function(atomOther){
if (this.bonds != null) for (var i = this.bonds.length; --i >= 0; ) if (this.bonds[i].getOtherAtom(this) === atomOther) return true;

return false;
}, "JM.Atom");
Clazz_defineMethod(c$, "getBond", 
function(atomOther){
if (this.bonds != null) for (var i = this.bonds.length; --i >= 0; ) if (this.bonds[i].getOtherAtom(atomOther) != null) return this.bonds[i];

return null;
}, "JM.Atom");
Clazz_defineMethod(c$, "addDisplayedBond", 
function(stickVisibilityFlag, isVisible){
this.nBondsDisplayed += (isVisible ? 1 : -1);
this.setShapeVisibility(stickVisibilityFlag, (this.nBondsDisplayed > 0));
}, "~N,~B");
Clazz_defineMethod(c$, "deleteBond", 
function(bond){
if (this.bonds != null) for (var i = this.bonds.length; --i >= 0; ) if (this.bonds[i] === bond) {
this.deleteBondAt(i);
return;
}
}, "JM.Bond");
Clazz_defineMethod(c$, "deleteBondAt", 
function(i){
this.setCIPChirality(0);
var newLength = this.bonds.length - 1;
if (newLength == 0) {
this.bonds = null;
return;
}var bondsNew =  new Array(newLength);
var j = 0;
for (; j < i; ++j) bondsNew[j] = this.bonds[j];

for (; j < newLength; ++j) bondsNew[j] = this.bonds[j + 1];

this.bonds = bondsNew;
}, "~N");
Clazz_overrideMethod(c$, "getBondedAtomIndex", 
function(bondIndex){
return this.bonds[bondIndex].getOtherAtom(this).i;
}, "~N");
Clazz_defineMethod(c$, "setMadAtom", 
function(vwr, rd){
this.madAtom = this.calculateMad(vwr, rd);
}, "JV.Viewer,J.atomdata.RadiusData");
Clazz_defineMethod(c$, "calculateMad", 
function(vwr, rd){
if (rd == null) return 0;
var f = rd.value;
if (f == 0) return 0;
switch (rd.factorType) {
case J.atomdata.RadiusData.EnumType.SCREEN:
return Clazz_floatToShort(f);
case J.atomdata.RadiusData.EnumType.FACTOR:
case J.atomdata.RadiusData.EnumType.OFFSET:
var r = 0;
switch (rd.vdwType) {
case J.c.VDW.TEMP:
var tmax = vwr.ms.getBfactor100Hi();
r = (tmax > 0 ? this.getBfactor100() / tmax : 0);
break;
case J.c.VDW.HYDRO:
r = Math.abs(this.getHydrophobicity());
break;
case J.c.VDW.BONDING:
r = this.getBondingRadius();
break;
case J.c.VDW.ADPMIN:
case J.c.VDW.ADPMAX:
r = this.getADPMinMax(rd.vdwType === J.c.VDW.ADPMAX);
break;
default:
r = this.getVanderwaalsRadiusFloat(vwr, rd.vdwType);
}
if (rd.factorType === J.atomdata.RadiusData.EnumType.FACTOR) f *= r;
 else f += r;
break;
case J.atomdata.RadiusData.EnumType.ABSOLUTE:
if (f == 16.1) return 32200;
break;
}
var mad = Clazz_floatToShort(f < 0 ? f : f * 2000);
if (mad < 0 && f > 0) mad = 0;
return mad;
}, "JV.Viewer,J.atomdata.RadiusData");
Clazz_defineMethod(c$, "getADPMinMax", 
function(isMax){
var tensors = this.getTensors();
if (tensors == null) return 0;
var t = tensors[0];
if (t == null || t.iType != 1) return 0;
if (this.group.chain.model.ms.isModulated(this.i) && t.isUnmodulated) t = tensors[1];
return t.getFactoredValue(isMax ? 2 : 1);
}, "~B");
Clazz_defineMethod(c$, "getTensors", 
function(){
return this.group.chain.model.ms.getAtomTensorList(this.i);
});
Clazz_defineMethod(c$, "getRasMolRadius", 
function(){
return Math.abs(Clazz_doubleToInt(this.madAtom / 8));
});
Clazz_overrideMethod(c$, "getEdges", 
function(){
return (this.bonds == null ?  new Array(0) : this.bonds);
});
Clazz_overrideMethod(c$, "getBondCount", 
function(){
return (this.bonds == null ? 0 : this.bonds.length);
});
Clazz_defineMethod(c$, "setTranslucent", 
function(isTranslucent, translucentLevel){
this.colixAtom = JU.C.getColixTranslucent3(this.colixAtom, isTranslucent, translucentLevel);
}, "~B,~N");
Clazz_overrideMethod(c$, "getElementNumber", 
function(){
return JU.Elements.getElementNumber(this.atomNumberFlags);
});
Clazz_overrideMethod(c$, "getIsotopeNumber", 
function(){
return JU.Elements.getIsotopeNumber(this.atomNumberFlags);
});
Clazz_overrideMethod(c$, "getAtomicAndIsotopeNumber", 
function(){
return this.atomNumberFlags;
});
Clazz_defineMethod(c$, "setAtomicAndIsotopeNumber", 
function(n){
if (n < 0 || (n & 127) >= JU.Elements.elementNumberMax || n > 0xFFFF) n = 0;
this.atomNumberFlags = n;
}, "~N");
Clazz_defineMethod(c$, "getElementSymbolIso", 
function(withIsotope){
return JU.Elements.elementSymbolFromNumber(withIsotope ? this.atomNumberFlags : this.atomNumberFlags & 127);
}, "~B");
Clazz_defineMethod(c$, "getElementSymbol", 
function(){
return this.getElementSymbolIso(true);
});
Clazz_defineMethod(c$, "isHetero", 
function(){
return (this.formalChargeAndFlags & 2) != 0;
});
Clazz_defineMethod(c$, "hasVibration", 
function(){
return (this.formalChargeAndFlags & 1) != 0;
});
Clazz_defineMethod(c$, "setFormalCharge", 
function(charge){
this.formalChargeAndFlags = (this.formalChargeAndFlags & 15) | ((charge == -2147483648 ? 0 : charge > 7 ? 7 : charge < -3 ? -3 : charge) << 24);
}, "~N");
Clazz_defineMethod(c$, "setVibrationVector", 
function(){
this.formalChargeAndFlags |= 1;
});
Clazz_defineMethod(c$, "setNegativeDisorder", 
function(){
this.formalChargeAndFlags |= 4;
});
Clazz_defineMethod(c$, "isNegativeDisorder", 
function(){
return ((this.formalChargeAndFlags & 4) != 0);
});
Clazz_overrideMethod(c$, "getFormalCharge", 
function(){
return this.formalChargeAndFlags >> 24;
});
Clazz_defineMethod(c$, "getOccupancy100", 
function(){
var occupancies = this.group.chain.model.ms.occupancies;
return (occupancies == null ? 100 : Math.round(occupancies[this.i]));
});
Clazz_defineMethod(c$, "isOccupied", 
function(){
var occupancies = this.group.chain.model.ms.occupancies;
return (occupancies == null || occupancies[this.i] >= 50);
});
Clazz_defineMethod(c$, "getBfactor100", 
function(){
var bfactor100s = this.group.chain.model.ms.bfactor100s;
return (bfactor100s == null ? 0 : bfactor100s[this.i]);
});
Clazz_defineMethod(c$, "getHydrophobicity", 
function(){
var values = this.group.chain.model.ms.hydrophobicities;
return (values == null ? JU.Elements.getHydrophobicity(this.group.groupID) : values[this.i]);
});
Clazz_defineMethod(c$, "setRadius", 
function(radius){
return !Float.isNaN(this.userDefinedVanDerWaalRadius = (radius > 0 ? radius : NaN));
}, "~N");
Clazz_defineMethod(c$, "$delete", 
function(bsBonds){
this.valence = -1;
if (this.bonds != null) for (var i = this.bonds.length; --i >= 0; ) {
var bond = this.bonds[i];
bond.getOtherAtom(this).deleteBond(bond);
bsBonds.set(bond.index);
}
this.bonds = null;
}, "JU.BS");
Clazz_overrideMethod(c$, "isDeleted", 
function(){
return (this.valence < 0);
});
Clazz_defineMethod(c$, "setValence", 
function(nBonds){
if (!this.isDeleted()) this.valence = (nBonds < 0 ? 0 : nBonds <= 0x7F ? nBonds : 0x7F);
}, "~N");
Clazz_overrideMethod(c$, "getValence", 
function(){
return (this.isDeleted() ? -1 : this.valence > 0 ? this.valence : this.getValenceAromatic(true));
});
Clazz_defineMethod(c$, "getValenceAromatic", 
function(checkAromatic){
if (this.isDeleted()) return -1;
var n = this.valence;
if (n == 0 && this.bonds != null) {
var npartial = 0;
for (var i = this.bonds.length; --i >= 0; ) {
n += this.bonds[i].getValence();
if (checkAromatic && this.bonds[i].is(515)) npartial++;
}
if (n > 0 && n < 3 && npartial != 0) n++;
}return n;
}, "~B");
Clazz_overrideMethod(c$, "getCovalentBondCount", 
function(){
if (this.bonds == null) return 0;
var n = 0;
for (var i = this.bonds.length; --i >= 0; ) {
var b = this.bonds[i];
if (b.isCovalentNotPartial0() && !b.getOtherAtom(this).isDeleted()) ++n;
}
return n;
});
Clazz_defineMethod(c$, "getCovalentOrPartialBondCount", 
function(){
if (this.bonds == null) return 0;
var n = 0;
for (var i = this.bonds.length; --i >= 0; ) {
var b = this.bonds[i];
if (b.isCovalent() && !b.getOtherAtom(this).isDeleted()) ++n;
}
return n;
});
Clazz_overrideMethod(c$, "getCovalentHydrogenCount", 
function(){
if (this.bonds == null) return 0;
var n = 0;
for (var i = this.bonds.length; --i >= 0; ) {
var b = this.bonds[i];
if (b.isCovalentNotPartial0()) {
var a = this.bonds[i].getOtherAtom(this);
if (a.valence >= 0 && a.getElementNumber() == 1) ++n;
}}
return n;
});
Clazz_overrideMethod(c$, "getImplicitHydrogenCount", 
function(){
return this.group.chain.model.ms.getMissingHydrogenCount(this, false);
});
Clazz_overrideMethod(c$, "getTotalHydrogenCount", 
function(){
return this.getCovalentHydrogenCount() + this.getImplicitHydrogenCount();
});
Clazz_overrideMethod(c$, "getTotalValence", 
function(){
var v = this.getValence();
if (v < 0) return v;
var h = this.getImplicitHydrogenCount();
var sp2 = this.group.chain.model.ms.aaRet[4];
return v + h + sp2;
});
Clazz_overrideMethod(c$, "getCovalentBondCountPlusMissingH", 
function(){
return this.getCovalentBondCount() + this.getImplicitHydrogenCount();
});
Clazz_defineMethod(c$, "getTargetValence", 
function(){
switch (this.getElementNumber()) {
case 6:
case 14:
case 32:
return 4;
case 5:
case 7:
case 15:
return 3;
case 8:
case 16:
return 2;
case 1:
case 9:
case 17:
case 35:
case 53:
return 1;
}
return -1;
});
Clazz_defineMethod(c$, "getDimensionValue", 
function(dimension){
return (dimension == 0 ? this.x : (dimension == 1 ? this.y : this.z));
}, "~N");
Clazz_defineMethod(c$, "getVanderwaalsRadiusFloat", 
function(vwr, type){
return (Float.isNaN(this.userDefinedVanDerWaalRadius) ? vwr.getVanderwaalsMarType(this.atomNumberFlags, this.getVdwType(type)) / 1000 : this.userDefinedVanDerWaalRadius);
}, "JV.Viewer,J.c.VDW");
Clazz_defineMethod(c$, "getVdwType", 
function(type){
switch (type) {
case J.c.VDW.AUTO:
type = this.group.chain.model.ms.getDefaultVdwType(this.mi);
break;
case J.c.VDW.NOJMOL:
type = this.group.chain.model.ms.getDefaultVdwType(this.mi);
if (type === J.c.VDW.AUTO_JMOL) type = J.c.VDW.AUTO_BABEL;
break;
}
return type;
}, "J.c.VDW");
Clazz_defineMethod(c$, "getBondingRadius", 
function(){
var rr = this.group.chain.model.ms.bondingRadii;
var r = (rr == null || this.i >= rr.length ? 0 : rr[this.i]);
return (r == 0 ? JU.Elements.getBondingRadius(this.atomNumberFlags, this.getFormalCharge()) : r);
});
Clazz_defineMethod(c$, "getVolume", 
function(vwr, vType){
var r1 = (vType == null ? this.userDefinedVanDerWaalRadius : NaN);
if (Float.isNaN(r1)) r1 = vwr.getVanderwaalsMarType(this.getElementNumber(), this.getVdwType(vType)) / 1000;
var volume = 0;
if (this.bonds != null) for (var j = 0; j < this.bonds.length; j++) {
if (!this.bonds[j].isCovalent()) continue;
var atom2 = this.bonds[j].getOtherAtom(this);
var r2 = (vType == null ? atom2.userDefinedVanDerWaalRadius : NaN);
if (Float.isNaN(r2)) r2 = vwr.getVanderwaalsMarType(atom2.getElementNumber(), atom2.getVdwType(vType)) / 1000;
var d = this.distance(atom2);
if (d > r1 + r2) continue;
if (d + r1 <= r2) return 0;
var h = r1 - (r1 * r1 + d * d - r2 * r2) / (2.0 * d);
volume -= 1.0471975511965976 * h * h * (3 * r1 - h);
}
return (volume + 4.1887902047863905 * r1 * r1 * r1);
}, "JV.Viewer,J.c.VDW");
Clazz_defineMethod(c$, "getCurrentBondCount", 
function(){
return this.bonds == null ? 0 : this.bonds.length;
});
Clazz_defineMethod(c$, "getRadius", 
function(){
return Math.abs(this.madAtom / 2000);
});
Clazz_overrideMethod(c$, "getIndex", 
function(){
return this.i;
});
Clazz_overrideMethod(c$, "getAtomSite", 
function(){
return this.atomSite;
});
Clazz_overrideMethod(c$, "getGroupBits", 
function(bs){
this.group.setAtomBits(bs);
}, "JU.BS");
Clazz_overrideMethod(c$, "getAtomName", 
function(){
return (this.atomID > 0 ? JM.Group.specialAtomNames[this.atomID] : this.group.chain.model.ms.atomNames == null ? "" : this.group.chain.model.ms.atomNames[this.i]);
});
Clazz_overrideMethod(c$, "getAtomType", 
function(){
var atomTypes = this.group.chain.model.ms.atomTypes;
var type = (atomTypes == null ? null : atomTypes[this.i]);
return (type == null ? this.getAtomName() : type);
});
Clazz_overrideMethod(c$, "getAtomNumber", 
function(){
var atomSerials = this.group.chain.model.ms.atomSerials;
return (atomSerials == null ? this.i : atomSerials[this.i]);
});
Clazz_defineMethod(c$, "getSeqID", 
function(){
var ids = this.group.chain.model.ms.atomSeqIDs;
return (ids == null ? 0 : ids[this.i]);
});
Clazz_defineMethod(c$, "isVisible", 
function(flags){
return ((this.shapeVisibilityFlags & flags) == flags);
}, "~N");
Clazz_defineMethod(c$, "getPartialCharge", 
function(){
var partialCharges = this.group.chain.model.ms.partialCharges;
return partialCharges == null ? 0 : partialCharges[this.i];
});
Clazz_defineMethod(c$, "getSymmetryTranslation", 
function(symop, cellRange, nOps){
var pt = symop;
for (var i = 0; i < cellRange.length; i++) if (this.atomSymmetry.get(pt += nOps)) return cellRange[i];

return 0;
}, "~N,~A,~N");
Clazz_defineMethod(c$, "getCellTranslation", 
function(cellNNN, cellRange, nOps){
var pt = nOps;
for (var i = 0; i < cellRange.length; i++) for (var j = 0; j < nOps; j++, pt++) if (this.atomSymmetry.get(pt) && cellRange[i] == cellNNN) return cellRange[i];


return 0;
}, "~N,~A,~N");
Clazz_defineMethod(c$, "getSymmetryOperatorList", 
function(isAll){
var str = "";
var f = this.group.chain.model.ms;
var nOps = f.getModelSymmetryCount(this.mi);
if (nOps == 0 || this.atomSymmetry == null) return "";
var cellRange = f.getModelCellRange(this.mi);
var pt = nOps;
var n = (cellRange == null ? 1 : cellRange.length);
var bs = (isAll ? null :  new JU.BS());
for (var i = 0; i < n; i++) for (var j = 0; j < nOps; j++) if (this.atomSymmetry.get(pt++)) if (isAll) {
str += "," + (j + 1) + (cellRange == null ? 555 : cellRange[i]);
} else {
bs.set(j + 1);
}

if (!isAll) for (var i = bs.nextSetBit(0); i >= 0; i = bs.nextSetBit(i + 1)) str += "," + i;

return (str.length == 0 ? "" : str.substring(1));
}, "~B");
Clazz_overrideMethod(c$, "getModelIndex", 
function(){
return this.mi;
});
Clazz_overrideMethod(c$, "getMoleculeNumber", 
function(inModel){
return (this.group.chain.model.ms.getMoleculeIndex(this.i, inModel) + 1);
}, "~B");
Clazz_defineMethod(c$, "getFractionalCoord", 
function(fixJavaFloat, ch, ignoreOffset, pt){
pt = this.getFractionalCoordPt(fixJavaFloat, ignoreOffset, pt);
return (ch == 'X' ? pt.x : ch == 'Y' ? pt.y : pt.z);
}, "~B,~S,~B,JU.P3");
Clazz_overrideMethod(c$, "getXYZ", 
function(){
return this;
});
Clazz_defineMethod(c$, "getFractionalCoordPt", 
function(fixJavaFloat, ignoreOffset, pt){
var c = this.getUnitCell();
if (pt == null) pt = JU.P3.newP(this);
 else pt.setT(this);
if (c != null) {
c = c.getUnitCellMultiplied();
c.toFractional(pt, ignoreOffset);
if (fixJavaFloat) JU.PT.fixPtFloats(pt, 100000.0);
}return pt;
}, "~B,~B,JU.P3");
Clazz_defineMethod(c$, "getUnitCell", 
function(){
return this.group.chain.model.ms.getUnitCellForAtom(this.i);
});
Clazz_defineMethod(c$, "getFractionalUnitCoord", 
function(fixJavaFloat, ch, pt){
pt = this.getFractionalUnitCoordPt(fixJavaFloat, false, pt);
return (ch == 'X' ? pt.x : ch == 'Y' ? pt.y : pt.z);
}, "~B,~S,JU.P3");
Clazz_defineMethod(c$, "getFractionalUnitCoordPt", 
function(fixJavaFloat, asCartesian, pt){
var c = this.getUnitCell();
if (pt == null) pt = JU.P3.newP(this);
 else pt.setT(this);
if (c == null) return pt;
c = c.getUnitCellMultiplied();
if (this.group.chain.model.isJmolDataFrame) {
c.toFractional(pt, false);
if (asCartesian) c.toCartesian(pt, false);
} else {
c.toUnitCell(pt, null);
if (!asCartesian) c.toFractional(pt, false);
}if (fixJavaFloat) JU.PT.fixPtFloats(pt, asCartesian ? 10000.0 : 100000.0);
return pt;
}, "~B,~B,JU.P3");
Clazz_defineMethod(c$, "getFractionalUnitDistance", 
function(pt, ptTemp1, ptTemp2){
var c = this.getUnitCell();
if (c == null) return this.distance(pt);
ptTemp1.setT(this);
ptTemp2.setT(pt);
if (this.group.chain.model.isJmolDataFrame) {
c.toFractional(ptTemp1, true);
c.toFractional(ptTemp2, true);
} else {
c.toUnitCell(ptTemp1, null);
c.toUnitCell(ptTemp2, null);
}return ptTemp1.distance(ptTemp2);
}, "JU.T3,JU.T3,JU.T3");
Clazz_defineMethod(c$, "setFractionalCoord", 
function(tok, fValue, asAbsolute){
var c = this.getUnitCell();
if (c != null) c.toFractional(this, asAbsolute);
switch (tok) {
case 1111492615:
case 1111492612:
this.x = fValue;
break;
case 1111492616:
case 1111492613:
this.y = fValue;
break;
case 1111492617:
case 1111492614:
this.z = fValue;
break;
}
if (c != null) c.toCartesian(this, asAbsolute);
}, "~N,~N,~B");
Clazz_defineMethod(c$, "setFractionalCoordTo", 
function(ptNew, asAbsolute){
this.setFractionalCoordPt(this, ptNew, asAbsolute);
}, "JU.P3,~B");
Clazz_defineMethod(c$, "setFractionalCoordPt", 
function(pt, ptNew, asAbsolute){
pt.setT(ptNew);
var c = this.getUnitCell();
if (c != null) c.toCartesian(pt, asAbsolute && !this.group.chain.model.isJmolDataFrame);
}, "JU.P3,JU.P3,~B");
Clazz_defineMethod(c$, "isCursorOnTopOf", 
function(xCursor, yCursor, minRadius, competitor){
var r = Clazz_doubleToInt(this.sD / 2);
if (r < minRadius) r = minRadius;
var r2 = r * r;
var dx = this.sX - xCursor;
var dx2 = dx * dx;
if (dx2 > r2) return false;
var dy = this.sY - yCursor;
var dy2 = dy * dy;
var dz2 = r2 - (dx2 + dy2);
if (dz2 < 0) return false;
if (competitor == null) return true;
var z = this.sZ;
var zCompetitor = competitor.sZ;
var rCompetitor = Clazz_doubleToInt(competitor.sD / 2);
if (z < zCompetitor - rCompetitor) return true;
var dxCompetitor = competitor.sX - xCursor;
var dx2Competitor = dxCompetitor * dxCompetitor;
var dyCompetitor = competitor.sY - yCursor;
var dy2Competitor = dyCompetitor * dyCompetitor;
var r2Competitor = rCompetitor * rCompetitor;
var dz2Competitor = r2Competitor - (dx2Competitor + dy2Competitor);
return (z - Math.sqrt(dz2) < zCompetitor - Math.sqrt(dz2Competitor));
}, "~N,~N,~N,JM.Atom");
Clazz_defineMethod(c$, "getInfo", 
function(){
return this.getIdentity(2);
});
Clazz_defineMethod(c$, "getIdentityXYZ", 
function(pt, mode){
pt = (mode == 3 || this.group.chain.model.isJmolDataFrame ? this.getFractionalCoordPt(!this.group.chain.model.ms.vwr.g.legacyJavaFloat, false, pt) : this);
var s = (mode == 3 ? "" : this.getIdentity(mode) + " ") + JU.PT.formatF(pt.x, 0, 3, true, true) + " " + JU.PT.formatF(pt.y, 0, 3, true, true) + " " + JU.PT.formatF(pt.z, 0, 3, true, true);
return s;
}, "JU.P3,~N");
Clazz_defineMethod(c$, "getIdentity", 
function(mode){
var info =  new JU.SB();
var group3 = this.getGroup3(true);
if (group3 != null && group3.length > 0 && (!group3.equals("UNK") || this.group.chain.model.isBioModel)) {
info.append("[");
info.append(group3);
info.append("]");
var seqcodeString = this.group.getSeqcodeString();
if (seqcodeString != null) info.append(seqcodeString);
var chainID = this.group.chain.chainID;
if (chainID != 0 && chainID != 32) {
info.append(":");
var s = this.getChainIDStr();
if (chainID >= 256) s = JU.PT.esc(s);
info.append(s);
}if (mode != 2 && mode != 5) return info.toString();
info.append(".");
}info.append(this.getAtomName());
if (info.length() == 0) {
info.append(this.getElementSymbolIso(false));
info.append(" ");
info.appendI(this.getAtomNumber());
}if (mode == 2) {
if (this.altloc != '\0') {
info.append("%");
info.appendC(this.altloc);
}if (this.group.chain.model.ms.mc > 1 && !this.group.chain.model.isJmolDataFrame) {
info.append("/");
info.append(this.getModelNumberForLabel());
}info.append(" #");
info.appendI(this.getAtomNumber());
}return info.toString();
}, "~N");
Clazz_overrideMethod(c$, "getGroup3", 
function(allowNull){
var group3 = this.group.getGroup3();
return (allowNull || group3 != null && group3.length > 0 ? group3 : "UNK");
}, "~B");
Clazz_overrideMethod(c$, "getGroup1", 
function(c0){
var c = this.group.getGroup1();
return (c != '\0' ? "" + c : c0 != '\0' ? "" + c0 : "");
}, "~S");
Clazz_overrideMethod(c$, "getBioSmilesType", 
function(){
return (this.group.isProtein() ? 'p' : this.group.isDna() ? 'd' : this.group.isRna() ? 'r' : this.group.isCarbohydrate() ? 'c' : ' ');
});
Clazz_overrideMethod(c$, "isPurine", 
function(){
return this.group.isPurine();
});
Clazz_overrideMethod(c$, "isPyrimidine", 
function(){
return this.group.isPyrimidine();
});
Clazz_overrideMethod(c$, "getResno", 
function(){
return this.group.getResno();
});
Clazz_defineMethod(c$, "isClickable", 
function(){
return (this.checkVisible() && this.clickabilityFlags != 0 && ((this.shapeVisibilityFlags | this.group.shapeVisibilityFlags) & this.clickabilityFlags) != 0);
});
Clazz_defineMethod(c$, "setClickable", 
function(flag){
if (flag == 0) {
this.clickabilityFlags = 0;
} else {
this.clickabilityFlags |= flag;
if (flag != 1040384) this.shapeVisibilityFlags |= flag;
}}, "~N");
Clazz_defineMethod(c$, "checkVisible", 
function(){
if (this.isVisible(2)) return this.isVisible(4);
var isVis = this.isVisible(9);
if (isVis) {
var flags = this.shapeVisibilityFlags;
if (this.group.shapeVisibilityFlags != 0 && (this.group.shapeVisibilityFlags != 8192 || this.isLeadAtom())) flags |= this.group.shapeVisibilityFlags;
flags &= -10;
if (flags == 32 && this.clickabilityFlags == 0) flags = 0;
isVis = (flags != 0);
if (isVis) this.shapeVisibilityFlags |= 4;
}this.shapeVisibilityFlags |= 2;
return isVis;
});
Clazz_overrideMethod(c$, "isLeadAtom", 
function(){
return this.group.isLeadAtom(this.i);
});
Clazz_overrideMethod(c$, "getChainID", 
function(){
return this.group.chain.chainID;
});
Clazz_overrideMethod(c$, "getChainIDStr", 
function(){
return this.group.chain.getIDStr();
});
Clazz_defineMethod(c$, "getSurfaceDistance100", 
function(){
return this.group.chain.model.ms.getSurfaceDistance100(this.i);
});
Clazz_defineMethod(c$, "getVibrationVector", 
function(){
return this.group.chain.model.ms.getVibration(this.i, false);
});
Clazz_defineMethod(c$, "getModulation", 
function(){
return this.group.chain.model.ms.getModulation(this.i);
});
Clazz_defineMethod(c$, "getModelNumberForLabel", 
function(){
return this.group.chain.model.ms.getModelNumberForAtomLabel(this.mi);
});
Clazz_defineMethod(c$, "getModelNumber", 
function(){
return this.group.chain.model.ms.getModelNumber(this.mi) % 1000000;
});
Clazz_overrideMethod(c$, "getBioStructureTypeName", 
function(){
return this.group.getBioStructureType().getBioStructureTypeName(true);
});
Clazz_overrideMethod(c$, "equals", 
function(obj){
return (this === obj);
}, "~O");
Clazz_overrideMethod(c$, "hashCode", 
function(){
return this.i;
});
Clazz_defineMethod(c$, "findAromaticNeighbor", 
function(notAtomIndex){
if (this.bonds == null) return null;
for (var i = this.bonds.length; --i >= 0; ) {
var bondT = this.bonds[i];
var a = bondT.getOtherAtom(this);
if (bondT.isAromatic() && a.i != notAtomIndex) return a;
}
return null;
}, "~N");
Clazz_defineMethod(c$, "atomPropertyInt", 
function(vwr, tokWhat){
switch (tokWhat) {
case 1094715393:
return this.getAtomNumber();
case 1094713368:
return this.getSeqID();
case 1094713346:
return this.atomID;
case 1094713371:
return Math.max(0, this.altloc.charCodeAt(0) - 32);
case 1094713347:
return this.i;
case 1228931586:
return this.getCovalentBondCount();
case 1094713351:
return this.group.chain.chainNo;
case 1765808134:
return vwr.gdata.getColorArgbOrGray(this.colixAtom);
case 1086326789:
case 1094715402:
return this.getElementNumber();
case 1094713353:
return this.getAtomicAndIsotopeNumber();
case 1228935687:
return this.group.chain.model.fileIndex + 1;
case 1631586315:
return this.getFormalCharge();
case 1094713356:
return this.group.groupID;
case 1094713357:
return this.group.groupIndex;
case 1094717454:
return this.getModelNumber();
case -1094717454:
return vwr.ms.modelFileNumbers[this.mi];
case 1094713359:
return this.mi;
case 1094713360:
return this.getMoleculeNumber(true);
case 1094713361:
return this.group.getMonomerIndex() + 1;
case 1128269825:
return this.getOccupancy100();
case 1094713362:
return this.group.getBioPolymerIndexInModel() + 1;
case 1094713363:
return this.group.getBioPolymerLength();
case 1665140738:
return this.getRasMolRadius();
case 1094715412:
return this.getResno();
case 1094713365:
return Math.round(vwr.antialiased ? Clazz_doubleToInt(this.sX / 2) : this.sX);
case 1094713366:
return Math.round(vwr.getScreenHeight() - (vwr.antialiased ? Clazz_doubleToInt(this.sY / 2) : this.sY));
case 1094713367:
return Math.round(vwr.antialiased ? Clazz_doubleToInt(this.sZ / 2) : this.sZ);
case 1094713369:
return this.getAtomSite();
case 1095241729:
return this.getSpin();
case 1639976963:
return this.group.getBioStructureType().getId();
case 1237320707:
return this.group.getBioStructureSubType(1111490651).getId();
case 1094713370:
return this.group.getStrucNo();
case 1296041986:
return this.getSymOp();
case 1094715420:
return this.getValence();
}
return 0;
}, "JV.Viewer,~N");
Clazz_defineMethod(c$, "getSpin", 
function(){
return this.group.chain.model.ms.getSpin(this.i);
});
Clazz_defineMethod(c$, "getSymOp", 
function(){
return (this.atomSymmetry == null ? 0 : this.atomSymmetry.nextSetBit(0) + 1);
});
Clazz_defineMethod(c$, "atomPropertyFloat", 
function(vwr, tokWhat, ptTemp){
switch (tokWhat) {
case 1111490561:
return this.getADPMinMax(true);
case 1111490562:
return this.getADPMinMax(false);
case 1111492609:
case 1111492629:
return this.x;
case 1111492610:
case 1111492630:
return this.y;
case 1111492611:
case 1111492631:
return this.z;
case 1111490587:
return this.group.chain.model.ms.getAtomicDSSRDataFloat("dssr", this.i);
case 1114249217:
case 1112152066:
case 1112150019:
case 1112150020:
case 1112150021:
case 1112152070:
case 1112152071:
case 1112152073:
case 1112152074:
case 1112152076:
case 1649022989:
case 1112152078:
return vwr.shm.getAtomShapeValue(tokWhat, this.group, this.i);
case 1111492618:
return this.getBondingRadius();
case 1111490563:
return vwr.getNMRCalculation().getChemicalShift(this);
case 1111490564:
return JU.Elements.getCovalentRadius(this.atomNumberFlags);
case 1111490565:
case 1111490576:
case 1111490574:
return this.group.getGroupParameter(tokWhat);
case 1111492615:
case 1111492612:
return this.getFractionalCoord(!vwr.g.legacyJavaFloat, 'X', false, ptTemp);
case 1111492616:
case 1111492613:
return this.getFractionalCoord(!vwr.g.legacyJavaFloat, 'Y', false, ptTemp);
case 1111492617:
case 1111492614:
return this.getFractionalCoord(!vwr.g.legacyJavaFloat, 'Z', false, ptTemp);
case 1113589786:
return this.getHydrophobicity();
case 1111490566:
return vwr.getNMRCalculation().getMagneticShielding(this);
case 1111490567:
return this.getMass();
case 1128269825:
return this.getOccupancy100() / 100;
case 1111492619:
return this.getPartialCharge();
case 1111490569:
case 1111490570:
case 1111490568:
if (this.group.chain.model.isJmolDataFrame && this.group.chain.model.jmolFrameTypeInt == 4138) {
switch (tokWhat) {
case 1111490569:
return this.getFractionalCoord(!vwr.g.legacyJavaFloat, 'X', false, ptTemp);
case 1111490570:
return this.getFractionalCoord(!vwr.g.legacyJavaFloat, 'Y', false, ptTemp);
case 1111490568:
var omega = this.getFractionalCoord(!vwr.g.legacyJavaFloat, 'Z', false, ptTemp) - 180;
return (omega < -180 ? 360 + omega : omega);
}
}return this.group.getGroupParameter(tokWhat);
case 1665140738:
case 1112152075:
return this.getRadius();
case 1113589787:
return (vwr.slm.isAtomSelected(this.i) ? 1 : 0);
case 1111490575:
vwr.ms.getSurfaceDistanceMax();
return this.getSurfaceDistance100() / 100;
case 1111492620:
return this.getBfactor100() / 100;
case 1111490588:
return JU.C.getColixTranslucencyFractional(this.colixAtom);
case 1312817669:
return this.getVolume(vwr, J.c.VDW.AUTO);
case 1111490577:
return this.getFractionalUnitCoord(!vwr.g.legacyJavaFloat, 'X', ptTemp);
case 1111490578:
return this.getFractionalUnitCoord(!vwr.g.legacyJavaFloat, 'Y', ptTemp);
case 1111490579:
return this.getFractionalUnitCoord(!vwr.g.legacyJavaFloat, 'Z', ptTemp);
case 1648363544:
return this.getVanderwaalsRadiusFloat(vwr, J.c.VDW.AUTO);
case 1648361473:
var v = this.getVibrationVector();
return (v == null ? 0 : v.length() * vwr.getFloat(1648361473));
case 1111492626:
return this.getVib('x');
case 1111492627:
return this.getVib('y');
case 1111492628:
return this.getVib('z');
case 1111490583:
return this.getVib('X');
case 1111490584:
return this.getVib('Y');
case 1111490585:
return this.getVib('Z');
case 1111490586:
return this.getVib('O');
case 1111490580:
return this.getVib('1');
case 1111490581:
return this.getVib('2');
case 1111490582:
return this.getVib('3');
case 1145047050:
case 1145047053:
case 1145045006:
case 1145047052:
case 1145047055:
case 1145045008:
case 1145047049:
var v3 = this.atomPropertyTuple(vwr, tokWhat, ptTemp);
return (v3 == null ? -1 : v3.length());
}
return this.atomPropertyInt(vwr, tokWhat);
}, "JV.Viewer,~N,JU.P3");
Clazz_defineMethod(c$, "getVib", 
function(ch){
return this.group.chain.model.ms.getVibCoord(this.i, ch);
}, "~S");
Clazz_defineMethod(c$, "getNominalMass", 
function(){
var mass = this.getIsotopeNumber();
return (mass > 0 ? mass : JU.Elements.getNaturalIsotope(this.getElementNumber()));
});
Clazz_overrideMethod(c$, "getMass", 
function(){
var mass = this.getIsotopeNumber();
return (mass > 0 ? mass : JU.Elements.getAtomicMass(this.getElementNumber()));
});
Clazz_defineMethod(c$, "atomPropertyString", 
function(vwr, tokWhat){
var ch;
var s;
switch (tokWhat) {
case 1153433601:
return this.getIdentity(5);
case 1086324739:
ch = this.altloc;
return (ch == '\0' ? "" : "" + ch);
case 1086326786:
return this.getAtomName();
case 1086326785:
return this.getAtomType();
case 1086326788:
return this.getChainIDStr();
case 1086324752:
return this.getCIPChirality(true);
case 1086324753:
return this.getCIPChiralityRule();
case 1140850705:
case 1086324754:
return this.getWyckoffPosition(false);
case 1086324755:
return this.getWyckoffPosition(true);
case 1086324744:
return this.getGroup1('?');
case 1086324747:
s = this.group.getSeqcodeString();
return (s == null ? "" : s);
case 1086324743:
return this.getGroup1('\0');
case 1086324742:
return this.getGroup3(false);
case 1086326789:
return this.getElementSymbolIso(true);
case 1086324745:
return this.getIdentity(2);
case 1086324746:
ch = this.group.getInsertionCode();
return (ch == '\0' ? "" : "" + ch);
case 1825200146:
case 1287653388:
s = vwr.shm.getShapePropertyIndex(5, "label", this.i);
if (s == null) s = "";
return s;
case 1145045003:
return vwr.getSymStatic().staticToRationalXYZ(this.getFractionalCoordPt(!vwr.g.legacyJavaFloat, false, null), " ");
case 1639976963:
return this.group.getBioStructureType().getBioStructureTypeName(false);
case 1237320707:
return this.group.getBioStructureSubType(1111490651).getBioStructureTypeName(false);
case 1086324749:
return this.group.getStructureId();
case 1086324748:
return vwr.getHybridizationAndAxes(this.i, null, null, "d");
case 1086326798:
return this.getElementSymbolIso(false);
case 1088421903:
return this.getSymmetryOperatorList(true);
}
return "";
}, "JV.Viewer,~N");
Clazz_defineMethod(c$, "getWyckoffPosition", 
function(withMultiplicity){
var ms = this.group.chain.model.ms;
var a = ms.getBasisAtom(this.i, true);
var id = a.getSeqID();
if (id != 0) {
return (withMultiplicity ? "" + (id >> 16) : "") + String.fromCharCode(id & 0xFF);
}var sym = this.getUnitCell();
var s;
if (sym == null || (s = sym.getWyckoffPosition(this, "M")) == null) {
s = "0?";
}ms.setAtomSeqID(this.i, (JU.PT.parseInt(s) << 16) + (s.charAt(s.length - 1)).charCodeAt(0));
return (withMultiplicity ? s : s.substring(s.length - 1));
}, "~B");
Clazz_overrideMethod(c$, "getCIPChirality", 
function(doCalculate){
var flags = (this.formalChargeAndFlags & 496) >> 4;
if (flags == 0 && this.atomNumberFlags > 1 && doCalculate) {
flags = this.group.chain.model.ms.getAtomCIPChiralityCode(this);
this.formalChargeAndFlags |= ((flags == 0 ? 3 : flags) << 4);
}return JV.JC.getCIPChiralityName(flags);
}, "~B");
Clazz_defineMethod(c$, "getCIPChiralityRule", 
function(){
var rs = this.getCIPChirality(true);
var flags = (rs.length == 0 ? -1 : (this.formalChargeAndFlags & 3584) >> 9);
return JV.JC.getCIPRuleName(flags + 1);
});
Clazz_overrideMethod(c$, "setCIPChirality", 
function(c){
this.formalChargeAndFlags = (this.formalChargeAndFlags & -4081) | (c << 4);
}, "~N");
Clazz_overrideMethod(c$, "getCIPChiralityCode", 
function(){
return (this.formalChargeAndFlags & 496) >> 4;
});
Clazz_overrideMethod(c$, "getInsertionCode", 
function(){
return this.group.getInsertionCode();
});
Clazz_defineMethod(c$, "atomPropertyTuple", 
function(vwr, tok, ptTemp){
switch (tok) {
case 1073742329:
return JU.P3.newP(this);
case 1145047050:
return this.getFractionalCoordPt(!vwr.g.legacyJavaFloat, false, ptTemp);
case 1145047053:
return this.getFractionalCoordPt(!vwr.g.legacyJavaFloat, false, ptTemp);
case 1145045006:
return (this.group.chain.model.isJmolDataFrame ? this.getFractionalCoordPt(!vwr.g.legacyJavaFloat, false, ptTemp) : this.getFractionalUnitCoordPt(!vwr.g.legacyJavaFloat, false, ptTemp));
case 1145047052:
return JU.P3.new3(Math.round(vwr.antialiased ? Clazz_doubleToInt(this.sX / 2) : this.sX), Math.round(vwr.getScreenHeight() - (vwr.antialiased ? Clazz_doubleToInt(this.sY / 2) : this.sY)), Math.round(vwr.antialiased ? Clazz_doubleToInt(this.sZ / 2) : this.sZ));
case 1145047055:
return this.getVibrationVector();
case 1145045008:
var ms = this.getModulation();
return (ms == null ? null : ms.getV3());
case 1145047049:
return this;
case 1765808134:
return JU.CU.colorPtFromInt(this.group.chain.model.ms.vwr.gdata.getColorArgbOrGray(this.colixAtom), ptTemp);
}
return null;
}, "JV.Viewer,~N,JU.P3");
Clazz_overrideMethod(c$, "getOffsetResidueAtom", 
function(name, offset){
return this.group.getAtomIndex(name, offset);
}, "~S,~N");
Clazz_overrideMethod(c$, "isCrossLinked", 
function(node){
return this.group.isCrossLinked((node).group);
}, "JU.Node");
Clazz_overrideMethod(c$, "getCrossLinkVector", 
function(vReturn, crosslinkCovalent, crosslinkHBond){
return this.group.getCrossLinkVector(vReturn, crosslinkCovalent, crosslinkHBond);
}, "JU.Lst,~B,~B");
Clazz_overrideMethod(c$, "toString", 
function(){
return this.getInfo();
});
Clazz_overrideMethod(c$, "findAtomsLike", 
function(atomExpression){
return this.group.chain.model.ms.vwr.getAtomBitSet(atomExpression);
}, "~S");
Clazz_defineMethod(c$, "getUnitID", 
function(flags){
var m = this.group.chain.model;
return (m.isBioModel ? (m).getUnitID(this, flags) : "");
}, "~N");
Clazz_overrideMethod(c$, "getFloatProperty", 
function(property){
var data = this.group.chain.model.ms.vwr.getDataObj(property, null, 1);
var f = NaN;
if (data != null) {
try {
f = (data)[this.i];
} catch (e) {
if (Clazz_exceptionOf(e, Exception)){
} else {
throw e;
}
}
}return f;
}, "~S");
Clazz_overrideMethod(c$, "modelIsRawPDB", 
function(){
var m = this.group.chain.model;
return (m.isBioModel && !m.isPdbWithMultipleBonds && m.hydrogenCount == 0);
});
Clazz_defineMethod(c$, "setSymop", 
function(isym, andClear){
if (this.atomSymmetry == null) this.atomSymmetry =  new JU.BS();
if (andClear) this.atomSymmetry.clearAll();
if (isym > 0) this.atomSymmetry.set(isym - 1);
}, "~N,~B");
Clazz_overrideMethod(c$, "getExplicitHydrogenCount", 
function(){
return 0;
});
});
;//5.0.1-v7 Mon Aug 24 10:01:38 CDT 2026
Clazz_declarePackage("JM");
Clazz_load(["JU.V3"], "JM.AtomCollection", ["java.util.ArrayList", "$.Arrays", "$.Hashtable", "JU.A4", "$.AU", "$.BS", "$.Lst", "$.M3", "$.Measure", "$.P3", "$.PT", "$.SB", "J.api.Interface", "J.atomdata.RadiusData", "J.c.PAL", "$.VDW", "JM.Group", "JS.T", "JU.BSUtil", "$.Elements", "$.Logger", "$.Parser", "$.Vibration"], function(){
var c$ = Clazz_decorateAsClass(function(){
this.vwr = null;
this.g3d = null;
this.bioModelset = null;
this.at = null;
this.ac = 0;
this.trajectory = null;
this.pointGroup = null;
this.labeler = null;
this.maxBondingRadius = 1.4E-45;
this.maxVanderwaalsRadius = 1.4E-45;
this.hasBfactorRange = false;
this.bfactor100Lo = 0;
this.bfactor100Hi = 0;
this.haveBSVisible = false;
this.haveBSClickable = false;
this.bsSurface = null;
this.nSurfaceAtoms = 0;
this.surfaceDistanceMax = 0;
this.haveChirality = false;
this.bspf = null;
this.preserveState = true;
this.canSkipLoad = true;
this.haveStraightness = false;
this.bsHidden = null;
this.bsVisible = null;
this.bsClickable = null;
this.bsModulated = null;
this.atomTensorList = null;
this.atomTensors = null;
this.surfaceDistance100s = null;
this.tainted = null;
this.atomNames = null;
this.atomTypes = null;
this.atomSerials = null;
this.atomResnos = null;
this.atomSeqIDs = null;
this.dssrData = null;
this.vibrations = null;
this.vib = null;
this.occupancies = null;
this.bfactor100s = null;
this.partialCharges = null;
this.bondingRadii = null;
this.hydrophobicities = null;
this.bsPartialCharges = null;
this.aaRet = null;
if (!Clazz_isClassDefined("JM.AtomCollection.AtomSorter")) {
JM.AtomCollection.$AtomCollection$AtomSorter$ ();
}
this.atomCapacity = 0;
Clazz_instantialize(this, arguments);}, JM, "AtomCollection", null);
Clazz_defineMethod(c$, "getAtom", 
function(iatom){
return (iatom >= 0 && iatom < this.at.length ? this.at[iatom] : null);
}, "~N");
Clazz_defineMethod(c$, "setupAC", 
function(){
this.bsHidden =  new JU.BS();
this.bsVisible =  new JU.BS();
this.bsClickable =  new JU.BS();
if (JM.AtomCollection.userSettableValues == null) JM.AtomCollection.userSettableValues = ("atomName atomType coord element formalCharge hydrophobicity ionic occupancy partialCharge temperature valence vanderWaals vibrationVector atomNo seqID resNo chain site").$plit(" ");
});
Clazz_defineMethod(c$, "releaseModelSetAC", 
function(){
this.ac = 0;
this.at = null;
this.vwr = null;
this.g3d = null;
this.bspf = null;
this.surfaceDistance100s = null;
this.bsSurface = null;
this.tainted = null;
this.atomNames = null;
this.atomTypes = null;
this.atomResnos = null;
this.dssrData = null;
this.atomSerials = null;
this.atomSeqIDs = null;
this.vibrations = null;
this.occupancies = null;
this.bfactor100s = null;
this.resetPartialCharges();
this.bondingRadii = null;
this.atomTensors = null;
});
Clazz_defineMethod(c$, "mergeAtomArrays", 
function(mergeModelSet){
this.tainted = mergeModelSet.tainted;
this.atomNames = mergeModelSet.atomNames;
this.atomTypes = mergeModelSet.atomTypes;
this.atomResnos = mergeModelSet.atomResnos;
this.atomSerials = mergeModelSet.atomSerials;
this.atomSeqIDs = mergeModelSet.atomSeqIDs;
this.vibrations = mergeModelSet.vibrations;
this.occupancies = mergeModelSet.occupancies;
this.bfactor100s = mergeModelSet.bfactor100s;
this.bondingRadii = mergeModelSet.bondingRadii;
this.partialCharges = mergeModelSet.partialCharges;
this.bsPartialCharges = mergeModelSet.bsPartialCharges;
this.atomTensors = mergeModelSet.atomTensors;
this.atomTensorList = mergeModelSet.atomTensorList;
this.bsModulated = mergeModelSet.bsModulated;
this.haveStraightness = false;
this.surfaceDistance100s = null;
}, "JM.AtomCollection");
Clazz_defineMethod(c$, "getAtomPointVector", 
function(bs){
var v =  new JU.Lst();
var n = this.ac;
if (bs != null) {
for (var i = bs.nextSetBit(0); i >= 0 && i < n; i = bs.nextSetBit(i + 1)) {
v.addLast(this.at[i]);
}
}return v;
}, "JU.BS");
Clazz_defineMethod(c$, "modelSetHasVibrationVectors", 
function(){
return (this.vibrations != null);
});
Clazz_defineMethod(c$, "getAtomTypes", 
function(){
return this.atomTypes;
});
Clazz_defineMethod(c$, "getPartialCharges", 
function(){
return this.partialCharges;
});
Clazz_defineMethod(c$, "getBondingRadii", 
function(){
return this.bondingRadii;
});
Clazz_defineMethod(c$, "getBFactors", 
function(){
return this.bfactor100s;
});
Clazz_defineMethod(c$, "getHydrophobicity", 
function(){
return this.hydrophobicities;
});
Clazz_defineMethod(c$, "setBsHidden", 
function(bs){
this.bsHidden = bs;
}, "JU.BS");
Clazz_defineMethod(c$, "isAtomHidden", 
function(iAtom){
return this.bsHidden.get(iAtom);
}, "~N");
Clazz_defineMethod(c$, "getLabeler", 
function(){
return (this.labeler == null ? this.labeler = J.api.Interface.getInterface("JM.LabelToken", this.vwr, "ms") : this.labeler);
});
Clazz_defineMethod(c$, "getAtomInfo", 
function(i, format, ptTemp){
return (format == null ? this.at[i].getInfo() : this.getLabeler().formatLabel(this.vwr, this.at[i], format, ptTemp));
}, "~N,~S,JU.P3");
Clazz_defineMethod(c$, "getElementName", 
function(i){
return JU.Elements.elementNameFromNumber(this.at[i].getAtomicAndIsotopeNumber());
}, "~N");
Clazz_defineMethod(c$, "getQuaternion", 
function(i, qtype){
return (i < 0 ? null : this.at[i].group.getQuaternion(qtype));
}, "~N,~S");
Clazz_defineMethod(c$, "getFirstAtomIndexFromAtomNumber", 
function(atomNumber, bsVisibleFrames){
for (var i = 0; i < this.ac; i++) {
var atom = this.at[i];
if (!JM.AtomCollection.isDeleted(atom) && atom.getAtomNumber() == atomNumber && bsVisibleFrames.get(atom.mi)) return i;
}
return -1;
}, "~N,JU.BS");
Clazz_defineMethod(c$, "setFormalCharges", 
function(bs, formalCharge){
if (bs != null) {
this.resetPartialCharges();
for (var i = bs.nextSetBit(0); i >= 0; i = bs.nextSetBit(i + 1)) {
this.at[i].setFormalCharge(formalCharge);
this.taintAtom(i, 4);
}
}}, "JU.BS,~N");
Clazz_defineMethod(c$, "getAtomicCharges", 
function(){
var charges =  Clazz_newFloatArray (this.ac, 0);
for (var i = this.ac; --i >= 0; ) charges[i] = (JM.AtomCollection.isDeleted(this.at[i]) ? 0 : this.at[i].getElementNumber());

return charges;
});
Clazz_defineMethod(c$, "getRadiusVdwJmol", 
function(atom){
return JU.Elements.getVanderwaalsMar(atom.getElementNumber(), J.c.VDW.JMOL) / 1000;
}, "JM.Atom");
Clazz_defineMethod(c$, "getMaxVanderwaalsRadius", 
function(){
if (this.maxVanderwaalsRadius == 1.4E-45) this.findMaxRadii();
return this.maxVanderwaalsRadius;
});
Clazz_defineMethod(c$, "findMaxRadii", 
function(){
var r;
for (var i = this.ac; --i >= 0; ) {
var atom = this.at[i];
if (JM.AtomCollection.isDeleted(atom)) continue;
if ((r = atom.getBondingRadius()) > this.maxBondingRadius) this.maxBondingRadius = r;
if ((r = atom.getVanderwaalsRadiusFloat(this.vwr, J.c.VDW.AUTO)) > this.maxVanderwaalsRadius) this.maxVanderwaalsRadius = r;
}
});
Clazz_defineMethod(c$, "clearBfactorRange", 
function(){
this.hasBfactorRange = false;
});
Clazz_defineMethod(c$, "calcBfactorRange", 
function(bs){
if (this.hasBfactorRange) return;
this.bfactor100Lo = 2147483647;
this.bfactor100Hi = -2147483648;
if (bs == null) {
for (var i = 0; i < this.ac; i++) this.setBf(i);

} else {
for (var i = bs.nextSetBit(0); i >= 0; i = bs.nextSetBit(i + 1)) this.setBf(i);

}this.hasBfactorRange = true;
}, "JU.BS");
Clazz_defineMethod(c$, "setBf", 
function(i){
if (JM.AtomCollection.isDeleted(this.at[i])) return;
var bf = this.at[i].getBfactor100();
if (bf < this.bfactor100Lo) this.bfactor100Lo = bf;
 else if (bf > this.bfactor100Hi) this.bfactor100Hi = bf;
}, "~N");
Clazz_defineMethod(c$, "getBfactor100Lo", 
function(){
if (!this.hasBfactorRange) {
if (this.vwr.g.rangeSelected) {
this.calcBfactorRange(this.vwr.bsA());
} else {
this.calcBfactorRange(null);
}}return this.bfactor100Lo;
});
Clazz_defineMethod(c$, "getBfactor100Hi", 
function(){
this.getBfactor100Lo();
return this.bfactor100Hi;
});
Clazz_defineMethod(c$, "getSurfaceDistanceMax", 
function(){
if (this.surfaceDistance100s == null) this.calcSurfaceDistances();
return this.surfaceDistanceMax;
});
Clazz_defineMethod(c$, "calculateVolume", 
function(bs, vType){
var volume = 0;
if (bs != null) for (var i = bs.nextSetBit(0); i >= 0; i = bs.nextSetBit(i + 1)) volume += this.at[i].getVolume(this.vwr, vType);

return volume;
}, "JU.BS,J.c.VDW");
Clazz_defineMethod(c$, "getSurfaceDistance100", 
function(atomIndex){
if (this.nSurfaceAtoms == 0) return -1;
if (this.surfaceDistance100s == null) this.calcSurfaceDistances();
return this.surfaceDistance100s[atomIndex];
}, "~N");
Clazz_defineMethod(c$, "calcSurfaceDistances", 
function(){
this.calculateSurface(null, -1);
});
Clazz_defineMethod(c$, "calculateSurface", 
function(bsSelected, envelopeRadius){
if (envelopeRadius < 0) envelopeRadius = 3.0;
var ec = (J.api.Interface.getOption("geodesic.EnvelopeCalculation", this.vwr, "ms")).set(this.vwr, this.ac, null);
ec.calculate( new J.atomdata.RadiusData(null, envelopeRadius, J.atomdata.RadiusData.EnumType.ABSOLUTE, null), 3.4028235E38, bsSelected, JU.BSUtil.copyInvert(bsSelected, this.ac), false, false, false, true);
var points = ec.getPoints();
this.surfaceDistanceMax = 0;
this.bsSurface = ec.getBsSurfaceClone();
this.surfaceDistance100s =  Clazz_newIntArray (this.ac, 0);
this.nSurfaceAtoms = JU.BSUtil.cardinalityOf(this.bsSurface);
if (this.nSurfaceAtoms == 0 || points == null || points.length == 0) return points;
var radiusAdjust = (envelopeRadius == 3.4028235E38 ? 0 : envelopeRadius);
for (var i = 0; i < this.ac; i++) {
if (this.bsSurface.get(i) || JM.AtomCollection.isDeleted(this.at[i])) {
this.surfaceDistance100s[i] = 0;
} else {
var dMin = 3.4028235E38;
var atom = this.at[i];
for (var j = points.length; --j >= 0; ) {
dMin = Math.min(Math.abs(points[j].distance(atom) - radiusAdjust), dMin);
}
var d = this.surfaceDistance100s[i] = Clazz_doubleToInt(Math.floor(dMin * 100));
this.surfaceDistanceMax = Math.max(this.surfaceDistanceMax, d);
}}
return points;
}, "JU.BS,~N");
Clazz_defineMethod(c$, "setAtomCoord2", 
function(bs, tokType, xyzValues){
var xyz = null;
var values = null;
var v = null;
var type = 0;
var nValues = 1;
if (Clazz_instanceOf(xyzValues,"JU.P3")) {
xyz = xyzValues;
} else if (Clazz_instanceOf(xyzValues,"JU.Lst")) {
v = xyzValues;
if ((nValues = v.size()) == 0) return;
type = 1;
} else if (JU.AU.isAP(xyzValues)) {
values = xyzValues;
if ((nValues = values.length) == 0) return;
type = 2;
} else {
return;
}var n = 0;
if (bs != null) for (var i = bs.nextSetBit(0); i >= 0; i = bs.nextSetBit(i + 1)) {
switch (type) {
case 1:
if (n >= nValues) return;
xyz = v.get(n++);
break;
case 2:
if (n >= nValues) return;
xyz = values[n++];
break;
}
if (xyz != null) switch (tokType) {
case 1145047049:
this.setAtomCoord(i, xyz.x, xyz.y, xyz.z);
break;
case 1145047050:
case 1145047053:
this.at[i].setFractionalCoordTo(xyz, false);
this.taintAtom(i, 2);
break;
case 1145047055:
this.setAtomVibrationVector(i, xyz);
break;
}
}
}, "JU.BS,~N,~O");
Clazz_defineMethod(c$, "setAtomVibrationVector", 
function(atomIndex, vib){
this.taintAtom(atomIndex, 12);
return this.setVibrationVector(atomIndex, vib);
}, "~N,JU.T3");
Clazz_defineMethod(c$, "setAtomCoord", 
function(atomIndex, x, y, z){
if (atomIndex < 0 || atomIndex >= this.ac) return;
var a = this.at[atomIndex];
a.set(x, y, z);
this.fixTrajectory(a);
this.taintAtom(atomIndex, 2);
}, "~N,~N,~N,~N");
Clazz_defineMethod(c$, "fixTrajectory", 
function(a){
if ((this).isTrajectory(a.mi)) this.trajectory.fixAtom(a);
}, "JM.Atom");
Clazz_defineMethod(c$, "setAtomCoordRelative", 
function(atomIndex, x, y, z){
if (atomIndex < 0 || atomIndex >= this.ac) return;
var a = this.at[atomIndex];
a.add3(x, y, z);
this.fixTrajectory(a);
this.taintAtom(atomIndex, 2);
}, "~N,~N,~N,~N");
Clazz_defineMethod(c$, "setAtomsCoordRelative", 
function(bs, x, y, z){
if (bs != null) for (var i = bs.nextSetBit(0); i >= 0; i = bs.nextSetBit(i + 1)) this.setAtomCoordRelative(i, x, y, z);

}, "JU.BS,~N,~N,~N");
Clazz_defineMethod(c$, "setAPa", 
function(bs, tok, iValue, fValue, sValue, values, list){
var n = 0;
if (values != null && values.length == 0 || bs == null) return;
var isAll = (values != null && values.length == this.ac || list != null && list.length == this.ac);
for (var i = bs.nextSetBit(0); i >= 0; i = bs.nextSetBit(i + 1)) {
if (isAll) n = i;
if (values != null) {
if (n >= values.length) return;
fValue = values[n++];
if (Float.isNaN(fValue)) continue;
iValue = Clazz_floatToInt(fValue);
} else if (list != null) {
if (n >= list.length) return;
sValue = list[n++];
}var atom = this.at[i];
var f;
switch (tok) {
case 1086326786:
this.setAtomName(i, sValue, true);
break;
case 1086326785:
this.setAtomType(i, sValue);
break;
case 1086326788:
this.setChainID(i, sValue);
break;
case 1094715393:
this.setAtomNumber(i, iValue, true);
break;
case 1094713368:
this.setAtomSeqID(i, iValue);
break;
case 1111492609:
case 1111492629:
this.setAtomCoord(i, fValue, atom.y, atom.z);
break;
case 1111492610:
case 1111492630:
this.setAtomCoord(i, atom.x, fValue, atom.z);
break;
case 1111492611:
case 1111492631:
this.setAtomCoord(i, atom.x, atom.y, fValue);
break;
case 1111492626:
case 1111492627:
case 1111492628:
this.setVibrationVector2(i, tok, fValue);
break;
case 1111492612:
case 1111492613:
case 1111492614:
case 1111492615:
case 1111492616:
case 1111492617:
atom.setFractionalCoord(tok, fValue, false);
this.taintAtom(i, 2);
break;
case 1094715402:
case 1086326789:
this.setElement(atom, iValue, true);
break;
case 1631586315:
this.resetPartialCharges();
atom.setFormalCharge(iValue);
this.taintAtom(i, 4);
break;
case 1113589786:
this.setHydrophobicity(i, fValue);
break;
case 1128269825:
f = (fValue < 2 && fValue >= 0.01 ? 100 * fValue : fValue);
this.setOccupancy(i, f, true);
break;
case 1111492619:
this.setPartialCharge(i, fValue, true);
break;
case 1111492618:
this.setBondingRadius(i, fValue);
break;
case 1111492620:
this.setBFactor(i, fValue, true);
break;
case 1094715412:
this.setAtomResno(i, iValue);
break;
case 1825200146:
case 1287653388:
this.vwr.shm.setAtomLabel(sValue, i);
break;
case 1665140738:
case 1112152075:
f = fValue;
if (f < 0) f = 0;
 else if (f > 16) f = 16.1;
atom.madAtom = (Clazz_floatToShort(f * 2000));
break;
case 1113589787:
this.vwr.slm.setSelectedAtom(atom.i, (fValue != 0));
break;
case 1094715420:
atom.setValence(iValue);
this.taintAtom(i, 10);
break;
case 1648363544:
if (atom.setRadius(fValue)) this.taintAtom(i, 11);
 else this.untaint(i, 11);
break;
default:
JU.Logger.error("unsettable atom property: " + JS.T.nameOf(tok));
return;
}
}
switch (tok) {
case 1113589787:
this.vwr.slm.setSelectedAtom(-1, false);
break;
case 1665140738:
case 1112152075:
this.vwr.setShapeSize(0, 2147483647, bs);
}
}, "JU.BS,~N,~N,~N,~S,~A,~A");
Clazz_defineMethod(c$, "getVibCoord", 
function(atomIndex, c){
var ms = null;
var v = null;
switch ((c).charCodeAt(0)) {
case 120:
case 121:
case 122:
v = this.getVibration(atomIndex, false);
break;
default:
ms = this.getModulation(atomIndex);
if (ms != null) {
v = ms.getVibration(false);
if (v == null) v = ms;
}}
if (v == null && ms == null) return NaN;
switch ((c).charCodeAt(0)) {
case 120:
case 88:
return v.x;
case 121:
case 89:
return v.y;
case 122:
case 90:
return v.z;
case 79:
return (ms.getModulation('O', null, true)).floatValue();
case 49:
case 50:
case 51:
var t = ms.getModulation('T', null, true);
var x = (c == '1' ? t.x : c == '2' ? t.y : t.z);
return (x - Math.floor(x));
default:
return NaN;
}
}, "~N,~S");
Clazz_defineMethod(c$, "getVibration", 
function(atomIndex, forceNew){
var v = (this.vibrations == null ? null : this.vibrations[atomIndex]);
return (Clazz_instanceOf(v,"J.api.JmolModulationSet") ? (v).getVibration(forceNew) : v == null && forceNew ?  new JU.Vibration() : v);
}, "~N,~B");
Clazz_defineMethod(c$, "getModulation", 
function(iAtom){
var v = (this.vibrations == null ? null : this.vibrations[iAtom]);
return (v != null && v.modDim > 0 ? v : null);
}, "~N");
Clazz_defineMethod(c$, "setVibrationVector", 
function(atomIndex, vib){
if (vib == null) {
if (this.vibrations != null && this.vibrations.length > atomIndex) this.vibrations[atomIndex] = null;
return null;
}if (Double.isNaN(vib.x) || Double.isNaN(vib.y) || Double.isNaN(vib.z)) return null;
if (atomIndex >= this.at.length) return null;
if (this.vibrations == null) {
this.vibrations =  new Array(this.at.length);
} else if (this.vibrations.length <= atomIndex) {
this.vibrations = JU.AU.arrayCopyObject(this.vibrations, this.at.length);
}if (Clazz_instanceOf(vib,"JU.Vibration")) {
if (this.vibrations[atomIndex] == null) {
this.vibrations[atomIndex] = this.vib = vib;
} else {
this.vib = this.vibrations[atomIndex];
this.vib.setXYZ(vib);
}} else {
if (this.vibrations[atomIndex] == null) this.vibrations[atomIndex] =  new JU.Vibration();
this.vibrations[atomIndex].setXYZ(vib);
}this.at[atomIndex].setVibrationVector();
return this.vibrations[atomIndex];
}, "~N,JU.T3");
Clazz_defineMethod(c$, "setVibrationVector2", 
function(atomIndex, tok, fValue){
var v = this.getVibration(atomIndex, true);
if (v == null) return;
switch (tok) {
case 1111492626:
v.x = fValue;
break;
case 1111492627:
v.y = fValue;
break;
case 1111492628:
v.z = fValue;
break;
}
this.setAtomVibrationVector(atomIndex, v);
}, "~N,~N,~N");
Clazz_defineMethod(c$, "setAtomName", 
function(atomIndex, name, doTaint){
if (doTaint && name.equals(this.at[atomIndex].getAtomName())) return;
var id = ((this).am[this.at[atomIndex].mi].isBioModel ? this.vwr.getJBR().lookupSpecialAtomID(name) : 0);
this.at[atomIndex].atomID = id;
if (id <= 0) {
if (this.atomNames == null) this.atomNames =  new Array(this.at.length);
this.atomNames[atomIndex] = name;
}if (doTaint) this.taintAtom(atomIndex, 0);
}, "~N,~S,~B");
Clazz_defineMethod(c$, "setAtomType", 
function(atomIndex, type){
if (type.equals(this.at[atomIndex].getAtomType())) return;
if (this.atomTypes == null) this.atomTypes =  new Array(this.at.length);
this.atomTypes[atomIndex] = type;
return;
}, "~N,~S");
Clazz_defineMethod(c$, "setChainID", 
function(atomIndex, id){
if (id.equals(this.at[atomIndex].getChainIDStr())) return;
var intid = this.at[atomIndex].getChainID();
var bs = this.getChainBits(intid);
var c = this.at[atomIndex].group.chain;
c.chainID = this.vwr.getChainID(id, true);
for (var i = bs.nextSetBit(0); i >= 0; i = bs.nextSetBit(i + 1)) this.taintAtom(i, 16);

}, "~N,~S");
Clazz_defineMethod(c$, "setAtomNumber", 
function(atomIndex, atomno, doTaint){
if (doTaint && atomno == this.at[atomIndex].getAtomNumber()) return;
if (this.atomSerials == null) this.atomSerials =  Clazz_newIntArray (this.at.length, 0);
this.atomSerials[atomIndex] = atomno;
if (doTaint) this.taintAtom(atomIndex, 13);
}, "~N,~N,~B");
Clazz_defineMethod(c$, "setElement", 
function(atom, atomicNumber, doTaint){
if (doTaint && atom.getElementNumber() == atomicNumber) return;
atom.setAtomicAndIsotopeNumber(atomicNumber);
atom.paletteID = J.c.PAL.CPK.id;
atom.colixAtom = this.vwr.cm.getColixAtomPalette(atom, J.c.PAL.CPK.id);
this.resetPartialCharges();
if (doTaint) this.taintAtom(atom.i, 3);
}, "JM.Atom,~N,~B");
Clazz_defineMethod(c$, "setSite", 
function(atom, site, doTaint){
if (atom.atomSite == site) return;
atom.atomSite = site;
if (doTaint) this.taintAtom(atom.i, 17);
}, "JM.Atom,~N,~B");
Clazz_defineMethod(c$, "resetPartialCharges", 
function(){
this.partialCharges = null;
this.bsPartialCharges = null;
});
Clazz_defineMethod(c$, "setAtomResno", 
function(atomIndex, resno){
if (resno == this.at[atomIndex].getResno()) return;
this.at[atomIndex].group.setResno(resno);
if (this.atomResnos == null) this.atomResnos =  Clazz_newIntArray (this.at.length, 0);
this.atomResnos[atomIndex] = resno;
this.taintAtom(atomIndex, 15);
}, "~N,~N");
Clazz_defineMethod(c$, "setAtomSeqID", 
function(atomIndex, seqID){
if (seqID == this.at[atomIndex].getSeqID()) return;
if (this.atomSeqIDs == null) this.atomSeqIDs =  Clazz_newIntArray (this.at.length, 0);
this.atomSeqIDs[atomIndex] = seqID;
this.taintAtom(atomIndex, 14);
}, "~N,~N");
Clazz_defineMethod(c$, "setOccupancy", 
function(atomIndex, occupancy, doTaint){
if (doTaint && occupancy == this.at[atomIndex].getOccupancy100()) return;
if (this.occupancies == null) {
if (occupancy == 100) return;
this.occupancies =  Clazz_newFloatArray (this.at.length, 0);
for (var i = this.at.length; --i >= 0; ) this.occupancies[i] = 100;

}this.occupancies[atomIndex] = occupancy;
if (doTaint) this.taintAtom(atomIndex, 7);
}, "~N,~N,~B");
Clazz_defineMethod(c$, "getOccupancyFloat", 
function(i){
return (this.occupancies == null || i >= this.occupancies.length ? 100 : this.occupancies[i]);
}, "~N");
Clazz_defineMethod(c$, "setPartialCharge", 
function(atomIndex, partialCharge, doTaint){
if (Float.isNaN(partialCharge)) return;
if (this.partialCharges == null) {
this.bsPartialCharges =  new JU.BS();
if (partialCharge == 0) return;
this.partialCharges =  Clazz_newFloatArray (this.at.length, 0);
}this.bsPartialCharges.set(atomIndex);
this.partialCharges[atomIndex] = partialCharge;
if (doTaint) this.taintAtom(atomIndex, 8);
}, "~N,~N,~B");
Clazz_defineMethod(c$, "setBondingRadius", 
function(atomIndex, radius){
if (Float.isNaN(radius) || radius == this.at[atomIndex].getBondingRadius()) return;
if (this.bondingRadii == null) {
this.bondingRadii =  Clazz_newFloatArray (this.at.length, 0);
} else if (this.bondingRadii.length < this.at.length) {
this.bondingRadii = JU.AU.ensureLengthA(this.bondingRadii, this.at.length);
}this.bondingRadii[atomIndex] = radius;
this.taintAtom(atomIndex, 6);
}, "~N,~N");
Clazz_defineMethod(c$, "setBFactor", 
function(atomIndex, bfactor, doTaint){
if (Float.isNaN(bfactor) || doTaint && bfactor == this.at[atomIndex].getBfactor100()) return;
if (this.bfactor100s == null) {
if (bfactor == 0) return;
this.bfactor100s =  Clazz_newShortArray (this.at.length, 0);
}this.bfactor100s[atomIndex] = Clazz_doubleToShort((bfactor < -327.68 ? -327.68 : bfactor > 327.67 ? 327.67 : bfactor) * 100 + (bfactor < 0 ? -0.5 : 0.5));
if (doTaint) this.taintAtom(atomIndex, 9);
}, "~N,~N,~B");
Clazz_defineMethod(c$, "setHydrophobicity", 
function(atomIndex, value){
if (Float.isNaN(value) || value == this.at[atomIndex].getHydrophobicity()) return;
if (this.hydrophobicities == null) {
this.hydrophobicities =  Clazz_newFloatArray (this.at.length, 0);
for (var i = 0; i < this.at.length; i++) this.hydrophobicities[i] = JU.Elements.getHydrophobicity(this.at[i].group.groupID);

}this.hydrophobicities[atomIndex] = value;
this.taintAtom(atomIndex, 5);
}, "~N,~N");
Clazz_defineMethod(c$, "setAtomData", 
function(type, name, dataString, isDefault){
var fData = null;
var bs = null;
switch (type) {
case 2:
this.loadCoordinates(dataString, 1073742329, !isDefault);
return;
case 12:
this.loadCoordinates(dataString, 4166, true);
return;
case 18:
fData =  Clazz_newFloatArray (this.ac, 0);
bs = JU.BS.newN(this.ac);
break;
}
var lines = JU.Parser.markLines(dataString, ';');
var n = 0;
try {
var nData = JU.PT.parseInt(dataString.substring(0, lines[0] - 1));
for (var i = 1; i <= nData; i++) {
var tokens = JU.PT.getTokens(JU.PT.parseTrimmed(dataString.substring(lines[i], lines[i + 1] - 1)));
var atomIndex = JU.PT.parseInt(tokens[0]) - 1;
if (atomIndex < 0 || atomIndex >= this.ac) continue;
var atom = this.at[atomIndex];
n++;
var pt = tokens.length - 1;
var x = JU.PT.parseFloat(tokens[pt]);
switch (type) {
case 18:
fData[atomIndex] = x;
bs.set(atomIndex);
continue;
case 0:
this.setAtomName(atomIndex, tokens[pt], true);
break;
case 13:
this.setAtomNumber(atomIndex, Clazz_floatToInt(x), true);
break;
case 15:
this.setAtomResno(atomIndex, Clazz_floatToInt(x));
break;
case 14:
this.setAtomSeqID(atomIndex, Clazz_floatToInt(x));
break;
case 1:
this.setAtomType(atomIndex, tokens[pt]);
break;
case 16:
this.setChainID(atomIndex, tokens[pt]);
break;
case 17:
atom.atomSite = Clazz_floatToInt(x);
break;
case 3:
atom.setAtomicAndIsotopeNumber(Clazz_floatToInt(x));
atom.paletteID = J.c.PAL.CPK.id;
atom.colixAtom = this.vwr.cm.getColixAtomPalette(atom, J.c.PAL.CPK.id);
break;
case 4:
atom.setFormalCharge(Clazz_floatToInt(x));
break;
case 5:
this.setHydrophobicity(atomIndex, x);
break;
case 6:
this.setBondingRadius(atomIndex, x);
break;
case 8:
this.setPartialCharge(atomIndex, x, true);
break;
case 9:
this.setBFactor(atomIndex, x, true);
break;
case 10:
atom.setValence(Clazz_floatToInt(x));
break;
case 11:
atom.setRadius(x);
break;
}
this.taintAtom(atomIndex, type);
}
if (type == 18 && n > 0) this.vwr.setData(name,  Clazz_newArray(-1, [name, fData, bs, Integer.$valueOf(1)]), 0, 0, 0, 0, 0);
} catch (e) {
if (Clazz_exceptionOf(e, Exception)){
JU.Logger.error("loadData error: " + e);
} else {
throw e;
}
}
}, "~N,~S,~S,~B");
Clazz_defineMethod(c$, "loadCoordinates", 
function(data, type, doTaint){
var lines = JU.Parser.markLines(data, ';');
var v = (type == 4166 || type == 1095241729 ?  new JU.V3() : null);
try {
var nData = JU.PT.parseInt(data.substring(0, lines[0] - 1));
for (var i = 1; i <= nData; i++) {
var tokens = JU.PT.getTokens(JU.PT.parseTrimmed(data.substring(lines[i], lines[i + 1])));
var atomIndex = JU.PT.parseInt(tokens[0]) - 1;
var x = (tokens[3].equalsIgnoreCase("1.4E-45") ? 1.4e-45 : JU.PT.parseFloat(tokens[3]));
var y = (tokens[4].equalsIgnoreCase("1.4E-45") ? 1.4e-45 : JU.PT.parseFloat(tokens[4]));
var z = JU.PT.parseFloat(tokens[5]);
switch (type) {
case 4166:
v.set(x, y, z);
var vib = this.setAtomVibrationVector(atomIndex, v);
if (vib != null && tokens.length > 7) {
vib.modDim = JU.PT.parseInt(tokens[6]);
vib.magMoment = JU.PT.parseFloat(tokens[7]);
}break;
default:
this.setAtomCoord(atomIndex, x, y, z);
if (!doTaint) this.untaint(atomIndex, 2);
break;
}
}
} catch (e) {
if (Clazz_exceptionOf(e, Exception)){
JU.Logger.error("Frame.loadCoordinate error: " + e);
} else {
throw e;
}
}
}, "~S,~N,~B");
Clazz_defineMethod(c$, "validateBspf", 
function(isValid){
if (this.bspf != null) this.bspf.isValid = isValid;
}, "~B");
Clazz_defineMethod(c$, "validateBspfForModel", 
function(modelIndex, isValid){
if (this.bspf != null) this.bspf.validateModel(modelIndex, isValid);
}, "~N,~B");
Clazz_defineMethod(c$, "setPreserveState", 
function(TF){
this.preserveState = TF;
}, "~B");
c$.getUserSettableType = Clazz_defineMethod(c$, "getUserSettableType", 
function(dataType){
var isExplicit = (dataType.indexOf("property_") == 0);
var check = (isExplicit ? dataType.substring(9) : dataType);
for (var i = 0; i < 18; i++) if (JM.AtomCollection.userSettableValues[i].equalsIgnoreCase(check)) return i;

return (isExplicit ? 18 : -1);
}, "~S");
Clazz_defineMethod(c$, "getTaintedAtoms", 
function(type){
return this.tainted == null ? null : this.tainted[type];
}, "~N");
Clazz_defineMethod(c$, "taintAtoms", 
function(bsAtoms, type){
this.canSkipLoad = false;
if (!this.preserveState) return;
for (var i = bsAtoms.nextSetBit(0); i >= 0; i = bsAtoms.nextSetBit(i + 1)) this.taintAtom(i, type);

}, "JU.BS,~N");
Clazz_defineMethod(c$, "taintAtom", 
function(atomIndex, type){
if (this.preserveState) {
if (this.tainted == null) this.tainted =  new Array(18);
if (this.tainted[type] == null) this.tainted[type] = JU.BS.newN(this.ac);
this.tainted[type].set(atomIndex);
}if (type == 2) this.taintModelCoord(atomIndex);
}, "~N,~N");
Clazz_defineMethod(c$, "taintModelCoord", 
function(atomIndex){
var m = (this).am[this.at[atomIndex].mi];
this.validateBspfForModel(m.trajectoryBaseIndex, false);
if (m.isBioModel) m.resetDSSR(true);
this.pointGroup = null;
}, "~N");
Clazz_defineMethod(c$, "untaint", 
function(atomIndex, type){
if (!this.preserveState) return;
if (this.tainted == null || this.tainted[type] == null) return;
this.tainted[type].clear(atomIndex);
}, "~N,~N");
Clazz_defineMethod(c$, "setTaintedAtoms", 
function(bs, type){
if (this.preserveState) {
if (bs == null) {
if (this.tainted == null) return;
this.tainted[type] = null;
return;
}if (this.tainted == null) this.tainted =  new Array(18);
if (this.tainted[type] == null) this.tainted[type] = JU.BS.newN(this.ac);
JU.BSUtil.copy2(bs, this.tainted[type]);
}if (type == 2) {
var i = bs.nextSetBit(0);
if (i >= 0) this.taintModelCoord(i);
}}, "JU.BS,~N");
Clazz_defineMethod(c$, "unTaintAtoms", 
function(bs, type){
if (this.tainted == null || this.tainted[type] == null) return;
for (var i = bs.nextSetBit(0); i >= 0; i = bs.nextSetBit(i + 1)) this.tainted[type].clear(i);

if (this.tainted[type].nextSetBit(0) < 0) this.tainted[type] = null;
}, "JU.BS,~N");
Clazz_defineMethod(c$, "findNearest2", 
function(x, y, closest, bsNot, min){
var champion = null;
var contender;
for (var i = this.ac; --i >= 0; ) {
if (bsNot != null && bsNot.get(i) || (contender = this.at[i]) == null) continue;
if (contender.isClickable() && this.isCursorOnTopOf(contender, x, y, min, champion)) champion = contender;
}
closest[0] = champion;
}, "~N,~N,~A,JU.BS,~N");
Clazz_defineMethod(c$, "isCursorOnTopOf", 
function(contender, x, y, radius, champion){
return contender.sZ > 1 && !this.g3d.isClippedZ(contender.sZ) && this.g3d.isInDisplayRange(contender.sX, contender.sY) && contender.isCursorOnTopOf(x, y, radius, champion);
}, "JM.Atom,~N,~N,~N,JM.Atom");
Clazz_defineMethod(c$, "fillADa", 
function(atomData, mode){
atomData.xyz = atomData.atoms = this.at;
atomData.ac = this.ac;
atomData.atomicNumber =  Clazz_newIntArray (this.ac, 0);
var includeRadii = ((mode & 2) != 0);
if (includeRadii) atomData.atomRadius =  Clazz_newFloatArray (this.ac, 0);
var isMultiModel = ((mode & 16) != 0);
for (var i = 0; i < this.ac; i++) {
var atom = this.at[i];
if (JM.AtomCollection.isDeleted(atom) || !isMultiModel && atomData.modelIndex >= 0 && atom.mi != atomData.firstModelIndex) {
if (atomData.bsIgnored == null) atomData.bsIgnored =  new JU.BS();
atomData.bsIgnored.set(i);
continue;
}atomData.atomicNumber[i] = atom.getElementNumber();
atomData.lastModelIndex = atom.mi;
if (includeRadii) atomData.atomRadius[i] = this.getWorkingRadius(atom, atomData);
}
}, "J.atomdata.AtomData,~N");
Clazz_defineMethod(c$, "getWorkingRadius", 
function(atom, atomData){
var r = 0;
var rd = atomData.radiusData;
switch (rd.factorType) {
case J.atomdata.RadiusData.EnumType.ABSOLUTE:
r = rd.value;
break;
case J.atomdata.RadiusData.EnumType.FACTOR:
case J.atomdata.RadiusData.EnumType.OFFSET:
switch (rd.vdwType) {
case J.c.VDW.BONDING:
r = atom.getBondingRadius();
break;
case J.c.VDW.ADPMAX:
r = atom.getADPMinMax(true);
break;
case J.c.VDW.ADPMIN:
r = atom.getADPMinMax(false);
break;
default:
r = atom.getVanderwaalsRadiusFloat(this.vwr, atomData.radiusData.vdwType);
}
if (rd.factorType === J.atomdata.RadiusData.EnumType.FACTOR) r *= rd.value;
 else r += rd.value;
}
return r + rd.valueExtended;
}, "JM.Atom,J.atomdata.AtomData");
Clazz_defineMethod(c$, "calculateHydrogens", 
function(bs, nTotal, vConnect, flags){
var doAll = ((flags & 256) == 256);
var justCarbon = ((flags & 512) == 512);
var isQuick = ((flags & 8) == 8);
var ignoreH = ((flags & 2048) == 2048);
var allowH = ((flags & 4096) == 4096);
var z =  new JU.V3();
var x =  new JU.V3();
var hAtoms =  new Array(this.ac);
var bsDeleted = this.vwr.slm.bsDeleted;
var pt;
var nH = nTotal[0] = 0;
if (bs == null) {
return hAtoms;
}var sym = this.vwr.getOperativeSymmetry();
if (sym != null && this.vwr.getObjectMad10(5) == 0) sym = null;
var ptTemp = (sym == null ? null :  new JU.P3());
for (var i = bs.nextSetBit(0); i >= 0; i = bs.nextSetBit(i + 1)) {
if (bsDeleted != null && bsDeleted.get(i)) continue;
var atom = this.at[i];
var atomicNumber = atom.getElementNumber();
if (justCarbon && atomicNumber != 6) continue;
var dHX = (atomicNumber <= 6 ? 1.1 : atomicNumber <= 10 ? 1.0 : 1.3);
switch (atomicNumber) {
case 7:
case 8:
dHX = 1.0;
break;
case 6:
}
var n = (doAll || ignoreH || allowH ? atom.getCovalentHydrogenCount() : 0);
if (doAll && n > 0 || ignoreH && n == 0) continue;
var nMissing = this.getMissingHydrogenCount(atom, false);
if (doAll && nMissing == 0) continue;
if (!ignoreH) n = nMissing;
var targetValence = this.aaRet[0];
var hybridization = this.aaRet[2];
var nBonds = this.aaRet[3] - (ignoreH ? n : 0);
if (nBonds == 0 && atom.isHetero()) continue;
hAtoms[i] =  new Array(n);
var hPt = 0;
if (nBonds == 0) {
switch (n) {
case 4:
z.set(0.635, 0.635, 0.635);
pt = JU.P3.newP(z);
pt.add(atom);
hPt = JM.AtomCollection.addH(hAtoms[i], hPt, pt, atom, vConnect, sym, ptTemp);
case 3:
z.set(-0.635, -0.635, 0.635);
pt = JU.P3.newP(z);
pt.add(atom);
hPt = JM.AtomCollection.addH(hAtoms[i], hPt, pt, atom, vConnect, sym, ptTemp);
case 2:
z.set(-0.635, 0.635, -0.635);
pt = JU.P3.newP(z);
pt.add(atom);
hPt = JM.AtomCollection.addH(hAtoms[i], hPt, pt, atom, vConnect, sym, ptTemp);
case 1:
z.set(0.635, -0.635, -0.635);
pt = JU.P3.newP(z);
pt.add(atom);
hPt = JM.AtomCollection.addH(hAtoms[i], hPt, pt, atom, vConnect, sym, ptTemp);
}
} else {
switch (n) {
default:
break;
case 3:
this.getHybridizationAndAxes(i, atomicNumber, z, x, "sp3b", false, true, isQuick, null);
pt =  new JU.P3();
pt.scaleAdd2(dHX, z, atom);
hPt = JM.AtomCollection.addH(hAtoms[i], hPt, pt, atom, vConnect, sym, ptTemp);
this.getHybridizationAndAxes(i, atomicNumber, z, x, "sp3c", false, true, isQuick, null);
pt =  new JU.P3();
pt.scaleAdd2(dHX, z, atom);
hPt = JM.AtomCollection.addH(hAtoms[i], hPt, pt, atom, vConnect, sym, ptTemp);
this.getHybridizationAndAxes(i, atomicNumber, z, x, "sp3d", false, true, isQuick, null);
pt =  new JU.P3();
pt.scaleAdd2(dHX, z, atom);
hPt = JM.AtomCollection.addH(hAtoms[i], hPt, pt, atom, vConnect, sym, ptTemp);
break;
case 2:
var isEne = (hybridization == 2 || atomicNumber == 5 || nBonds == 1 && targetValence == 4 || atomicNumber == 7 && this.isAdjacentSp2(atom));
this.getHybridizationAndAxes(i, atomicNumber, z, x, (isEne ? "sp2b" : targetValence == 3 ? "sp3c" : "lpa"), false, true, isQuick, null);
pt = JU.P3.newP(z);
pt.scaleAdd2(dHX, z, atom);
hPt = JM.AtomCollection.addH(hAtoms[i], hPt, pt, atom, vConnect, sym, ptTemp);
this.getHybridizationAndAxes(i, atomicNumber, z, x, (isEne ? "sp2c" : targetValence == 3 ? "sp3d" : "lpb"), false, true, isQuick, null);
pt = JU.P3.newP(z);
pt.scaleAdd2(dHX, z, atom);
hPt = JM.AtomCollection.addH(hAtoms[i], hPt, pt, atom, vConnect, sym, ptTemp);
break;
case 1:
switch (targetValence - nBonds) {
case 1:
if (atomicNumber == 8 && atom === atom.group.getCarbonylOxygenAtom()) {
hAtoms[i] = null;
continue;
}if (this.getHybridizationAndAxes(i, atomicNumber, z, x, (hybridization == 2 || atomicNumber == 5 || atomicNumber == 6 && this.aaRet[1] == 1 || atomicNumber == 7 && ( new Boolean ( new Boolean (atom.group.getNitrogenAtom() === atom & atom.getFormalCharge() == 0).valueOf() || this.isAdjacentSp2(atom)).valueOf()) ? "sp2c" : "sp3d"), true, false, isQuick, null) != null) {
pt = JU.P3.newP(z);
pt.scaleAdd2(dHX, z, atom);
hPt = JM.AtomCollection.addH(hAtoms[i], hPt, pt, atom, vConnect, sym, ptTemp);
}break;
case 2:
this.getHybridizationAndAxes(i, atomicNumber, z, x, (targetValence == 4 ? "sp2c" : "sp2b"), false, false, isQuick, null);
pt = JU.P3.newP(z);
pt.scaleAdd2(dHX, z, atom);
hPt = JM.AtomCollection.addH(hAtoms[i], hPt, pt, atom, vConnect, sym, ptTemp);
break;
case 3:
this.getHybridizationAndAxes(i, atomicNumber, z, x, "spb", false, true, isQuick, null);
pt = JU.P3.newP(z);
pt.scaleAdd2(dHX, z, atom);
hPt = JM.AtomCollection.addH(hAtoms[i], hPt, pt, atom, vConnect, sym, ptTemp);
break;
}
}
}if (hPt < n) {
var a =  new Array(hPt);
for (var j = 0; j < hPt; j++) a[j] = hAtoms[i][j];

hAtoms[i] = a;
}nH += hPt;
}
nTotal[0] = nH;
return hAtoms;
}, "JU.BS,~A,JU.Lst,~N");
c$.addH = Clazz_defineMethod(c$, "addH", 
function(hAtoms, hPt, pt, atom, vConnect, sym, ptTemp){
if (sym != null) {
ptTemp.setT(pt);
sym.toFractional(ptTemp, false);
if (!sym.isWithinUnitCell(ptTemp, 1, 1, 1, NaN)) {
return hPt;
}}hAtoms[hPt++] = pt;
if (vConnect != null) vConnect.addLast(atom);
return hPt;
}, "~A,~N,JU.P3,JM.Atom,JU.Lst,J.api.SymmetryInterface,JU.P3");
Clazz_defineMethod(c$, "isAdjacentSp2", 
function(atom){
var bonds = atom.bonds;
for (var i = 0; i < bonds.length; i++) {
var b2 = bonds[i].getOtherAtom(atom).bonds;
for (var j = 0; j < b2.length; j++) switch (b2[j].getCovalentOrder()) {
case 2:
case 3:
return true;
}

}
return false;
}, "JM.Atom");
Clazz_defineMethod(c$, "getMissingHydrogenCount", 
function(atom, allowNegative){
if (this.aaRet == null) this.aaRet =  Clazz_newIntArray (5, 0);
var targetCount = atom.getTargetValence();
if (targetCount < 0) return 0;
var charge = atom.getFormalCharge();
var valence = atom.getValence();
var model = (this).am[atom.mi];
var s = (model.isBioModel && !model.isPdbWithMultipleBonds ? atom.group.getGroup3() : null);
this.aaRet[0] = targetCount;
this.aaRet[1] = charge;
this.aaRet[2] = 0;
this.aaRet[3] = atom.getCovalentBondCount();
this.aaRet[4] = (s == null ? 0 : valence);
if (s != null && charge == 0) {
if (this.bioModelset.getAminoAcidValenceAndCharge(s, atom.getAtomName(), this.aaRet)) {
targetCount = this.aaRet[0];
charge = this.aaRet[1];
}}if (charge != 0) {
targetCount += (targetCount == 4 ? -Math.abs(charge) : charge);
this.aaRet[0] = targetCount;
}var n = targetCount - valence;
return (n < 0 && !allowNegative ? 0 : n);
}, "JM.Atom,~B");
Clazz_defineMethod(c$, "fixFormalCharges", 
function(bs){
var n = 0;
for (var i = bs.nextSetBit(0); i >= 0; i = bs.nextSetBit(i + 1)) {
var a = this.at[i];
var nH = this.getMissingHydrogenCount(a, true);
if (nH != 0) {
var c0 = a.getFormalCharge();
var c = c0 - nH;
a.setFormalCharge(c);
this.taintAtom(i, 4);
if (JU.Logger.debugging) JU.Logger.debug("atom " + a + " formal charge " + c0 + " -> " + c);
n++;
}}
return n;
}, "JU.BS");
Clazz_defineMethod(c$, "getHybridizationAndAxes", 
function(atomIndex, atomicNumber, z, x, lcaoTypeRaw, hybridizationCompatible, doAlignZ, isQuick, ref){
var lcaoType = (lcaoTypeRaw.length > 0 && lcaoTypeRaw.charAt(0) == '-' ? lcaoTypeRaw.substring(1) : lcaoTypeRaw);
if (lcaoTypeRaw.indexOf("d") >= 0 && !lcaoTypeRaw.endsWith("sp3d")) return this.getHybridizationAndAxesD(atomIndex, z, x, lcaoType);
var atom = this.at[atomIndex];
if (atomicNumber == 0) atomicNumber = atom.getElementNumber();
var attached = this.getAttached(atom, 4, hybridizationCompatible, isQuick);
var nAttached = attached.length;
var pt = (lcaoType.charAt(lcaoType.length - 1)).charCodeAt(0) - 97;
if (pt < 0 || pt > 6) pt = 0;
z.set(0, 0, 0);
x.set(0, 0, 0);
var v =  new Array(4);
for (var i = 0; i < nAttached; i++) {
var a = attached[i];
if (a == null) {
nAttached = i;
break;
}v[i] = JU.V3.newVsub(atom, a);
v[i].normalize();
z.add(v[i]);
}
if (nAttached > 0) x.setT(v[0]);
var isPlanar = false;
var vTemp =  new JU.V3();
if (nAttached >= 3) {
if (x.angle(v[1]) < 2.9845130209103035) vTemp.cross(x, v[1]);
 else vTemp.cross(x, v[2]);
vTemp.normalize();
var vTemp2 =  new JU.V3();
if (v[1].angle(v[2]) < 2.9845130209103035) vTemp2.cross(v[1], v[2]);
 else vTemp2.cross(x, v[2]);
vTemp2.normalize();
isPlanar = (Math.abs(vTemp2.dot(vTemp)) >= 0.95);
}var isSp3 = (lcaoType.indexOf("sp3") == 0);
var isSp2 = (!isSp3 && lcaoType.indexOf("sp2") == 0);
var isSp = (!isSp3 && !isSp2 && lcaoType.indexOf("sp") == 0);
var isP = (lcaoType.indexOf("p") == 0);
var isLp = (lcaoType.indexOf("lp") == 0);
var hybridization = null;
if (hybridizationCompatible) {
if (nAttached == 0) return null;
if (isSp3) {
if (pt > 3 || nAttached > 4) return null;
} else if (isSp2) {
if (pt > 2 || nAttached > 3) return null;
} else if (isSp) {
if (pt > 1 || nAttached > 2) return null;
}switch (nAttached) {
case 1:
if (atomicNumber == 1 && !isSp3) return null;
if (isSp3) {
hybridization = "sp3";
break;
}switch (attached[0].getCovalentBondCount()) {
case 1:
if (attached[0].getValence() != 2) {
hybridization = "sp";
break;
}case 2:
hybridization = (isSp ? "sp" : "sp2");
break;
case 3:
if (!isSp2 && !isP) return null;
hybridization = "sp2";
break;
}
break;
case 2:
if (z.length() < 0.1) {
if (lcaoType.indexOf("2") >= 0 || lcaoType.indexOf("3") >= 0) return null;
hybridization = "sp";
break;
}hybridization = (isSp3 ? "sp3" : "sp2");
if (lcaoType.indexOf("sp") == 0) {
break;
}if (isLp) {
hybridization = "lp";
break;
}hybridization = lcaoType;
break;
default:
if (isPlanar && !isQuick) {
hybridization = "sp2";
} else {
if (isPlanar) z.setT(vTemp);
if (isLp && nAttached == 3) {
hybridization = "lp";
break;
}hybridization = "sp3";
}}
if (hybridization == null) return null;
if (lcaoType.indexOf("p") == 0) {
if (hybridization === "sp3") return null;
} else if (lcaoType.indexOf(hybridization) < 0) {
return null;
}}if (pt < nAttached && !lcaoType.startsWith("p") && !lcaoType.startsWith("l")) {
z.sub2(attached[pt], atom);
z.normalize();
return hybridization;
}switch (nAttached) {
case 0:
if (lcaoType.equals("sp3c") || lcaoType.equals("sp2d") || lcaoType.equals("lpa")) {
z.set(-0.5, -0.7, 1);
x.set(1, 0, 0);
} else if (lcaoType.equals("sp3b") || lcaoType.equals("lpb")) {
z.set(0.5, -0.7, -1.0);
x.set(1, 0, 0);
} else if (lcaoType.equals("sp3a")) {
z.set(0, 1, 0);
x.set(1, 0, 0);
} else {
z.set(0, 0, 1);
x.set(1, 0, 0);
}break;
case 1:
vTemp.setT(JM.AtomCollection.vRef);
x.cross(vTemp, z);
if (isSp3) {
for (var i = attached[0].getBondCount(); --i >= 0; ) {
if (attached[0].bonds[i].isCovalentNotPartial0() && attached[0].getBondedAtomIndex(i) != atom.i) {
x.sub2(attached[0], attached[0].bonds[i].getOtherAtom(attached[0]));
x.cross(z, x);
if (x.length() == 0) continue;
x.cross(x, z);
break;
}}
x.normalize();
if (Float.isNaN(x.x)) {
x.setT(JM.AtomCollection.vRef);
x.cross(x, z);
}vTemp.cross(z, x);
vTemp.normalize();
z.normalize();
x.scaleAdd2(2.828, x, z);
if (pt != 3) {
x.normalize();
 new JU.M3().setAA(JU.A4.new4(z.x, z.y, z.z, (pt == 2 ? 1 : -1) * 2.09439507)).rotate(x);
}z.setT(x);
x.cross(vTemp, z);
break;
}vTemp.cross(x, z);
var na = attached[0].getCovalentBondCount();
switch (na) {
case 3:
if (ref !== attached[0]) {
this.getHybridizationAndAxes(attached[0].i, 0, x, vTemp, "pz", false, doAlignZ, isQuick, atom);
vTemp.setT(x);
if (isSp2) {
x.cross(x, z);
if (pt == 1) x.scale(-1);
x.scale(JM.AtomCollection.sqrt3_2);
z.scaleAdd2(0.5, z, x);
} else if (isSp) {
} else {
vTemp.setT(z);
z.setT(x);
}x.cross(vTemp, z);
break;
}na = 2;
case 1:
if (na == 1 && attached[0].getValence() != 2) {
break;
}case 2:
var isCumulated = false;
var a0 = attached[0];
x.setT(z);
vTemp.setT(JM.AtomCollection.vRef);
while (a0 != null && a0.getCovalentBondCount() == 2) {
var bonds = a0.bonds;
var a = null;
isCumulated = !isCumulated;
for (var i = 0; i < bonds.length; i++) if (bonds[i].isCovalentNotPartial0()) {
a = bonds[i].getOtherAtom(a0);
if (a !== atom) {
vTemp.sub2(a, a0);
break;
}}
vTemp.cross(vTemp, x);
if (vTemp.length() > 0.1 || a.getCovalentBondCount() != 2) break;
atom = a0;
a0 = a;
}
if (isSp) {
} else if (vTemp.length() > 0.1) {
z.cross(vTemp, x);
z.normalize();
if (pt == 1) z.scale(-1);
z.scale(JM.AtomCollection.sqrt3_2);
z.scaleAdd2(0.5, x, z);
if (isP) {
vTemp.cross(z, x);
z.setT(vTemp);
vTemp.setT(x);
}x.cross(vTemp, z);
} else {
z.setT(x);
x.cross(JM.AtomCollection.vRef, x);
}break;
}
break;
case 2:
if (z.length() < 0.1) {
if (!lcaoType.equals("pz")) {
var a = attached[0];
var ok = (a.getCovalentBondCount() == 3);
if (!ok) ok = ((a = attached[1]).getCovalentBondCount() == 3);
if (ok) {
this.getHybridizationAndAxes(a.i, 0, x, z, "pz", false, doAlignZ, isQuick, null);
if (lcaoType.equals("px")) x.scale(-1);
z.setT(v[0]);
break;
}vTemp.setT(JM.AtomCollection.vRef);
z.cross(vTemp, x);
vTemp.cross(z, x);
}z.setT(x);
x.cross(vTemp, z);
break;
}vTemp.cross(z, x);
if (isSp2) {
x.cross(z, vTemp);
break;
}if (isSp3 || isLp) {
vTemp.normalize();
z.normalize();
if (!lcaoType.equals("lp")) {
if (pt == 0 || pt == 2) z.scaleAdd2(-1.2, vTemp, z);
 else z.scaleAdd2(1.2, vTemp, z);
}x.cross(z, vTemp);
break;
}x.cross(z, vTemp);
z.setT(vTemp);
if (z.z < 0) {
z.scale(-1);
x.scale(-1);
}break;
default:
if (isSp3) break;
if (!isPlanar) {
x.cross(z, x);
break;
}z.setT(vTemp);
if (z.z < 0 && doAlignZ) {
z.scale(-1);
x.scale(-1);
}}
x.normalize();
z.normalize();
return hybridization;
}, "~N,~N,JU.V3,JU.V3,~S,~B,~B,~B,JU.T3");
Clazz_defineMethod(c$, "getHybridizationAndAxesD", 
function(atomIndex, z, x, lcaoType){
if (lcaoType.startsWith("sp3d2")) lcaoType = "d2sp3" + (lcaoType.length == 5 ? "a" : lcaoType.substring(5));
if (lcaoType.startsWith("sp3d")) lcaoType = "dsp3" + (lcaoType.length == 4 ? "a" : lcaoType.substring(4));
if (lcaoType.equals("d2sp3") || lcaoType.equals("dsp3")) lcaoType += "a";
var isTrigonal = lcaoType.startsWith("dsp3");
var pt = (lcaoType.charAt(lcaoType.length - 1)).charCodeAt(0) - 97;
if (z != null && (!isTrigonal && (pt > 5 || !lcaoType.startsWith("d2sp3")) || isTrigonal && pt > 4)) return null;
var atom = this.at[atomIndex];
var attached = this.getAttached(atom, 6, true, false);
if (attached == null) return (z == null ? null : "?");
var nAttached = attached.length;
if (nAttached < 3 && z != null) return null;
var isLP = (pt >= nAttached);
var nAngles = Clazz_doubleToInt(nAttached * (nAttached - 1) / 2);
var angles = JU.AU.newInt2(nAngles);
var ntypes =  Clazz_newIntArray (3, 0);
var typePtrs =  Clazz_newIntArray (3, nAngles, 0);
var n = 0;
var _90 = 0;
var _120 = 1;
var _180 = 2;
var n120_atom0 = 0;
for (var i = 0; i < nAttached - 1; i++) for (var j = i + 1; j < nAttached; j++) {
var angle = JU.Measure.computeAngleABC(attached[i], atom, attached[j], true);
var itype = (angle < 105 ? _90 : angle >= 150 ? _180 : _120);
typePtrs[itype][ntypes[itype]] = n;
ntypes[itype]++;
angles[n++] =  Clazz_newIntArray(-1, [i, j]);
if (i == 0 && itype == _120) n120_atom0++;
}

n = ntypes[_90] * 100 + ntypes[_120] * 10 + ntypes[_180];
if (z == null) {
switch (n) {
default:
return "";
case 0:
return "";
case 1:
return "linear";
case 100:
case 10:
return "bent";
case 111:
case 201:
return "T-shaped";
case 30:
case 120:
case 210:
case 300:
if (Math.abs(JU.Measure.computeTorsion(attached[0], atom, attached[1], attached[2], true)) > 162) return "trigonal planar";
return "trigonal pyramidal";
case 330:
return (n120_atom0 % 2 == 1 ? "tetrahedral" : "uncapped trigonal pyramid");
case 60:
case 150:
case 240:
return "tetrahedral";
case 402:
return "square planar";
case 411:
case 501:
return "see-saw";
case 631:
return "trigonal bipyramidal";
case 802:
return "uncapped square pyramid";
case 1203:
return "octahedral";
}
}switch (n) {
default:
return null;
case 201:
break;
case 210:
case 330:
case 411:
case 631:
if (!isTrigonal) return null;
break;
case 300:
case 402:
case 501:
case 802:
case 1203:
if (isTrigonal) return null;
break;
}
if (isLP) {
var a;
var bs;
if (isTrigonal) {
switch (ntypes[_120]) {
case 0:
z.sub2(attached[angles[typePtrs[_90][0]][0]], atom);
x.sub2(attached[angles[typePtrs[_90][0]][1]], atom);
z.cross(z, x);
z.normalize();
if (pt == 4) z.scale(-1);
bs = this.findNotAttached(nAttached, angles, typePtrs[_180], ntypes[_180]);
var i = bs.nextSetBit(0);
x.sub2(attached[i], atom);
x.normalize();
x.scale(0.5);
z.scaleAdd2(JM.AtomCollection.sqrt3_2, z, x);
pt = -1;
break;
case 1:
if (pt == 4) {
a = angles[typePtrs[_120][0]];
z.add2(attached[a[0]], attached[a[1]]);
z.scaleAdd2(-2, atom, z);
pt = -1;
} else {
bs = this.findNotAttached(nAttached, angles, typePtrs[_120], ntypes[_120]);
pt = bs.nextSetBit(0);
}break;
default:
bs = this.findNotAttached(nAttached, angles, typePtrs[_120], ntypes[_120]);
pt = bs.nextSetBit(0);
}
} else {
var isPlanar = false;
if (nAttached == 4) {
switch (ntypes[_180]) {
case 1:
bs = this.findNotAttached(nAttached, angles, typePtrs[_180], ntypes[_180]);
var i = bs.nextSetBit(0);
if (pt == 4) pt = i;
 else pt = bs.nextSetBit(i + 1);
break;
default:
isPlanar = true;
}
} else {
bs = this.findNotAttached(nAttached, angles, typePtrs[_180], ntypes[_180]);
var i = bs.nextSetBit(0);
for (var j = nAttached; j < pt && i >= 0; j++) i = bs.nextSetBit(i + 1);

if (i == -1) isPlanar = true;
 else pt = i;
}if (isPlanar) {
z.sub2(attached[angles[typePtrs[_90][0]][0]], atom);
x.sub2(attached[angles[typePtrs[_90][0]][1]], atom);
z.cross(z, x);
if (pt == 4) z.scale(-1);
pt = -1;
}}}if (pt >= 0) z.sub2(attached[pt], atom);
if (isLP) z.scale(-1);
z.normalize();
return (isTrigonal ? "dsp3" : "d2sp3");
}, "~N,JU.V3,JU.V3,~S");
Clazz_defineMethod(c$, "getAttached", 
function(atom, nMax, doSort, isQuick){
var nAttached = atom.getCovalentBondCount();
if (nAttached > nMax) return null;
var attached =  new Array(nAttached);
if (nAttached > 0) {
var bonds = atom.bonds;
var n = 0;
for (var i = 0; i < bonds.length; i++) if (bonds[i].isCovalentNotPartial0()) {
var a = bonds[i].getOtherAtom(atom);
if (!isQuick || a.getAtomicAndIsotopeNumber() != 1) attached[n++] = a;
}
if (doSort && !isQuick) java.util.Arrays.sort(attached, Clazz_innerTypeInstance(JM.AtomCollection.AtomSorter, this, null));
}return attached;
}, "JM.Atom,~N,~B,~B");
Clazz_defineMethod(c$, "findNotAttached", 
function(nAttached, angles, ptrs, nPtrs){
var bs = JU.BS.newN(nAttached);
bs.setBits(0, nAttached);
for (var i = 0; i < nAttached; i++) for (var j = 0; j < nPtrs; j++) {
var a = angles[ptrs[j]];
if (a[0] == i || a[1] == i) bs.clear(i);
}

return bs;
}, "~N,~A,~A,~N");
Clazz_defineMethod(c$, "getAtomBitsMDa", 
function(tokType, specInfo, bs){
var iSpec = (Clazz_instanceOf(specInfo, Integer) ? (specInfo).intValue() : 0);
switch (tokType) {
case 1086326786:
case 1086326785:
var isType = (tokType == 1086326785);
var names = "," + specInfo + ",";
for (var i = this.ac; --i >= 0; ) {
if (JM.AtomCollection.isDeleted(this.at[i])) continue;
var s = (isType ? this.at[i].getAtomType() : this.at[i].getAtomName());
if (names.indexOf("," + s + ",") >= 0) bs.set(i);
}
return bs;
case 1094715393:
for (var i = this.ac; --i >= 0; ) {
if (!JM.AtomCollection.isDeleted(this.at[i]) && this.at[i].getAtomNumber() == iSpec) bs.set(i);
}
return bs;
case 2097155:
for (var i = this.ac; --i >= 0; ) {
if (!JM.AtomCollection.isDeleted(this.at[i]) && this.at[i].getCovalentBondCount() > 0) bs.set(i);
}
return bs;
case 2097188:
case 2097156:
case 136314895:
case 2097166:
case 2097168:
case 2097170:
case 2097172:
case 2097174:
case 2097184:
return ((this).haveBioModels ? (this).bioModelset.getAtomBitsBS(tokType, null, bs) : bs);
case 1612709900:
iSpec = 1;
case 1094715402:
for (var i = this.ac; --i >= 0; ) {
if (!JM.AtomCollection.isDeleted(this.at[i]) && this.at[i].getElementNumber() == iSpec) bs.set(i);
}
return bs;
case 1612709894:
for (var i = this.ac; --i >= 0; ) {
if (!JM.AtomCollection.isDeleted(this.at[i]) && this.at[i].isHetero()) bs.set(i);
}
return bs;
case 1073741824:
return this.getIdentifierOrNull(specInfo);
case 2097165:
for (var i = this.ac; --i >= 0; ) {
if (!JM.AtomCollection.isDeleted(this.at[i]) && this.at[i].isLeadAtom()) bs.set(i);
}
return bs;
case 1094713362:
case 1639976963:
return ((this).haveBioModels ? (this).bioModelset.getAtomBitsBS(tokType, specInfo, bs) : bs);
case 1094715412:
for (var i = this.ac; --i >= 0; ) {
if (!JM.AtomCollection.isDeleted(this.at[i]) && this.at[i].getResno() == iSpec) bs.set(i);
}
return bs;
case 1612709912:
var hs =  Clazz_newIntArray (2, 0);
var a;
for (var i = this.ac; --i >= 0; ) {
if (JM.AtomCollection.isDeleted(this.at[i])) continue;
var g = this.at[i].group.groupID;
if (g >= 42 && g < 45) {
bs.set(i);
} else if ((a = this.at[i]).getElementNumber() == 8 && a.getCovalentBondCount() == 2) {
var bonds = a.bonds;
var n = 0;
var b;
for (var j = bonds.length; --j >= 0 && n < 3; ) if (bonds[j].isCovalentNotPartial0() && (b = bonds[j].getOtherAtom(a)).getElementNumber() == 1) hs[n++ % 2] = b.i;

if (n == 2) {
bs.set(hs[1]);
bs.set(hs[0]);
bs.set(i);
}}}
return bs;
case 1073742355:
var spec = specInfo;
for (var i = this.ac; --i >= 0; ) if (!JM.AtomCollection.isDeleted(this.at[i]) && this.isAltLoc(this.at[i].altloc, spec)) bs.set(i);

return bs;
case 1073742356:
var atomSpec = (specInfo).toUpperCase();
if (atomSpec.indexOf("\\?") >= 0) atomSpec = JU.PT.rep(atomSpec, "\\?", "\1");
var allowStar = atomSpec.startsWith("?*");
if (allowStar) atomSpec = atomSpec.substring(1);
for (var i = this.ac; --i >= 0; ) if (!JM.AtomCollection.isDeleted(this.at[i]) && this.isAtomNameMatch(this.at[i], atomSpec, allowStar, allowStar)) bs.set(i);

return bs;
case 1073742357:
return JU.BSUtil.copy(this.getChainBits(iSpec));
case 1073742360:
return this.getSpecName(specInfo);
case 1073742361:
for (var i = this.ac; --i >= 0; ) if (!JM.AtomCollection.isDeleted(this.at[i]) && this.at[i].group.groupID == iSpec) bs.set(i);

return bs;
case 1073742362:
return JU.BSUtil.copy(this.getSeqcodeBits(iSpec, true));
case 5:
for (var i = this.ac; --i >= 0; ) if (!JM.AtomCollection.isDeleted(this.at[i]) && this.at[i].group.getInsCode() == iSpec) bs.set(i);

return bs;
case 1296041986:
for (var i = this.ac; --i >= 0; ) if (!JM.AtomCollection.isDeleted(this.at[i]) && this.at[i].getSymOp() == iSpec) bs.set(i);

return bs;
}
var bsTemp;
var bsInfo = specInfo;
var i0 = bsInfo.nextSetBit(0);
if (i0 < 0) return bs;
switch (tokType) {
case 1094717454:
bsTemp = JU.BSUtil.copy(bsInfo);
for (var i = i0; i >= 0; i = bsTemp.nextSetBit(i + 1)) {
bs.or((this).am[this.at[i].mi].bsAtoms);
bsTemp.andNot(bs);
}
return bs;
case 1086326788:
bsTemp = JU.BSUtil.copy(bsInfo);
for (var i = i0; i >= 0; i = bsTemp.nextSetBit(i + 1)) {
this.at[i].group.chain.setAtomBits(bs);
bsTemp.andNot(bs);
}
return bs;
case 1086326789:
bsTemp =  new JU.BS();
for (var i = i0; i >= 0; i = bsInfo.nextSetBit(i + 1)) bsTemp.set(this.at[i].getElementNumber());

for (var i = this.ac; --i >= 0; ) if (!JM.AtomCollection.isDeleted(this.at[i]) && bsTemp.get(this.at[i].getElementNumber())) bs.set(i);

return bs;
case 1086324742:
bsTemp = JU.BSUtil.copy(bsInfo);
for (var i = i0; i >= 0; i = bsTemp.nextSetBit(i + 1)) {
this.at[i].group.setAtomBits(bs);
bsTemp.andNot(bs);
}
return bs;
case 1095241729:
for (var i = this.ac; --i >= 0; ) {
var v = this.getVibration(i, false);
if (v != null && v.modDim == -2) bs.set(i);
}
return bs;
case 1145047055:
var sb =  new JU.SB().append(";");
for (var i = i0; i >= 0; i = bsInfo.nextSetBit(i + 1)) {
var v = this.getVibration(i, false);
if (v != null) {
var s = ";" + v.getApproxString100() + ";";
if (sb.indexOf(s) < 0) sb.append(s);
}}
for (var i = this.ac; --i >= 0; ) {
var v = this.getVibration(i, false);
if (v != null && sb.indexOf(";" + v.getApproxString100() + ";") >= 0) bs.set(i);
}
return bs;
case 1094713369:
bsTemp =  new JU.BS();
for (var i = i0; i >= 0; i = bsInfo.nextSetBit(i + 1)) bsTemp.set(this.at[i].atomSite);

for (var i = this.ac; --i >= 0; ) if (!JM.AtomCollection.isDeleted(this.at[i]) && bsTemp.get(this.at[i].atomSite)) bs.set(i);

return bs;
}
JU.Logger.error("MISSING getAtomBits entry for " + JS.T.nameOf(tokType));
return bs;
}, "~N,~O,JU.BS");
Clazz_defineMethod(c$, "getChainBits", 
function(chainID){
var caseSensitive = this.vwr.getBoolean(603979822);
if (caseSensitive) {
if (chainID >= 97 && chainID <= 122) chainID += 159;
} else {
if (chainID >= 0 && chainID < 300) chainID = this.chainToUpper(chainID);
}var bs =  new JU.BS();
var bsDone = JU.BS.newN(this.ac);
var id;
for (var i = bsDone.nextClearBit(0); i < this.ac; i = bsDone.nextClearBit(i + 1)) {
if (JM.AtomCollection.isDeleted(this.at[i])) continue;
var chain = this.at[i].group.chain;
if (chainID == (id = chain.chainID) || !caseSensitive && id >= 0 && id < 300 && chainID == this.chainToUpper(id)) {
chain.setAtomBits(bs);
bsDone.or(bs);
} else {
chain.setAtomBits(bsDone);
}}
return bs;
}, "~N");
Clazz_defineMethod(c$, "chainToUpper", 
function(chainID){
return (chainID >= 97 && chainID <= 122 ? chainID - 32 : chainID >= 256 && chainID < 300 ? chainID - 191 : chainID);
}, "~N");
Clazz_defineMethod(c$, "isAltLoc", 
function(altloc, strPattern){
if (strPattern == null) return (altloc == '\0');
if (strPattern.length != 1) return false;
var ch = strPattern.charAt(0);
return (ch == '*' || ch == '?' && altloc != '\0' || altloc == ch);
}, "~S,~S");
Clazz_defineMethod(c$, "getSeqcodeBits", 
function(seqcode, returnEmpty){
var bs =  new JU.BS();
var seqNum = JM.Group.getSeqNumberFor(seqcode);
var haveSeqNumber = (seqNum != 2147483647);
var isEmpty = true;
var insCode = JM.Group.getInsertionCodeChar(seqcode);
switch ((insCode).charCodeAt(0)) {
case 63:
for (var i = this.ac; --i >= 0; ) {
if (JM.AtomCollection.isDeleted(this.at[i])) continue;
var atomSeqcode = this.at[i].group.seqcode;
if ((!haveSeqNumber || seqNum == JM.Group.getSeqNumberFor(atomSeqcode)) && JM.Group.getInsertionCodeFor(atomSeqcode) != 0) {
bs.set(i);
isEmpty = false;
}}
break;
default:
for (var i = this.ac; --i >= 0; ) {
if (JM.AtomCollection.isDeleted(this.at[i])) continue;
var atomSeqcode = this.at[i].group.seqcode;
if (seqcode == atomSeqcode || !haveSeqNumber && seqcode == JM.Group.getInsertionCodeFor(atomSeqcode) || insCode == '*' && seqNum == JM.Group.getSeqNumberFor(atomSeqcode)) {
bs.set(i);
isEmpty = false;
}}
}
return (!isEmpty || returnEmpty ? bs : null);
}, "~N,~B");
Clazz_defineMethod(c$, "getIdentifierOrNull", 
function(identifier){
var bs = this.getSpecNameOrNull(identifier, false);
if (identifier.indexOf("\\?") >= 0) identifier = JU.PT.rep(identifier, "\\?", "\1");
return (bs != null || identifier.indexOf("?") > 0 ? bs : identifier.indexOf("*") > 0 ? this.getSpecNameOrNull(identifier, true) : (this).haveBioModels ? (this).bioModelset.getIdentifierOrNull(identifier) : null);
}, "~S");
Clazz_defineMethod(c$, "getSpecName", 
function(name){
var bs = this.getSpecNameOrNull(name, false);
if (bs != null) return bs;
if (name.indexOf("*") > 0) bs = this.getSpecNameOrNull(name, true);
return (bs == null ?  new JU.BS() : bs);
}, "~S");
Clazz_defineMethod(c$, "getSpecNameOrNull", 
function(name, checkStar){
var bs = null;
name = name.toUpperCase();
if (name.indexOf("\\?") >= 0) name = JU.PT.rep(name, "\\?", "\1");
var allowInitialStar = name.startsWith("?*");
if (allowInitialStar) name = name.substring(1);
for (var i = this.ac; --i >= 0; ) {
if (JM.AtomCollection.isDeleted(this.at[i])) continue;
var g3 = this.at[i].getGroup3(true);
if (g3 != null && g3.length > 0) {
if (JU.PT.isMatch(g3, name, checkStar, true)) {
if (bs == null) bs = JU.BS.newN(i + 1);
bs.set(i);
while (--i >= 0) {
if (!JM.AtomCollection.isDeleted(this.at[i]) && this.at[i].getGroup3(true).equals(g3)) bs.set(i);
}
i++;
}} else if (this.isAtomNameMatch(this.at[i], name, checkStar, allowInitialStar)) {
if (bs == null) bs = JU.BS.newN(i + 1);
bs.set(i);
}}
return bs;
}, "~S,~B");
Clazz_defineMethod(c$, "isAtomNameMatch", 
function(atom, strPattern, checkStar, allowInitialStar){
return JU.PT.isMatch(atom.getAtomName().toUpperCase(), strPattern, checkStar, allowInitialStar);
}, "JM.Atom,~S,~B,~B");
Clazz_defineMethod(c$, "getAtomIndices", 
function(bs){
var n = 0;
var indices =  Clazz_newIntArray (this.ac, 0);
for (var j = bs.nextSetBit(0); j >= 0 && j < this.ac; j = bs.nextSetBit(j + 1)) indices[j] = ++n;

return indices;
}, "JU.BS");
Clazz_defineMethod(c$, "getAtomsNearPlane", 
function(distance, plane){
var bsResult =  new JU.BS();
for (var i = this.ac; --i >= 0; ) {
var atom = this.at[i];
if (JM.AtomCollection.isDeleted(atom)) continue;
var d = JU.Measure.distanceToPlane(plane, atom);
if (distance > 0 && d >= -0.1 && d <= distance || distance < 0 && d <= 0.1 && d >= distance || distance == 0 && Math.abs(d) < 0.01) bsResult.set(atom.i);
}
return bsResult;
}, "~N,JU.P4");
Clazz_defineMethod(c$, "clearVisibleSets", 
function(){
this.haveBSVisible = false;
this.haveBSClickable = false;
});
Clazz_defineMethod(c$, "getAtomsInFrame", 
function(bsAtoms){
this.clearVisibleSets();
bsAtoms.clearAll();
for (var i = this.ac; --i >= 0; ) if (!JM.AtomCollection.isDeleted(this.at[i]) && this.at[i].isVisible(1)) bsAtoms.set(i);

}, "JU.BS");
Clazz_defineMethod(c$, "getVisibleSet", 
function(forceNew){
if (forceNew) {
this.vwr.setModelVisibility();
this.vwr.shm.finalizeAtoms(null, true);
} else if (this.haveBSVisible) {
return this.bsVisible;
}this.bsVisible.clearAll();
for (var i = this.ac; --i >= 0; ) if (!JM.AtomCollection.isDeleted(this.at[i]) && this.at[i].checkVisible()) this.bsVisible.set(i);

if (this.vwr.shm.bsSlabbedInternal != null) this.bsVisible.andNot(this.vwr.shm.bsSlabbedInternal);
this.haveBSVisible = true;
return this.bsVisible;
}, "~B");
Clazz_defineMethod(c$, "getClickableSet", 
function(forceNew){
if (forceNew) this.vwr.setModelVisibility();
 else if (this.haveBSClickable) return this.bsClickable;
this.bsClickable.clearAll();
for (var i = this.ac; --i >= 0; ) if (!JM.AtomCollection.isDeleted(this.at[i]) && this.at[i].isClickable()) this.bsClickable.set(i);

this.haveBSClickable = true;
return this.bsClickable;
}, "~B");
Clazz_defineMethod(c$, "isModulated", 
function(i){
return this.bsModulated != null && this.bsModulated.get(i);
}, "~N");
Clazz_defineMethod(c$, "deleteModelAtoms", 
function(firstAtomIndex, nAtoms, bsAtoms){
this.at = JU.AU.deleteElements(this.at, firstAtomIndex, nAtoms);
this.ac = this.at.length;
for (var j = firstAtomIndex; j < this.ac; j++) {
this.at[j].i = j;
this.at[j].mi--;
}
if (this.bsModulated != null) JU.BSUtil.deleteBits(this.bsModulated, bsAtoms);
this.deleteAtomTensors(bsAtoms);
this.atomNames = JU.AU.deleteElements(this.atomNames, firstAtomIndex, nAtoms);
this.atomTypes = JU.AU.deleteElements(this.atomTypes, firstAtomIndex, nAtoms);
this.atomResnos = JU.AU.deleteElements(this.atomResnos, firstAtomIndex, nAtoms);
this.atomSerials = JU.AU.deleteElements(this.atomSerials, firstAtomIndex, nAtoms);
this.atomSeqIDs = JU.AU.deleteElements(this.atomSeqIDs, firstAtomIndex, nAtoms);
this.dssrData = JU.AU.deleteElements(this.dssrData, firstAtomIndex, nAtoms);
this.bfactor100s = JU.AU.deleteElements(this.bfactor100s, firstAtomIndex, nAtoms);
this.hasBfactorRange = false;
this.occupancies = JU.AU.deleteElements(this.occupancies, firstAtomIndex, nAtoms);
this.resetPartialCharges();
this.atomTensorList = JU.AU.deleteElements(this.atomTensorList, firstAtomIndex, nAtoms);
this.vibrations = JU.AU.deleteElements(this.vibrations, firstAtomIndex, nAtoms);
this.nSurfaceAtoms = 0;
this.bsSurface = null;
this.surfaceDistance100s = null;
if (this.tainted != null) for (var i = 0; i < 18; i++) JU.BSUtil.deleteBits(this.tainted[i], bsAtoms);

}, "~N,~N,JU.BS");
Clazz_defineMethod(c$, "getAtomIdentityInfo", 
function(i, info, ptTemp){
info.put("_ipt", Integer.$valueOf(i));
info.put("atomIndex", Integer.$valueOf(i));
info.put("atomno", Integer.$valueOf(this.at[i].getAtomNumber()));
info.put("info", this.getAtomInfo(i, null, ptTemp));
info.put("sym", this.at[i].getElementSymbol());
}, "~N,java.util.Map,JU.P3");
Clazz_defineMethod(c$, "getAtomTensorList", 
function(i){
return (i < 0 || this.atomTensorList == null || i >= this.atomTensorList.length ? null : this.atomTensorList[i]);
}, "~N");
Clazz_defineMethod(c$, "deleteAtomTensors", 
function(bsAtoms){
if (this.atomTensors == null) return;
var toDelete =  new JU.Lst();
for (var key, $key = this.atomTensors.keySet().iterator (); $key.hasNext()&& ((key = $key.next ()) || true);) {
var list = this.atomTensors.get(key);
for (var i = list.size(); --i >= 0; ) {
var t = list.get(i);
if (bsAtoms.get(t.atomIndex1) || t.atomIndex2 >= 0 && bsAtoms.get(t.atomIndex2)) list.removeItemAt(i);
}
if (list.size() == 0) toDelete.addLast(key);
}
for (var i = toDelete.size(); --i >= 0; ) this.atomTensors.remove(toDelete.get(i));

}, "JU.BS");
Clazz_defineMethod(c$, "setCapacity", 
function(nAtoms){
this.atomCapacity += nAtoms;
}, "~N");
Clazz_defineMethod(c$, "setAtomTensors", 
function(atomIndex, list){
if (list == null || list.size() == 0) return;
if (this.atomTensors == null) this.atomTensors =  new java.util.Hashtable();
if (this.atomTensorList == null) this.atomTensorList =  new Array(this.at.length);
this.atomTensorList = JU.AU.ensureLength(this.atomTensorList, this.at.length);
this.atomTensorList[atomIndex] = JM.AtomCollection.getTensorList(list);
for (var i = list.size(); --i >= 0; ) {
var t = list.get(i);
t.atomIndex1 = atomIndex;
t.atomIndex2 = -1;
t.modelIndex = this.at[atomIndex].mi;
this.addTensor(t, t.type);
if (t.altType != null) this.addTensor(t, t.altType);
}
}, "~N,JU.Lst");
Clazz_defineMethod(c$, "addTensor", 
function(t, type){
type = type.toLowerCase();
var tensors = this.atomTensors.get(type);
if (tensors == null) {
this.atomTensors.put(type, tensors =  new JU.Lst());
tensors.ensureCapacity(this.atomCapacity);
}tensors.addLast(t);
}, "JU.Tensor,~S");
c$.getTensorList = Clazz_defineMethod(c$, "getTensorList", 
function(list){
var pt = -1;
var haveTLS = false;
var n = list.size();
for (var i = n; --i >= 0; ) {
var t = list.get(i);
if (t.forThermalEllipsoid) pt = i;
 else if (t.iType == 2) haveTLS = true;
}
var a =  new Array((pt >= 0 || !haveTLS ? 0 : 1) + n);
if (pt >= 0) {
a[0] = list.get(pt);
if (list.size() == 1) return a;
}if (haveTLS) {
pt = 0;
for (var i = n; --i >= 0; ) {
var t = list.get(i);
if (t.forThermalEllipsoid) continue;
a[++pt] = t;
}
} else {
for (var i = 0; i < n; i++) a[i] = list.get(i);

}return a;
}, "JU.Lst");
Clazz_defineMethod(c$, "getAtomTensor", 
function(i, type){
var tensors = this.getAtomTensorList(i);
if (tensors != null && type != null) {
type = type.toLowerCase();
for (var j = 0; j < tensors.length; j++) {
var t = tensors[j];
if (t != null && (type.equals(t.type) || type.equals(t.altType))) return t;
}
}return null;
}, "~N,~S");
Clazz_defineMethod(c$, "getAllAtomTensors", 
function(type){
if (this.atomTensors == null) return null;
if (type != null) return this.atomTensors.get(type.toLowerCase());
var list =  new JU.Lst();
for (var e, $e = this.atomTensors.entrySet().iterator (); $e.hasNext()&& ((e = $e.next ()) || true);) list.addAll(e.getValue());

return list;
}, "~S");
Clazz_defineMethod(c$, "scaleVectorsToMax", 
function(max){
if (this.vibrations == null) return;
var m = 0;
var bsVib = JU.BS.newN(this.ac);
for (var i = this.vibrations.length; --i >= 0; ) {
var v = this.getVibration(i, false);
if (v != null && (v.modDim == -1 || v.modDim == -2)) {
v.resetMoment();
m = Math.max(m, v.length());
bsVib.set(i);
}}
if (m == max || m == 0) return;
m = max / m;
var ok = false;
for (var i = bsVib.nextSetBit(0); i >= 0; i = bsVib.nextSetBit(i + 1)) {
var v = this.getVibration(i, false);
var mod = this.getModulation(i);
if (mod == null) {
if (m == 0) return;
v.scale(m);
} else {
mod.scaleVibration(m);
}if (!ok) {
this.taintAtom(i, 12);
ok = true;
}}
this.tainted[12].or(bsVib);
}, "~N");
Clazz_defineMethod(c$, "getAtomsFromAtomNumberInFrame", 
function(atomNumber){
var bs = this.vwr.getVisibleFrameAtomsNoSplitData();
for (var i = bs.nextSetBit(0); i >= 0; i = bs.nextSetBit(i + 1)) if (this.at[i].getAtomNumber() != atomNumber) bs.clear(i);

return bs;
}, "~N");
Clazz_defineMethod(c$, "generateCrystalClass", 
function(atomIndex, pt){
var sym = (atomIndex < 0 || atomIndex >= this.ac ? this.vwr.getOperativeSymmetry() : this.at[atomIndex].getUnitCell());
var isRandom = (pt != null && Float.isNaN(pt.x));
var ret = (sym == null ? null : sym.generateCrystalClass(isRandom ? null : pt != null ? pt : this.at[atomIndex]));
return (ret == null ?  new JU.Lst() : ret);
}, "~N,JU.P3");
c$.isDeleted = Clazz_defineMethod(c$, "isDeleted", 
function(atom){
return (atom == null || atom.isDeleted());
}, "JM.Atom");
Clazz_defineMethod(c$, "getGroupsForAtoms", 
function(bsAtoms){
var groups =  new java.util.ArrayList();
var lastGroup = null;
for (var i = bsAtoms.nextSetBit(0); i >= 0; i = bsAtoms.nextSetBit(i + 1)) {
var group = this.at[i].group;
if (group !== lastGroup) {
lastGroup = group;
groups.add(group);
}}
return groups;
}, "JU.BS");
c$.$AtomCollection$AtomSorter$ = function(){
/*if4*/;(function(){
var c$ = Clazz_decorateAsClass(function(){
Clazz_prepareCallback(this, arguments);
Clazz_instantialize(this, arguments);}, JM.AtomCollection, "AtomSorter", null, java.util.Comparator);
Clazz_overrideMethod(c$, "compare", 
function(a1, a2){
return (a1.i > a2.i ? 1 : a1.i < a2.i ? -1 : 0);
}, "JM.Atom,JM.Atom");
/*eoif4*/})();
};
c$.sqrt3_2 = Math.sqrt(3) / 2;
c$.vRef = JU.V3.new3(3.14159, 2.71828, 1.41421);
c$.userSettableValues = null;
});
;//5.0.1-v7 Mon Aug 24 10:01:38 CDT 2026
Clazz_declarePackage("JM");
Clazz_load(["J.api.AtomIndexIterator"], "JM.AtomIteratorWithinModel", ["J.atomdata.RadiusData"], function(){
var c$ = Clazz_decorateAsClass(function(){
this.cubeIterator = null;
this.bspf = null;
this.threadSafe = false;
this.hemisphereOnly = false;
this.isZeroBased = false;
this.modelIndex = 2147483647;
this.atomIndex = -1;
this.zeroBase = 0;
this.distanceSquared = 0;
this.bsSelected = null;
this.isGreaterOnly = false;
this.checkGreater = false;
this.radiusData = null;
this.vdw1 = 0;
this.isVdw = false;
this.atoms = null;
this.vwr = null;
this.iNext = 0;
Clazz_instantialize(this, arguments);}, JM, "AtomIteratorWithinModel", null, J.api.AtomIndexIterator);
/*LV!1824 unnec constructor*/Clazz_defineMethod(c$, "initialize", 
function(bspf, bsSelected, isGreaterOnly, isZeroBased, hemisphereOnly, threadSafe){
this.bspf = bspf;
this.bsSelected = bsSelected;
this.isGreaterOnly = isGreaterOnly;
this.isZeroBased = isZeroBased;
this.hemisphereOnly = hemisphereOnly;
this.threadSafe = threadSafe;
this.cubeIterator = null;
}, "J.bspt.Bspf,JU.BS,~B,~B,~B,~B");
Clazz_overrideMethod(c$, "setModel", 
function(modelSet, modelIndex, firstModelAtom, atomIndex, center, distance, rd){
if (this.threadSafe) modelIndex = -1 - modelIndex;
if (modelIndex != this.modelIndex || this.cubeIterator == null) {
this.cubeIterator = this.bspf.getCubeIterator(modelIndex);
this.modelIndex = modelIndex;
}this.zeroBase = (this.isZeroBased ? firstModelAtom : 0);
if (distance == -2147483648) return;
this.atomIndex = (distance < 0 ? -1 : atomIndex);
this.isVdw = (rd != null);
if (this.isVdw) {
this.radiusData = rd;
this.atoms = modelSet.at;
this.vwr = modelSet.vwr;
distance = (rd.factorType === J.atomdata.RadiusData.EnumType.OFFSET ? 5 + rd.value : 5 * rd.value);
this.vdw1 = this.atoms[atomIndex].getVanderwaalsRadiusFloat(this.vwr, rd.vdwType);
}this.checkGreater = (this.isGreaterOnly && atomIndex != 2147483647);
this.setCenter(center, distance);
}, "JM.ModelSet,~N,~N,~N,JU.T3,~N,J.atomdata.RadiusData");
Clazz_overrideMethod(c$, "setCenter", 
function(center, distance){
this.setCenter2(center, distance);
}, "JU.T3,~N");
Clazz_defineMethod(c$, "setCenter2", 
function(center, distance){
if (this.cubeIterator == null) return;
this.cubeIterator.initialize(center, distance, this.hemisphereOnly);
this.distanceSquared = distance * distance;
}, "JU.T3,~N");
Clazz_overrideMethod(c$, "hasNext", 
function(){
return this.hasNext2();
});
Clazz_defineMethod(c$, "hasNext2", 
function(){
if (this.atomIndex >= 0) while (this.cubeIterator.hasMoreElements()) {
var a = this.cubeIterator.nextElement();
if ((this.iNext = a.i) != this.atomIndex && (!this.checkGreater || this.iNext > this.atomIndex) && (this.bsSelected == null || this.bsSelected.get(this.iNext))) {
return true;
}}
 else if (this.cubeIterator.hasMoreElements()) {
var a = this.cubeIterator.nextElement();
this.iNext = a.i;
return true;
}this.iNext = -1;
return false;
});
Clazz_overrideMethod(c$, "next", 
function(){
return this.iNext - this.zeroBase;
});
Clazz_overrideMethod(c$, "foundDistance2", 
function(){
return (this.cubeIterator == null ? -1 : this.cubeIterator.foundDistance2());
});
Clazz_overrideMethod(c$, "addAtoms", 
function(bsResult){
var iAtom;
while (this.hasNext()) if ((iAtom = this.next()) >= 0) {
var d;
if (this.isVdw) {
d = this.atoms[iAtom].getVanderwaalsRadiusFloat(this.vwr, this.radiusData.vdwType) + this.vdw1;
switch (this.radiusData.factorType) {
case J.atomdata.RadiusData.EnumType.OFFSET:
d += this.radiusData.value * 2;
break;
case J.atomdata.RadiusData.EnumType.FACTOR:
d *= this.radiusData.value;
break;
}
d *= d;
} else {
d = this.distanceSquared;
}if (this.foundDistance2() <= d) bsResult.set(iAtom);
}
}, "JU.BS");
Clazz_overrideMethod(c$, "release", 
function(){
if (this.cubeIterator != null) {
this.cubeIterator.release();
this.cubeIterator = null;
}});
Clazz_overrideMethod(c$, "getPosition", 
function(){
return null;
});
});
;//5.0.1-v7 Mon Aug 24 10:01:38 CDT 2026
Clazz_declarePackage("JM");
Clazz_load(["JM.AtomIteratorWithinModel"], "JM.AtomIteratorWithinModelSet", null, function(){
var c$ = Clazz_decorateAsClass(function(){
this.bsModels = null;
this.center = null;
this.distance = 0;
Clazz_instantialize(this, arguments);}, JM, "AtomIteratorWithinModelSet", JM.AtomIteratorWithinModel);
Clazz_makeConstructor(c$, 
function(bsModels){
Clazz_superConstructor (this, JM.AtomIteratorWithinModelSet, []);
this.bsModels = bsModels;
}, "JU.BS");
Clazz_overrideMethod(c$, "setCenter", 
function(center, distance){
this.center = center;
this.distance = distance;
this.set(0);
}, "JU.T3,~N");
Clazz_defineMethod(c$, "set", 
function(iModel){
if ((this.modelIndex = this.bsModels.nextSetBit(iModel)) < 0 || (this.cubeIterator = this.bspf.getCubeIterator(this.modelIndex)) == null) return false;
this.setCenter2(this.center, this.distance);
return true;
}, "~N");
Clazz_overrideMethod(c$, "hasNext", 
function(){
if (this.hasNext2()) return true;
if (!this.set(this.modelIndex + 1)) return false;
return this.hasNext();
});
});
;//5.0.1-v7 Mon Aug 17 10:07:10 MDT 2026
Clazz_declarePackage("JM");
Clazz_load(["JU.Edge", "JV.JC"], "JM.Bond", ["JU.C"], function(){
var c$ = Clazz_decorateAsClass(function(){
this.atom1 = null;
this.atom2 = null;
this.mad = 0;
this.colix = 0;
this.shapeVisibilityFlags = 0;
Clazz_instantialize(this, arguments);}, JM, "Bond", JU.Edge);
Clazz_makeConstructor(c$, 
function(atom1, atom2, order, mad, colix){
Clazz_superConstructor (this, JM.Bond, []);
this.atom1 = atom1;
this.atom2 = atom2;
this.colix = colix;
this.setOrder(order);
this.setMad(mad);
}, "JM.Atom,JM.Atom,~N,~N,~N");
Clazz_defineMethod(c$, "setMad", 
function(mad){
this.mad = mad;
this.setShapeVisibility(mad != 0);
}, "~N");
Clazz_defineMethod(c$, "setShapeVisibility", 
function(isVisible){
var wasVisible = ((this.shapeVisibilityFlags & JM.Bond.myVisibilityFlag) != 0);
if (wasVisible == isVisible) return;
this.atom1.addDisplayedBond(JM.Bond.myVisibilityFlag, isVisible);
this.atom2.addDisplayedBond(JM.Bond.myVisibilityFlag, isVisible);
if (isVisible) this.shapeVisibilityFlags |= JM.Bond.myVisibilityFlag;
 else this.shapeVisibilityFlags &= ~JM.Bond.myVisibilityFlag;
}, "~B");
Clazz_defineMethod(c$, "getIdentity", 
function(){
return (this.index + 1) + " " + JU.Edge.getBondOrderNumberFromOrder(this.order) + " " + this.atom1.getInfo() + " -- " + this.atom2.getInfo() + " " + this.atom1.distance(this.atom2);
});
Clazz_overrideMethod(c$, "isCovalent", 
function(){
return (this.order & 1023) != 0;
});
Clazz_overrideMethod(c$, "isHydrogen", 
function(){
return JU.Edge.isOrderH(this.order);
});
Clazz_defineMethod(c$, "isAromatic", 
function(){
return (this.order & 512) != 0;
});
Clazz_defineMethod(c$, "getEnergy", 
function(){
return 0;
});
Clazz_defineMethod(c$, "getValence", 
function(){
return (!this.isCovalent() || this.order == 33 ? 0 : this.is(515) ? 1 : this.order & 7);
});
Clazz_defineMethod(c$, "deleteAtomReferences", 
function(){
if (this.atom1 != null) this.atom1.deleteBond(this);
if (this.atom2 != null) this.atom2.deleteBond(this);
this.atom1 = this.atom2 = null;
});
Clazz_defineMethod(c$, "setTranslucent", 
function(isTranslucent, translucentLevel){
this.colix = JU.C.getColixTranslucent3(this.colix, isTranslucent, translucentLevel);
}, "~B,~N");
Clazz_defineMethod(c$, "setOrder", 
function(order){
if (this.atom1.getElementNumber() == 16 && this.atom2.getElementNumber() == 16) order |= 256;
if (order == 512) order = 515;
this.order = order | (this.order & 131072);
}, "~N");
Clazz_overrideMethod(c$, "getAtomIndex1", 
function(){
return this.atom1.i;
});
Clazz_overrideMethod(c$, "getAtomIndex2", 
function(){
return this.atom2.i;
});
Clazz_overrideMethod(c$, "getCovalentOrder", 
function(){
return JU.Edge.getCovalentBondOrder(this.order);
});
Clazz_defineMethod(c$, "getOtherAtom", 
function(thisAtom){
return (this.atom1 === thisAtom ? this.atom2 : this.atom2 === thisAtom ? this.atom1 : null);
}, "JM.Atom");
Clazz_defineMethod(c$, "is", 
function(bondType){
return (this.order & 131071) == bondType;
}, "~N");
Clazz_overrideMethod(c$, "getOtherNode", 
function(thisAtom){
return (this.atom1 === thisAtom ? this.atom2 : this.atom2 === thisAtom || thisAtom == null ? this.atom1 : null);
}, "JU.SimpleNode");
Clazz_defineMethod(c$, "setAtropisomerOptions", 
function(){
if (this.getCovalentOrder() > 1) return false;
var i1;
var i2 = 2147483647;
var bonds = this.atom1.bonds;
for (i1 = 0; i1 < bonds.length; i1++) {
var a = bonds[i1].getOtherAtom(this.atom1);
if (a !== this.atom2) break;
}
if (i1 < bonds.length) {
bonds = this.atom2.bonds;
for (i2 = 0; i2 < bonds.length; i2++) {
var a = bonds[i2].getOtherAtom(this.atom2);
if (a !== this.atom1) break;
}
}if (i1 > 2 || i2 >= bonds.length || i2 > 2) {
return false;
}this.order = JU.Edge.getAtropismOrder(i1 + 1, i2 + 1);
return true;
});
Clazz_overrideMethod(c$, "getCIPChirality", 
function(doCalculate){
return "";
}, "~B");
Clazz_overrideMethod(c$, "setCIPChirality", 
function(c){
}, "~N");
Clazz_overrideMethod(c$, "toString", 
function(){
return this.atom1 + " - " + this.atom2;
});
Clazz_overrideMethod(c$, "getAtom", 
function(i){
return (i == 1 ? this.atom2 : this.atom1);
}, "~N");
Clazz_defineMethod(c$, "isCovalentNotPartial0", 
function(){
return ((this.order & 1023) != 0 && this.order != 33);
});
c$.myVisibilityFlag = JV.JC.getShapeVisibilityFlag(1);
});
;//5.0.1-v7 Mon Aug 17 10:07:10 MDT 2026
Clazz_declarePackage("JM");
Clazz_load(["JM.AtomCollection", "JU.V3"], "JM.BondCollection", ["JU.AU", "$.BS", "$.Measure", "JM.Bond", "$.BondIteratorSelected", "$.BondSet", "$.HBond", "JU.C", "$.Edge"], function(){
var c$ = Clazz_decorateAsClass(function(){
this.bo = null;
this.bondCount = 0;
this.numCached = null;
this.freeBonds = null;
this.molecules = null;
this.moleculeCount = 0;
this.defaultCovalentMad = 0;
this.bsAromaticSingle = null;
this.bsAromaticDouble = null;
this.bsAromatic = null;
this.haveHiddenBonds = false;
this.v1 = null;
this.v2 = null;
this.haveAtropicBonds = false;
Clazz_instantialize(this, arguments);}, JM, "BondCollection", JM.AtomCollection);
Clazz_prepareFields (c$, function(){
this.v1 =  new JU.V3();
this.v2 =  new JU.V3();
});
Clazz_defineMethod(c$, "setupBC", 
function(){
this.bsAromatic =  new JU.BS();
this.numCached =  Clazz_newIntArray (5, 0);
this.freeBonds =  new Array(5);
for (var i = 5; --i > 0; ) this.freeBonds[i] =  new Array(200);

this.setupAC();
});
Clazz_defineMethod(c$, "releaseModelSetBC", 
function(){
this.bo = null;
this.freeBonds = null;
this.releaseModelSetAC();
});
Clazz_defineMethod(c$, "getBondIteratorForType", 
function(bondType, bsAtoms){
return  new JM.BondIteratorSelected(this.bo, this.bondCount, bondType, bsAtoms, this.vwr.getBoolean(603979812));
}, "~N,JU.BS");
Clazz_defineMethod(c$, "getBondIterator", 
function(bsBonds){
return  new JM.BondIteratorSelected(this.bo, this.bondCount, 131071, bsBonds, false);
}, "JU.BS");
Clazz_defineMethod(c$, "getBondColix1", 
function(i){
return JU.C.getColixInherited(this.bo[i].colix, this.bo[i].atom1.colixAtom);
}, "~N");
Clazz_defineMethod(c$, "getBondColix2", 
function(i){
return JU.C.getColixInherited(this.bo[i].colix, this.bo[i].atom2.colixAtom);
}, "~N");
Clazz_defineMethod(c$, "getBondCountInModel", 
function(modelIndex){
var n = 0;
for (var i = this.bondCount; --i >= 0; ) if (this.bo[i] != null && this.bo[i].atom1.mi == modelIndex) n++;

return n;
}, "~N");
Clazz_defineMethod(c$, "getBondsForSelectedAtoms", 
function(bsAtoms, bondSelectionModeOr){
var bs =  new JU.BS();
var n = bsAtoms.cardinality();
switch (n) {
case 0:
return bs;
case 1:
case 2:
var a = this.at[bsAtoms.nextSetBit(0)];
var b = (n == 2 ? this.at[bsAtoms.nextSetBit(a.i + 1)] : null);
if (n == 1 || bondSelectionModeOr) {
for (var i = a.getBondCount(); --i >= 0; ) bs.set(a.bonds[i].index);

if (b != null) for (var i = b.getBondCount(); --i >= 0; ) bs.set(b.bonds[i].index);

} else {
var bond = a.getBond(b);
if (bond != null) bs.set(bond.index);
}return bs;
}
for (var iBond = 0; iBond < this.bondCount; ++iBond) {
var bond = this.bo[iBond];
if (bond == null) continue;
var isSelected1 = bsAtoms.get(bond.atom1.i);
var isSelected2 = bsAtoms.get(bond.atom2.i);
if (bondSelectionModeOr ? isSelected1 || isSelected2 : isSelected1 && isSelected2) bs.set(iBond);
}
return bs;
}, "JU.BS,~B");
Clazz_defineMethod(c$, "bondAtoms", 
function(atom1, atom2, order, mad, bsBonds, energy, addGroup, isNew){
var bond = this.getOrAddBond(atom1, atom2, order, mad, bsBonds, energy, true);
if (isNew) {
bond.order |= 131072;
if (addGroup) {
atom1.group = atom2.group;
atom1.group.addAtoms(atom1.i);
}}return bond;
}, "JM.Atom,JM.Atom,~N,~N,JU.BS,~N,~B,~B");
Clazz_defineMethod(c$, "getOrAddBond", 
function(atom, atomOther, order, mad, bsBonds, energy, overrideBonding){
var i;
if (order == 131071 || order == 65535) order = 1;
if (atom.isBonded(atomOther)) {
i = atom.getBond(atomOther).index;
if (overrideBonding) {
this.bo[i].setOrder(order);
this.bo[i].setMad(mad);
if (Clazz_instanceOf(this.bo[i],"JM.HBond")) (this.bo[i]).energy = energy;
}} else {
if (this.bondCount == this.bo.length) this.bo = JU.AU.arrayCopyObject(this.bo, this.bondCount + 250);
i = this.setBond(this.bondCount++, this.bondMutually(atom, atomOther, order, mad, energy)).index;
}if (bsBonds != null) bsBonds.set(i);
return this.bo[i];
}, "JM.Atom,JM.Atom,~N,~N,JU.BS,~N,~B");
Clazz_defineMethod(c$, "setBond", 
function(index, bond){
return this.bo[bond.index = index] = bond;
}, "~N,JM.Bond");
Clazz_defineMethod(c$, "bondMutually", 
function(atom, atomOther, order, mad, energy){
var bond;
if (JU.Edge.isOrderH(order)) {
bond =  new JM.HBond(atom, atomOther, order, mad, 0, energy);
} else {
bond =  new JM.Bond(atom, atomOther, order, mad, 0);
}this.addBondToAtom(atom, bond);
this.addBondToAtom(atomOther, bond);
return bond;
}, "JM.Atom,JM.Atom,~N,~N,~N");
Clazz_defineMethod(c$, "addBondToAtom", 
function(atom, bond){
if (atom.bonds == null) {
atom.bonds =  new Array(1);
atom.bonds[0] = bond;
} else {
atom.bonds = this.addToBonds(bond, atom.bonds);
}}, "JM.Atom,JM.Bond");
Clazz_defineMethod(c$, "addToBonds", 
function(newBond, oldBonds){
var newBonds;
if (oldBonds == null) {
if (this.numCached[1] > 0) newBonds = this.freeBonds[1][--this.numCached[1]];
 else newBonds =  new Array(1);
newBonds[0] = newBond;
} else {
var oldLength = oldBonds.length;
var newLength = oldLength + 1;
if (newLength < 5 && this.numCached[newLength] > 0) newBonds = this.freeBonds[newLength][--this.numCached[newLength]];
 else newBonds =  new Array(newLength);
newBonds[oldLength] = newBond;
for (var i = oldLength; --i >= 0; ) newBonds[i] = oldBonds[i];

if (oldLength < 5 && this.numCached[oldLength] < 200) this.freeBonds[oldLength][this.numCached[oldLength]++] = oldBonds;
}return newBonds;
}, "JM.Bond,~A");
Clazz_defineMethod(c$, "addHBond", 
function(atom1, atom2, order, energy){
if (this.bondCount == this.bo.length) this.bo = JU.AU.arrayCopyObject(this.bo, this.bondCount + 250);
return this.setBond(this.bondCount++, this.bondMutually(atom1, atom2, order, 1, energy)).index;
}, "JM.Atom,JM.Atom,~N,~N");
Clazz_defineMethod(c$, "deleteAllBonds2", 
function(){
this.vwr.setShapeProperty(1, "reset", null);
for (var i = this.bondCount; --i >= 0; ) {
if (this.bo[i] == null) continue;
this.bo[i].deleteAtomReferences();
this.bo[i] = null;
}
this.bondCount = 0;
});
Clazz_defineMethod(c$, "getDefaultMadFromOrder", 
function(order){
return (JU.Edge.isOrderH(order) ? 1 : order == 32768 ? Clazz_doubleToInt(Math.floor(this.vwr.getFloat(570425406) * 2000)) : this.defaultCovalentMad);
}, "~N");
Clazz_defineMethod(c$, "deleteConnections", 
function(minD, maxD, order, bsA, bsB, isBonds, matchNull){
var minDIsFraction = (minD < 0);
var maxDIsFraction = (maxD < 0);
var isFractional = (minDIsFraction || maxDIsFraction);
minD = this.fixD(minD, minDIsFraction);
maxD = this.fixD(maxD, maxDIsFraction);
var bsDelete =  new JU.BS();
var nDeleted = 0;
var newOrder = order |= 131072;
if (!matchNull && JU.Edge.isOrderH(order)) order = 30720;
var bsBonds;
if (isBonds) {
bsBonds = bsA;
} else {
bsBonds =  new JU.BS();
for (var i = bsA.nextSetBit(0); i >= 0; i = bsA.nextSetBit(i + 1)) {
var a = this.at[i];
if (a.bonds != null) for (var j = a.bonds.length; --j >= 0; ) if (bsB.get(a.getBondedAtomIndex(j))) bsBonds.set(a.bonds[j].index);

}
}for (var i = bsBonds.nextSetBit(0); i < this.bondCount && i >= 0; i = bsBonds.nextSetBit(i + 1)) {
var bond = this.bo[i];
if (bond == null || !this.isInRange(bond.atom1, bond.atom2, minD, maxD, minDIsFraction, maxDIsFraction, isFractional)) continue;
if (matchNull || newOrder == (bond.order & -257 | 131072) || (order & bond.order & 30720) != 0) {
bsDelete.set(i);
nDeleted++;
}}
if (nDeleted > 0) (this).deleteBonds(bsDelete, false);
return  Clazz_newIntArray(-1, [0, nDeleted]);
}, "~N,~N,~N,JU.BS,JU.BS,~B,~B");
Clazz_defineMethod(c$, "fixD", 
function(d, isF){
return (isF ? -d : d * d);
}, "~N,~B");
Clazz_defineMethod(c$, "isInRange", 
function(atom1, atom2, minD, maxD, minFrac, maxfrac, isFractional){
var d2 = atom1.distanceSquared(atom2);
if (isFractional) {
var dAB = Math.sqrt(d2);
var dABcalc = atom1.getBondingRadius() + atom2.getBondingRadius();
return ((minFrac ? dAB >= dABcalc * minD : d2 >= minD) && (maxfrac ? dAB <= dABcalc * maxD : d2 <= maxD));
}return (d2 >= minD && d2 <= maxD);
}, "JM.Atom,JM.Atom,~N,~N,~B,~B,~B");
Clazz_defineMethod(c$, "dBb", 
function(bsBond, isFullModel){
var n = bsBond.cardinality();
if (n == 0) return;
(this).resetMolecules();
var modelIndexLast = -1;
for (var i = bsBond.nextSetBit(0); i >= 0 && i < this.bondCount; i = bsBond.nextSetBit(i + 1)) {
var bond = this.bo[i];
if (bond != null && bsBond.get(i)) {
if (!isFullModel) {
var modelIndex = bond.atom1.mi;
if (modelIndex != modelIndexLast) (this).am[modelIndexLast = modelIndex].resetBoundCount();
}bond.deleteAtomReferences();
this.bo[i] = null;
}}
var sets = this.vwr.getShapeProperty(1, "sets");
if (sets != null) for (var i = 0; i < sets.length; i++) if (sets[i] != null) sets[i].andNot(bsBond);

this.bsAromatic.andNot(bsBond);
}, "JU.BS,~B");
Clazz_defineMethod(c$, "resetAromatic", 
function(){
for (var i = this.bondCount; --i >= 0; ) {
var bond = this.bo[i];
if (bond != null && bond.isAromatic()) bond.setOrder(515);
}
});
Clazz_defineMethod(c$, "assignAromaticBondsBs", 
function(isUserCalculation, bsBonds){
if (!isUserCalculation) this.bsAromatic =  new JU.BS();
this.bsAromaticSingle =  new JU.BS();
this.bsAromaticDouble =  new JU.BS();
var isAll = (bsBonds == null);
var i0 = (isAll ? this.bondCount - 1 : bsBonds.nextSetBit(0));
for (var i = i0; i >= 0; i = (isAll ? i - 1 : bsBonds.nextSetBit(i + 1))) {
var bond = this.bo[i];
if (bond == null) continue;
if (this.bsAromatic.get(i)) bond.setOrder(515);
switch (bond.order & 131071) {
case 515:
if (!this.assignAromaticMustBeSingle(bond.atom1) && !this.assignAromaticMustBeSingle(bond.atom2)) {
this.bsAromatic.set(i);
break;
}bond.order = 513;
case 513:
this.bsAromaticSingle.set(i);
break;
case 514:
this.bsAromaticDouble.set(i);
break;
}
}
var bond;
isAll = (bsBonds == null);
i0 = (isAll ? this.bondCount - 1 : bsBonds.nextSetBit(0));
var bsTest =  new JU.BS();
for (var i = i0; i >= 0; i = (isAll ? i - 1 : bsBonds.nextSetBit(i + 1))) {
bond = this.bo[i];
if (bond == null || !bond.is(515) || this.bsAromaticDouble.get(i) || this.bsAromaticSingle.get(i)) continue;
bsTest.set(i);
if (bond.atom1.getElementNumber() == 8 || bond.atom2.getElementNumber() == 8) {
if (!this.assignAromaticDouble(bond)) this.assignAromaticSingle(bond);
}}
for (var i = bsTest.nextSetBit(0); i >= 0; i = bsTest.nextSetBit(i + 1)) if (!this.assignAromaticDouble(bond = this.bo[i])) this.assignAromaticSingle(bond);

var bsModels =  new JU.BS();
for (var i = i0; i >= 0; i = (isAll ? i - 1 : bsBonds.nextSetBit(i + 1))) {
bond = this.bo[i];
if (bond == null) continue;
if (this.bsAromaticDouble.get(i)) {
if (!bond.is(514)) {
this.bsAromatic.set(i);
bsModels.set(bond.atom1.mi);
bond.setOrder(this.isLinear(bond, this.v1, this.v2) ? 3 : 514);
}} else if (this.bsAromaticSingle.get(i) || bond.isAromatic()) {
if (!bond.is(513)) {
this.bsAromatic.set(i);
bond.setOrder(513);
}}}
var models = (this).am;
for (var i = bsModels.nextSetBit(0); i >= 0; i = bsModels.nextSetBit(i + 1)) if (models[i].isBioModel) models[i].isPdbWithMultipleBonds = true;

this.assignAromaticNandO(bsBonds);
this.bsAromaticSingle = null;
this.bsAromaticDouble = null;
}, "~B,JU.BS");
Clazz_defineMethod(c$, "isLinear", 
function(b, v1, v2){
if (b.order == 3) return true;
if (b.atom1.getCovalentBondCount() != 2 || b.atom2.getCovalentBondCount() != 2) return false;
var edges = b.atom1.getEdges();
for (var i = edges.length; -i >= 0; ) {
if (edges[i] !== b && edges[i].isCovalent()) {
if (JU.Measure.computeAngle(edges[i].getOtherNode(b.atom1), b.atom1, b.atom2, v1, v2, true) < 175) return false;
break;
}}
edges = b.atom2.getEdges();
for (var i = edges.length; -i >= 0; ) {
if (edges[i] !== b && edges[i].isCovalent()) {
if (JU.Measure.computeAngle(edges[i].getOtherNode(b.atom2), b.atom2, b.atom1, v1, v2, true) < 175) return false;
break;
}}
return true;
}, "JM.Bond,JU.V3,JU.V3");
Clazz_defineMethod(c$, "assignAromaticDouble", 
function(bond){
var bondIndex = bond.index;
if (this.bsAromaticSingle.get(bondIndex)) return false;
if (this.bsAromaticDouble.get(bondIndex)) return true;
this.bsAromaticDouble.set(bondIndex);
if (!this.assignAromaticSingleForAtom(bond.atom1, bondIndex) || !this.assignAromaticSingleForAtom(bond.atom2, bondIndex)) {
this.bsAromaticDouble.clear(bondIndex);
return false;
}return true;
}, "JM.Bond");
Clazz_defineMethod(c$, "assignAromaticSingle", 
function(bond){
var bondIndex = bond.index;
if (this.bsAromaticDouble.get(bondIndex)) return false;
if (this.bsAromaticSingle.get(bondIndex)) return true;
this.bsAromaticSingle.set(bondIndex);
if (!this.assignAromaticDoubleForAtom(bond.atom1) || !this.assignAromaticDoubleForAtom(bond.atom2)) {
this.bsAromaticSingle.clear(bondIndex);
return false;
}return true;
}, "JM.Bond");
Clazz_defineMethod(c$, "assignAromaticSingleForAtom", 
function(atom, notBondIndex){
var bonds = atom.bonds;
if (bonds == null) return false;
for (var i = bonds.length; --i >= 0; ) {
var bond = bonds[i];
var bondIndex = bond.index;
if (bondIndex == notBondIndex || !bond.isAromatic() || this.bsAromaticSingle.get(bondIndex)) continue;
if (this.bsAromaticDouble.get(bondIndex) || !this.assignAromaticSingle(bond)) {
return false;
}}
return true;
}, "JM.Atom,~N");
Clazz_defineMethod(c$, "assignAromaticDoubleForAtom", 
function(atom){
var bonds = atom.bonds;
if (bonds == null) return false;
var haveDouble = false;
var lastBond = -1;
for (var i = bonds.length; --i >= 0; ) {
if (this.bsAromaticDouble.get(bonds[i].index)) haveDouble = true;
if (bonds[i].isAromatic()) lastBond = i;
}
for (var i = bonds.length; --i >= 0; ) {
var bond = bonds[i];
var bondIndex = bond.index;
if (!bond.isAromatic() || this.bsAromaticDouble.get(bondIndex) || this.bsAromaticSingle.get(bondIndex)) continue;
if (!haveDouble && this.assignAromaticDouble(bond)) haveDouble = true;
 else if ((haveDouble || i < lastBond) && !this.assignAromaticSingle(bond)) {
return false;
}}
return haveDouble;
}, "JM.Atom");
Clazz_defineMethod(c$, "allowAromaticBond", 
function(b){
if (this.assignAromaticMustBeSingle(b.atom1) || this.assignAromaticMustBeSingle(b.atom2)) return false;
switch (b.getCovalentOrder()) {
case 1:
case 2:
return b.atom1.getCovalentBondCount() <= 3 && b.atom2.getCovalentBondCount() <= 3;
default:
return false;
}
}, "JM.Bond");
Clazz_defineMethod(c$, "assignAromaticMustBeSingle", 
function(atom){
var n = atom.getElementNumber();
switch (n) {
case 6:
case 7:
case 8:
case 16:
break;
default:
return true;
}
var valence = atom.getValenceAromatic(false);
switch (n) {
case 6:
return (valence == 4);
case 7:
return (atom.group.getNitrogenAtom() === atom || valence == 3 && atom.getFormalCharge() < 1);
case 8:
return (atom.group.getCarbonylOxygenAtom() !== atom && valence == 2 && atom.getFormalCharge() < 1);
case 16:
return (atom.group.groupID == 5 || valence == 2 && atom.getFormalCharge() < 1);
}
return false;
}, "JM.Atom");
Clazz_defineMethod(c$, "assignAromaticNandO", 
function(bsSelected){
var bond;
var isAll = (bsSelected == null);
var i0 = (isAll ? this.bondCount - 1 : bsSelected.nextSetBit(0));
for (var i = i0; i >= 0; i = (isAll ? i - 1 : bsSelected.nextSetBit(i + 1))) {
bond = this.bo[i];
if (bond == null || !bond.is(513)) continue;
var atom1;
var atom2 = bond.atom2;
var n1;
var n2 = atom2.getElementNumber();
if (n2 == 7 || n2 == 8) {
n1 = n2;
atom1 = atom2;
atom2 = bond.atom1;
n2 = atom2.getElementNumber();
} else {
atom1 = bond.atom1;
n1 = atom1.getElementNumber();
}if (n1 != 7 && n1 != 8) continue;
var valence = atom1.getValence();
if (valence < 0) continue;
var bondorder = atom1.getCovalentBondCount();
var charge = atom1.getFormalCharge();
switch (n1) {
case 7:
if (valence == 3 && bondorder == 3 && charge < 1 && n2 == 6 && atom2.getValence() == 3) bond.setOrder(514);
break;
case 8:
if (valence == 1 && charge == 0 && (n2 == 14 || n2 == 16)) bond.setOrder(514);
break;
}
}
}, "JU.BS");
Clazz_defineMethod(c$, "getAtomBitsMDb", 
function(tokType, specInfo){
var bs =  new JU.BS();
switch (tokType) {
default:
return this.getAtomBitsMDa(tokType, specInfo, bs);
case 1677721602:
var bsBonds = specInfo;
for (var i = bsBonds.nextSetBit(0); i >= 0; i = bsBonds.nextSetBit(i + 1)) {
if (i < this.bondCount) {
if (this.bo[i] != null) {
bs.set(this.bo[i].atom1.i);
bs.set(this.bo[i].atom2.i);
continue;
}}bsBonds.clear(i);
}
return bs;
case 1073742331:
for (var i = this.bondCount; --i >= 0; ) if (this.bo[i] != null && this.bo[i].isAromatic()) {
bs.set(this.bo[i].atom1.i);
bs.set(this.bo[i].atom2.i);
}
return bs;
}
}, "~N,~O");
Clazz_defineMethod(c$, "removeUnnecessaryBonds", 
function(atom, deleteAtom){
var bs =  new JU.BS();
var bsBonds =  new JU.BS();
var bonds = atom.bonds;
if (bonds == null) return;
for (var i = 0; i < bonds.length; i++) if (bonds[i].isCovalent()) {
var atom2 = bonds[i].getOtherAtom(atom);
if (atom2.getElementNumber() == 1) bs.set(bonds[i].getOtherAtom(atom).i);
} else {
bsBonds.set(bonds[i].index);
}
if (bsBonds.nextSetBit(0) >= 0) (this).deleteBonds(bsBonds, false);
if (deleteAtom) bs.set(atom.i);
if (bs.nextSetBit(0) >= 0) this.vwr.deleteAtoms(bs, false);
}, "JM.Atom,~B");
Clazz_defineMethod(c$, "displayBonds", 
function(bs, isDisplay){
if (!isDisplay) this.haveHiddenBonds = true;
for (var i = bs.nextSetBit(0); i >= 0; i = bs.nextSetBit(i + 1)) if (i < this.bondCount && this.bo[i] != null && this.bo[i].mad != 0) this.bo[i].setShapeVisibility(isDisplay);

}, "JM.BondSet,~B");
Clazz_defineMethod(c$, "getAtomsConnected", 
function(min, max, intType, bs){
var isBonds = Clazz_instanceOf(bs,"JM.BondSet");
var bsResult = (isBonds ?  new JM.BondSet() :  new JU.BS());
var nBonded =  Clazz_newIntArray (this.ac, 0);
var i;
var ishbond = (intType == 30720);
var isall = (intType == 65535);
for (var ibond = 0; ibond < this.bondCount; ibond++) {
var bond = this.bo[ibond];
if (bond != null && (isall || bond.is(intType) || ishbond && bond.isHydrogen())) {
if (isBonds) {
bsResult.set(ibond);
} else {
if (bs.get(bond.atom1.i)) {
nBonded[i = bond.atom2.i]++;
bsResult.set(i);
}if (bs.get(bond.atom2.i)) {
nBonded[i = bond.atom1.i]++;
bsResult.set(i);
}}}}
if (isBonds) return bsResult;
var nonbonded = (min == 0);
for (i = this.ac; --i >= 0; ) {
var n = nBonded[i];
if (this.at[i] == null || n < min || n > max) bsResult.clear(i);
 else if (nonbonded && n == 0) bsResult.set(i);
}
return bsResult;
}, "~N,~N,~N,JU.BS");
Clazz_defineMethod(c$, "addConnectedHAtoms", 
function(atom, bsAtoms){
if (atom.bonds != null) for (var i = atom.bonds.length; --i >= 0; ) {
var atom2 = atom.bonds[i].getOtherAtom(atom);
if (atom2.getElementNumber() == 1) bsAtoms.set(atom2.i);
}
}, "JM.Atom,JU.BS");
});
;//5.0.1-v7 Mon Aug 24 10:01:38 CDT 2026
Clazz_declarePackage("JM");
Clazz_declareInterface(JM, "BondIterator");
;//5.0.1-v7 Mon Aug 17 10:07:10 MDT 2026
Clazz_declarePackage("JM");
Clazz_load(["JM.BondIterator"], "JM.BondIteratorSelected", null, function(){
var c$ = Clazz_decorateAsClass(function(){
this.bonds = null;
this.bondCount = 0;
this.bondType = 0;
this.iBond = 0;
this.bsSelected = null;
this.bondSelectionModeOr = false;
Clazz_instantialize(this, arguments);}, JM, "BondIteratorSelected", null, JM.BondIterator);
Clazz_makeConstructor(c$, 
function(bonds, bondCount, bondType, bsSelected, bondSelectionModeOr){
this.bonds = bonds;
this.bondCount = bondCount;
this.bondType = bondType;
this.bsSelected = bsSelected;
this.bondSelectionModeOr = bondSelectionModeOr;
}, "~A,~N,~N,JU.BS,~B");
Clazz_overrideMethod(c$, "hasNext", 
function(){
if (this.bondType == 131071) {
this.iBond = this.bsSelected.nextSetBit(this.iBond);
return (this.iBond >= 0 && this.iBond < this.bondCount);
}for (; this.iBond < this.bondCount; ++this.iBond) {
var bond = this.bonds[this.iBond];
if (bond == null || this.bondType != 65535 && (bond.order & this.bondType) == 0) {
continue;
} else if (this.bondType == 65535 && bond.order == 32768) continue;
var isSelected1 = this.bsSelected.get(bond.atom1.i);
var isSelected2 = this.bsSelected.get(bond.atom2.i);
if ((!this.bondSelectionModeOr && isSelected1 && isSelected2) || (this.bondSelectionModeOr && (isSelected1 || isSelected2))) return true;
}
return false;
});
Clazz_overrideMethod(c$, "nextIndex", 
function(){
return this.iBond;
});
Clazz_overrideMethod(c$, "next", 
function(){
return this.bonds[this.iBond++];
});
});
;//5.0.1-v7 Mon Aug 17 10:07:10 MDT 2026
Clazz_declarePackage("JM");
Clazz_load(["JU.BS"], "JM.BondSet", ["JU.BSUtil"], function(){
var c$ = Clazz_decorateAsClass(function(){
this.associatedAtoms = null;
Clazz_instantialize(this, arguments);}, JM, "BondSet", JU.BS);
Clazz_makeConstructor(c$, 
function(){
Clazz_superConstructor (this, JM.BondSet, []);
});
c$.newBS = Clazz_defineMethod(c$, "newBS", 
function(bs){
var b =  new JM.BondSet();
JU.BSUtil.copy2(bs, b);
return b;
}, "JU.BS");
Clazz_defineMethod(c$, "getAssociatedAtoms", 
function(ms){
if (this.associatedAtoms == null) this.associatedAtoms = ms.getAtomIndices(ms.getAtoms(1677721602, this));
return this.associatedAtoms;
}, "JM.ModelSet");
});
;//5.0.1-v7 Mon Aug 24 09:54:36 CDT 2026
Clazz_declarePackage("JM");
Clazz_load(["JM.Structure"], "JM.Chain", ["JU.AU"], function(){
var c$ = Clazz_decorateAsClass(function(){
this.model = null;
this.chainID = 0;
this.chainNo = 0;
this.groups = null;
this.groupCount = 0;
this.selectedGroupCount = 0;
Clazz_instantialize(this, arguments);}, JM, "Chain", null, JM.Structure);
Clazz_makeConstructor(c$, 
function(model, chainID, chainNo){
this.model = model;
this.chainID = chainID;
this.chainNo = chainNo;
this.groups =  new Array(16);
}, "JM.Model,~N,~N");
Clazz_defineMethod(c$, "getIDStr", 
function(){
return (this.chainID == 0 ? "" : this.chainID < 256 ? "" + String.fromCharCode(this.chainID) : this.model.ms.vwr.getChainIDStr(this.chainID));
});
Clazz_defineMethod(c$, "calcSelectedGroupsCount", 
function(bsSelected){
this.selectedGroupCount = 0;
for (var i = 0; i < this.groupCount; i++) this.groups[i].selectedIndex = (this.groups[i].isSelected(bsSelected) ? this.selectedGroupCount++ : -1);

}, "JU.BS");
Clazz_defineMethod(c$, "fixIndices", 
function(atomsDeleted, bsDeleted){
for (var i = 0; i < this.groupCount; i++) this.groups[i].fixIndices(atomsDeleted, bsDeleted);

}, "~N,JU.BS");
Clazz_overrideMethod(c$, "setAtomBits", 
function(bs){
for (var i = 0; i < this.groupCount; i++) this.groups[i].setAtomBits(bs);

}, "JU.BS");
Clazz_overrideMethod(c$, "setAtomBitsAndClear", 
function(bs, bsOut){
for (var i = 0; i < this.groupCount; i++) this.groups[i].setAtomBitsAndClear(bs, bsOut);

}, "JU.BS,JU.BS");
Clazz_defineMethod(c$, "addGroup", 
function(group, groupIndex){
if (this.groupCount == this.groups.length) this.groups = JU.AU.doubleLength(this.groups);
this.groups[this.groupCount++] = group;
group.groupIndex = groupIndex;
return group;
}, "JM.Group,~N");
});
;//5.0.1-v7 Mon Aug 24 10:01:38 CDT 2026
Clazz_declarePackage("JM");
Clazz_load(["JM.Structure", "java.lang.Short", "JV.JC"], "JM.Group", ["java.util.Hashtable", "JU.BS", "$.Quat", "J.c.STR", "JU.BSUtil", "$.Escape", "$.Logger", "$.Point3fi"], function(){
var c$ = Clazz_decorateAsClass(function(){
this.chain = null;
this.groupIndex = 0;
this.group1 = '\0';
this.firstAtomIndex = -1;
this.leadAtomIndex = -1;
this.lastAtomIndex = 0;
this.bsAdded = null;
this.seqcode = 0;
this.groupID = 0;
this.selectedIndex = 0;
this.shapeVisibilityFlags = 0;
this.dssrNT = null;
this.strutPoint = null;
this.unitID = null;
Clazz_instantialize(this, arguments);}, JM, "Group", null, JM.Structure);
/*LV!1824 unnec constructor*/Clazz_defineMethod(c$, "setGroup", 
function(chain, group3, seqcode, firstAtomIndex, lastAtomIndex){
this.chain = chain;
this.seqcode = seqcode;
this.firstAtomIndex = firstAtomIndex;
this.lastAtomIndex = lastAtomIndex;
if (group3 != null && group3.length > 0) this.setGroupID(group3);
return this;
}, "JM.Chain,~S,~N,~N,~N");
Clazz_defineMethod(c$, "setGroupID", 
function(group3){
}, "~S");
Clazz_defineMethod(c$, "isAdded", 
function(atomIndex){
return this.bsAdded != null && this.bsAdded.get(atomIndex);
}, "~N");
Clazz_defineMethod(c$, "addAtoms", 
function(atomIndex){
if (this.bsAdded == null) this.bsAdded =  new JU.BS();
this.bsAdded.set(atomIndex);
}, "~N");
Clazz_overrideMethod(c$, "setAtomBits", 
function(bs){
bs.setBits(this.firstAtomIndex, this.lastAtomIndex + 1);
if (this.bsAdded != null) bs.or(this.bsAdded);
}, "JU.BS");
Clazz_overrideMethod(c$, "setAtomBitsAndClear", 
function(bs, bsOut){
bs.setBits(this.firstAtomIndex, this.lastAtomIndex + 1);
bsOut.clearBits(this.firstAtomIndex, this.lastAtomIndex + 1);
if (this.bsAdded != null) {
bs.or(this.bsAdded);
bsOut.andNot(this.bsAdded);
}}, "JU.BS,JU.BS");
Clazz_defineMethod(c$, "isSelected", 
function(bs){
var pt = bs.nextSetBit(this.firstAtomIndex);
return (pt >= 0 && pt <= this.lastAtomIndex || this.bsAdded != null && this.bsAdded.intersects(bs));
}, "JU.BS");
Clazz_defineMethod(c$, "setShapeVisibility", 
function(visFlag, isVisible){
if (isVisible) {
this.shapeVisibilityFlags |= visFlag;
} else {
this.shapeVisibilityFlags &= ~visFlag;
}}, "~N,~B");
Clazz_defineMethod(c$, "getGroup3", 
function(){
return (this.groupID < 1 ? "" : JM.Group.group3Names[this.groupID]);
});
Clazz_defineMethod(c$, "getGroup1", 
function(){
return (this.group1 == '\0' ? '?' : this.group1);
});
Clazz_defineMethod(c$, "getBioPolymerLength", 
function(){
return 0;
});
Clazz_defineMethod(c$, "getMonomerIndex", 
function(){
return -1;
});
Clazz_defineMethod(c$, "getStructure", 
function(){
return null;
});
Clazz_defineMethod(c$, "getStrucNo", 
function(){
return 0;
});
Clazz_defineMethod(c$, "getBioStructureType", 
function(){
return J.c.STR.NOT;
});
Clazz_defineMethod(c$, "getBioStructureSubType", 
function(type){
return this.getBioStructureType();
}, "~N");
Clazz_defineMethod(c$, "setDSSRStructureSubType", 
function(type){
}, "J.c.STR");
Clazz_defineMethod(c$, "setProteinStructureType", 
function(type, monomerIndexCurrent){
return -1;
}, "J.c.STR,~N");
Clazz_defineMethod(c$, "isProtein", 
function(){
return (this.groupID >= 1 && this.groupID < 24);
});
Clazz_defineMethod(c$, "isNucleic", 
function(){
return (this.groupID >= 24 && this.groupID < 42);
});
Clazz_defineMethod(c$, "isDna", 
function(){
return this.isDnaByID();
});
Clazz_defineMethod(c$, "isRna", 
function(){
return this.isRnaByID();
});
Clazz_defineMethod(c$, "isPurine", 
function(){
return this.isPurineByID();
});
Clazz_defineMethod(c$, "isPurineByID", 
function(){
return (this.isNucleic() && ((153957 & (1 << (this.groupID - 24))) != 0) || "AGag".indexOf(this.getGroup1()) >= 0);
});
Clazz_defineMethod(c$, "isPyrimidine", 
function(){
return this.isPyrimidineByID();
});
Clazz_defineMethod(c$, "isPyrimidineByID", 
function(){
return (this.isNucleic() && (108186 & (1 << (this.groupID - 24))) != 0);
});
Clazz_defineMethod(c$, "isRnaByID", 
function(){
return (this.isNucleic() && (196663 & (1 << (this.groupID - 24))) != 0);
});
Clazz_defineMethod(c$, "isDnaByID", 
function(){
return (this.isNucleic() && (65480 & (1 << (this.groupID - 24))) != 0);
});
Clazz_defineMethod(c$, "isCarbohydrate", 
function(){
return false;
});
Clazz_defineMethod(c$, "getResno", 
function(){
return (this.seqcode == -2147483648 ? 0 : this.seqcode >> 8);
});
Clazz_defineMethod(c$, "setResno", 
function(i){
this.seqcode = JM.Group.getSeqcodeFor(i, this.getInsertionCode());
}, "~N");
c$.getSeqNumberFor = Clazz_defineMethod(c$, "getSeqNumberFor", 
function(seqcode){
return (JM.Group.haveSequenceNumber(seqcode) ? seqcode >> 8 : 2147483647);
}, "~N");
c$.haveSequenceNumber = Clazz_defineMethod(c$, "haveSequenceNumber", 
function(seqcode){
return ((seqcode & 128) != 0);
}, "~N");
Clazz_defineMethod(c$, "getSeqcodeString", 
function(){
return JM.Group.getSeqcodeStringFor(this.seqcode);
});
c$.getSeqcodeFor = Clazz_defineMethod(c$, "getSeqcodeFor", 
function(seqNo, insCode){
if (seqNo == -2147483648) return seqNo;
if (!((insCode >= 'A' && insCode <= 'Z') || (insCode >= 'a' && insCode <= 'z') || (insCode >= '0' && insCode <= '9') || insCode == '?' || insCode == '*')) {
if (insCode != ' ' && insCode != '\0') JU.Logger.warn("unrecognized insertionCode:" + insCode);
insCode = '\0';
}return ((seqNo == 2147483647 ? 0 : (seqNo << 8) | 128)) + insCode.charCodeAt(0);
}, "~N,~S");
c$.getSeqcodeStringFor = Clazz_defineMethod(c$, "getSeqcodeStringFor", 
function(seqcode){
if (seqcode == -2147483648) return null;
var s = "" + (seqcode >> 8);
if ((seqcode & 127) != 0) s += "^" + String.fromCharCode(seqcode & 127);
return s;
}, "~N");
Clazz_defineMethod(c$, "getInsertionCode", 
function(){
return (this.seqcode == -2147483648 ? '\0' : String.fromCharCode(this.seqcode & 127));
});
Clazz_defineMethod(c$, "getInsCode", 
function(){
return (this.seqcode & 127);
});
c$.getInsertionCodeFor = Clazz_defineMethod(c$, "getInsertionCodeFor", 
function(seqcode){
return (seqcode & 127);
}, "~N");
c$.getInsertionCodeChar = Clazz_defineMethod(c$, "getInsertionCodeChar", 
function(seqcode){
return (seqcode == -2147483648 ? '\0' : String.fromCharCode(seqcode & 127));
}, "~N");
Clazz_defineMethod(c$, "scaleToScreen", 
function(Z, mar){
return this.chain.model.ms.vwr.tm.scaleToScreen(Z, mar);
}, "~N,~N");
Clazz_defineMethod(c$, "isCursorOnTopOf", 
function(atom, x, y, radius, champ){
return this.chain.model.ms.isCursorOnTopOf(atom, x, y, radius, champ);
}, "JM.Atom,~N,~N,~N,JM.Atom");
Clazz_defineMethod(c$, "getModel", 
function(){
return this.chain.model;
});
Clazz_defineMethod(c$, "getSelectedMonomerCount", 
function(){
return 0;
});
Clazz_defineMethod(c$, "getSelectedMonomerIndex", 
function(){
return -1;
});
Clazz_defineMethod(c$, "isLeadAtom", 
function(atomIndex){
return false;
}, "~N");
Clazz_defineMethod(c$, "getLeadAtom", 
function(){
return null;
});
Clazz_defineMethod(c$, "getLeadAtomOr", 
function(atom){
var a = this.getLeadAtom();
return (a == null ? atom : a);
}, "JM.Atom");
Clazz_defineMethod(c$, "getLeadOrFirstAtomIndex", 
function(){
var a = this.getLeadAtom();
return (a == null ? this.firstAtomIndex : this.leadAtomIndex);
});
Clazz_defineMethod(c$, "getQuaternion", 
function(qType){
return null;
}, "~S");
Clazz_defineMethod(c$, "getQuaternionFrame", 
function(atoms){
if (this.lastAtomIndex - this.firstAtomIndex < 3) return null;
var pt = this.firstAtomIndex;
return JU.Quat.getQuaternionFrame(atoms[pt], atoms[++pt], atoms[++pt]);
}, "~A");
Clazz_defineMethod(c$, "setStrucNo", 
function(i){
}, "~N");
Clazz_defineMethod(c$, "getHelixData", 
function(tokType, qType, mStep){
return JU.Escape.escapeHelical(null, tokType, null, null, null);
}, "~N,~S,~N");
Clazz_defineMethod(c$, "isWithinStructure", 
function(type){
return false;
}, "J.c.STR");
Clazz_defineMethod(c$, "getProteinStructureTag", 
function(){
return null;
});
Clazz_defineMethod(c$, "getStructureId", 
function(){
return "";
});
Clazz_defineMethod(c$, "getBioPolymerIndexInModel", 
function(){
return -1;
});
Clazz_defineMethod(c$, "isCrossLinked", 
function(g){
return false;
}, "JM.Group");
Clazz_defineMethod(c$, "getCrossLinkVector", 
function(vReturn, crosslinkCovalent, crosslinkHBond){
return false;
}, "JU.Lst,~B,~B");
Clazz_defineMethod(c$, "getNitrogenAtom", 
function(){
return null;
});
Clazz_defineMethod(c$, "getCarbonylOxygenAtom", 
function(){
return null;
});
Clazz_defineMethod(c$, "fixIndices", 
function(atomsDeleted, bsDeleted){
this.firstAtomIndex -= atomsDeleted;
this.leadAtomIndex -= atomsDeleted;
this.lastAtomIndex -= atomsDeleted;
if (this.bsAdded != null) JU.BSUtil.deleteBits(this.bsAdded, bsDeleted);
}, "~N,JU.BS");
Clazz_defineMethod(c$, "getGroupInfo", 
function(igroup, ptTemp){
var infoGroup =  new java.util.Hashtable();
infoGroup.put("groupIndex", Integer.$valueOf(igroup));
infoGroup.put("groupID", Short.$valueOf(this.groupID));
var s = this.getSeqcodeString();
if (s != null) infoGroup.put("seqCode", s);
infoGroup.put("_apt1", Integer.$valueOf(this.firstAtomIndex));
infoGroup.put("_apt2", Integer.$valueOf(this.lastAtomIndex));
if (this.bsAdded != null) infoGroup.put("addedAtoms", this.bsAdded);
infoGroup.put("atomInfo1", this.chain.model.ms.getAtomInfo(this.firstAtomIndex, null, ptTemp));
infoGroup.put("atomInfo2", this.chain.model.ms.getAtomInfo(this.lastAtomIndex, null, ptTemp));
infoGroup.put("visibilityFlags", Integer.$valueOf(this.shapeVisibilityFlags));
return infoGroup;
}, "~N,JU.P3");
Clazz_defineMethod(c$, "getMinZ", 
function(atoms, minZ){
minZ[0] = 2147483647;
for (var i = this.firstAtomIndex; i <= this.lastAtomIndex; i++) this.checkMinZ(atoms[i], minZ);

if (this.bsAdded != null) for (var i = this.bsAdded.nextSetBit(0); i >= 0; i = this.bsAdded.nextSetBit(i + 1)) this.checkMinZ(atoms[i], minZ);

}, "~A,~A");
Clazz_defineMethod(c$, "checkMinZ", 
function(atom, minZ){
var z = atom.sZ - Clazz_doubleToInt(atom.sD / 2) - 2;
if (z < minZ[0]) minZ[0] = Math.max(1, z);
}, "JM.Atom,~A");
Clazz_defineMethod(c$, "getGroupParameter", 
function(tok){
return NaN;
}, "~N");
Clazz_defineMethod(c$, "getAtomIndex", 
function(name, offset){
return -1;
}, "~S,~N");
Clazz_defineMethod(c$, "getBSSideChain", 
function(){
return  new JU.BS();
});
Clazz_overrideMethod(c$, "toString", 
function(){
return "[" + this.getGroup3() + "-" + this.getSeqcodeString() + "]";
});
Clazz_defineMethod(c$, "isNucleicMonomer", 
function(){
return false;
});
Clazz_defineMethod(c$, "unsetStrutPoint", 
function(){
if (this.strutPoint == null) this.strutPoint =  new JU.Point3fi();
this.strutPoint.sX = -2147483648;
});
Clazz_defineMethod(c$, "getUnitID", 
function(){
if (this.unitID == null) {
var ia = this.getLeadOrFirstAtomIndex();
this.unitID = this.chain.model.ms.at[ia].getUnitID(2);
}return this.unitID;
});
c$.standardGroupList = null;
c$.group3Names =  new Array(128);
c$.specialAtomNames = null;
});
;//5.0.1-v7 Mon Aug 24 10:01:38 CDT 2026
Clazz_declarePackage("JM");
Clazz_load(["JM.Bond"], "JM.HBond", ["JU.Logger"], function(){
var c$ = Clazz_decorateAsClass(function(){
this.energy = 0;
Clazz_instantialize(this, arguments);}, JM, "HBond", JM.Bond);
Clazz_makeConstructor(c$, 
function(atom1, atom2, order, mad, colix, energy){
Clazz_superConstructor(this, JM.HBond, [atom1, atom2, order, mad, colix]);
this.energy = energy;
if (JU.Logger.debugging) JU.Logger.debug("HBond energy = " + energy + " #" + this.getIdentity());
}, "JM.Atom,JM.Atom,~N,~N,~N,~N");
Clazz_overrideMethod(c$, "getEnergy", 
function(){
return this.energy;
});
c$.calcEnergy = Clazz_defineMethod(c$, "calcEnergy", 
function(distAH, distCH, distCD, distAD){
var energy = Math.round(-27888.0 / distAH - -27888.0 / distAD + -27888.0 / distCD - -27888.0 / distCH);
return energy;
}, "~N,~N,~N,~N");
});
;//5.0.1-v7 Mon Aug 17 10:07:10 MDT 2026
Clazz_declarePackage("JM");
Clazz_load(null, "JM.LabelToken", ["java.util.Hashtable", "JU.AU", "$.PT", "$.SB", "JS.SV", "$.T", "JU.Edge", "JV.JC"], function(){
var c$ = Clazz_decorateAsClass(function(){
this.text = null;
this.key = null;
this.data = null;
this.tok = 0;
this.pt = -1;
this.ch1 = '\0';
this.width = 0;
this.precision = 2147483647;
this.alignLeft = false;
this.zeroPad = false;
this.intAsFloat = false;
Clazz_instantialize(this, arguments);}, JM, "LabelToken", null);
/*LV!1824 unnec constructor*/Clazz_defineMethod(c$, "set", 
function(text, pt){
this.text = text;
this.pt = pt;
return this;
}, "~S,~N");
c$.isLabelPropertyTok = Clazz_defineMethod(c$, "isLabelPropertyTok", 
function(tok){
for (var i = JM.LabelToken.labelTokenIds.length; --i >= 0; ) if (JM.LabelToken.labelTokenIds[i] == tok) return true;

return false;
}, "~N");
c$.compile = Clazz_defineMethod(c$, "compile", 
function(vwr, strFormat, chAtom, htValues){
if (strFormat == null || strFormat.length == 0) return null;
if (strFormat.indexOf("%") < 0 || strFormat.length < 2) return  Clazz_newArray(-1, [ new JM.LabelToken().set(strFormat, -1)]);
var n = 0;
var ich = -1;
var cch = strFormat.length;
while (++ich < cch && (ich = strFormat.indexOf('%', ich)) >= 0) n++;

var tokens =  new Array(n * 2 + 1);
var ichPercent;
var i = 0;
for (ich = 0; (ichPercent = strFormat.indexOf('%', ich)) >= 0; ) {
if (ich != ichPercent) tokens[i++] =  new JM.LabelToken().set(strFormat.substring(ich, ichPercent), -1);
var lt = tokens[i++] =  new JM.LabelToken().set(null, ichPercent);
vwr.autoCalculate(lt.tok, null);
ich = JM.LabelToken.setToken(vwr, strFormat, lt, cch, chAtom.charCodeAt(0), htValues);
}
if (ich < cch) tokens[i++] =  new JM.LabelToken().set(strFormat.substring(ich), -1);
return tokens;
}, "JV.Viewer,~S,~S,java.util.Map");
Clazz_defineMethod(c$, "formatLabel", 
function(vwr, atom, strFormat, ptTemp){
return (strFormat == null || strFormat.length == 0 ? null : JM.LabelToken.formatLabelAtomArray(vwr, atom, JM.LabelToken.compile(vwr, strFormat, '\0', null), '\0', null, ptTemp));
}, "JV.Viewer,JM.Atom,~S,JU.P3");
c$.formatLabelAtomArray = Clazz_defineMethod(c$, "formatLabelAtomArray", 
function(vwr, atom, tokens, chAtom, indices, ptTemp){
if (atom == null) return null;
var strLabel = (chAtom > '0' ? null :  new JU.SB());
if (tokens != null) for (var i = 0; i < tokens.length; i++) {
var t = tokens[i];
if (t == null) break;
if (chAtom > '0' && t.ch1 != chAtom) continue;
if (t.tok <= 0 || t.key != null) {
if (strLabel != null) {
strLabel.append(t.text);
if (t.ch1 != '\0') strLabel.appendC(t.ch1);
}} else {
JM.LabelToken.appendAtomTokenValue(vwr, atom, t, strLabel, indices, ptTemp);
}}
return (strLabel == null ? null : strLabel.toString().intern());
}, "JV.Viewer,JM.Atom,~A,~S,~A,JU.P3");
c$.getBondLabelValues = Clazz_defineMethod(c$, "getBondLabelValues", 
function(){
var htValues =  new java.util.Hashtable();
htValues.put("#", "");
htValues.put("ORDER", "");
htValues.put("TYPE", "");
htValues.put("LENGTH", Float.$valueOf(0));
htValues.put("ENERGY", Float.$valueOf(0));
return htValues;
});
c$.formatLabelBond = Clazz_defineMethod(c$, "formatLabelBond", 
function(vwr, bond, tokens, values, indices, ptTemp){
values.put("#", "" + (bond.index + 1));
values.put("ORDER", "" + JU.Edge.getBondOrderNumberFromOrder(bond.order));
values.put("TYPE", JU.Edge.getBondOrderNameFromOrder(bond.order));
values.put("LENGTH", Float.$valueOf(bond.atom1.distance(bond.atom2)));
values.put("ENERGY", Float.$valueOf(bond.getEnergy()));
JM.LabelToken.setValues(tokens, values);
JM.LabelToken.formatLabelAtomArray(vwr, bond.atom1, tokens, '1', indices, ptTemp);
JM.LabelToken.formatLabelAtomArray(vwr, bond.atom2, tokens, '2', indices, ptTemp);
return JM.LabelToken.getLabel(tokens);
}, "JV.Viewer,JM.Bond,~A,java.util.Map,~A,JU.P3");
c$.formatLabelMeasure = Clazz_defineMethod(c$, "formatLabelMeasure", 
function(vwr, m, label, value, units){
var htValues =  new java.util.Hashtable();
htValues.put("#", "" + (m.index + 1));
htValues.put("VALUE", Float.$valueOf(value));
htValues.put("UNITS", units);
var tokens = JM.LabelToken.compile(vwr, label, '\1', htValues);
if (tokens == null) return "";
JM.LabelToken.setValues(tokens, htValues);
var atoms = m.ms.at;
var indices = m.countPlusIndices;
for (var i = indices[0]; i >= 1; --i) if (indices[i] >= 0) JM.LabelToken.formatLabelAtomArray(vwr, atoms[indices[i]], tokens, String.fromCharCode(48 + i), null, null);

label = JM.LabelToken.getLabel(tokens);
return (label == null ? "" : label);
}, "JV.Viewer,JM.Measurement,~S,~N,~S");
c$.setValues = Clazz_defineMethod(c$, "setValues", 
function(tokens, values){
for (var i = 0; i < tokens.length; i++) {
var lt = tokens[i];
if (lt == null) break;
if (lt.key == null) continue;
var value = values.get(lt.key);
lt.text = (Clazz_instanceOf(value, Float) ? lt.format((value).floatValue(), null, null) : lt.format(NaN, value, null));
}
}, "~A,java.util.Map");
c$.getLabel = Clazz_defineMethod(c$, "getLabel", 
function(tokens){
var sb =  new JU.SB();
for (var i = 0; i < tokens.length; i++) {
var lt = tokens[i];
if (lt == null) break;
sb.append(lt.text);
}
return sb.toString();
}, "~A");
c$.setToken = Clazz_defineMethod(c$, "setToken", 
function(vwr, strFormat, lt, cch, chAtom, htValues){
var ich = lt.pt + 1;
if (ich >= cch) {
lt.text = "%";
return ich;
}var ch;
if (strFormat.charAt(ich) == '-') {
lt.alignLeft = true;
++ich;
}if (ich < cch && strFormat.charAt(ich) == '0') {
lt.zeroPad = true;
++ich;
}while (ich < cch && JU.PT.isDigit(ch = strFormat.charAt(ich))) {
lt.width = (10 * lt.width) + (ch.charCodeAt(0) - 48);
++ich;
}
lt.precision = 2147483647;
var isNegative = false;
if (ich < cch && strFormat.charAt(ich) == '.') {
++ich;
if (ich < cch && (ch = strFormat.charAt(ich)) == '-') {
isNegative = true;
++ich;
}if (ich < cch && JU.PT.isDigit(ch = strFormat.charAt(ich))) {
++ich;
lt.precision = ch.charCodeAt(0) - 48;
if (ich < cch && JU.PT.isDigit(ch = strFormat.charAt(ich))) {
++ich;
lt.precision = lt.precision * 10 + (ch.charCodeAt(0) - 48);
}if (isNegative) lt.precision = -1 - lt.precision;
}}if (ich < cch && htValues != null) for (var key, $key = htValues.keySet().iterator (); $key.hasNext()&& ((key = $key.next ()) || true);) if (strFormat.indexOf(key, ich) == ich) return ich + (lt.key = key).length;

if (ich < cch) switch ((ch = strFormat.charAt(ich++)).charCodeAt(0)) {
case 37:
lt.text = "%";
return ich;
case 91:
var ichClose = strFormat.indexOf(']', ich);
if (ichClose < ich) {
ich = cch;
break;
}var propertyName = strFormat.substring(ich, ichClose).toLowerCase();
if (propertyName.startsWith("property_")) {
lt.tok = 134221834;
lt.data = vwr.getDataObj(propertyName, null, 1);
} else if (propertyName.startsWith("validation.")) {
lt.tok = 1073742189;
lt.data = vwr.getDataObj("property_" + propertyName.substring(11), null, 1);
} else if (propertyName.startsWith("unitid")) {
lt.tok = 1073741974;
lt.data = Integer.$valueOf(JV.JC.getUnitIDFlags(propertyName.substring(6)));
} else {
var token = JS.T.getTokenFromName(propertyName);
if (token != null && JM.LabelToken.isLabelPropertyTok(token.tok)) lt.tok = token.tok;
}ich = ichClose + 1;
break;
case 123:
var ichCloseBracket = strFormat.indexOf('}', ich);
if (ichCloseBracket < ich) {
ich = cch;
break;
}var s = strFormat.substring(ich, ichCloseBracket);
lt.data = vwr.getDataObj(s, null, 1);
if (lt.data == null) {
lt.data = vwr.getDataObj(s, null, -1);
if (lt.data != null) {
lt.data = (lt.data)[1];
if ((typeof(lt.data)=='string')) lt.data = JU.PT.split(lt.data, "\n");
if (!(JU.AU.isAS(lt.data))) lt.data = null;
}if (lt.data == null) {
lt.tok = 1715472409;
lt.data = s;
} else {
lt.tok = 1275068418;
}} else {
lt.tok = 134221834;
}ich = ichCloseBracket + 1;
break;
default:
var i;
var i1;
if (ich < cch && (i = "fuv".indexOf(ch)) >= 0 && (i1 = "xyz".indexOf(strFormat.charAt(ich))) >= 0) {
lt.tok = JM.LabelToken.twoCharLabelTokenIds[i * 3 + i1];
ich++;
} else if ((i = "AaBbCcDEefGgIiLlMmNnOoPpQqRrSsTtUuVvWwXxxYyyZzz%%%gqW".indexOf(ch)) >= 0) {
lt.tok = JM.LabelToken.labelTokenIds[i];
}}
lt.text = strFormat.substring(lt.pt, ich);
if (ich < cch && chAtom != 0 && JU.PT.isDigit(ch = strFormat.charAt(ich))) {
ich++;
lt.ch1 = ch;
if (ch.charCodeAt(0) != chAtom && chAtom != 1) lt.tok = 0;
}return ich;
}, "JV.Viewer,~S,JM.LabelToken,~N,~N,java.util.Map");
c$.appendAtomTokenValue = Clazz_defineMethod(c$, "appendAtomTokenValue", 
function(vwr, atom, t, strLabel, indices, ptTemp){
var strT = null;
var floatT = NaN;
var ptT = null;
try {
switch (t.tok) {
case 1153433601:
strT = atom.atomPropertyString(vwr, 1153433601);
break;
case 1094713347:
strT = "" + (indices == null ? atom.i : indices[atom.i]);
break;
case 1765808134:
ptT = atom.atomPropertyTuple(vwr, t.tok, ptTemp);
break;
case 1073741974:
strT = atom.getUnitID((t.data).intValue());
break;
case 134221834:
case 1073742189:
if (t.data != null) {
floatT = (t.data)[atom.i];
if (t.tok == 1073742189 && floatT != 1 && floatT != 0) {
var o = vwr.getAtomValidation(t.text.substring(13, t.text.length - 1), atom);
if (o == null) {
System.out.println("?? o is null ??");
} else if (o.size() == 1) {
floatT = o.get(0).floatValue();
} else {
floatT = NaN;
strT = "";
for (var i = 0, n = o.size(); i < n; i++) {
strT += "," + o.get(i);
}
if (strT.length > 1) strT = strT.substring(1);
}}}break;
case 1715472409:
var data = vwr.ms.getInfo(atom.mi, t.data);
var iatom = atom.i - vwr.ms.am[atom.mi].firstAtomIndex;
var o = null;
if (iatom >= 0) if ((Clazz_instanceOf(data,Array))) {
var sdata = data;
o = (iatom < sdata.length ? sdata[iatom] : null);
} else if (Clazz_instanceOf(data,"JU.Lst")) {
var list = data;
o = (iatom < list.size() ? JS.SV.oValue(list.get(iatom)) : null);
}if (o == null) {
strT = "";
} else if (Clazz_instanceOf(o, Float)) {
floatT = (o).floatValue();
} else if (Clazz_instanceOf(o, Integer)) {
floatT = (o).intValue();
} else if (Clazz_instanceOf(o,"JU.T3")) {
ptT = o;
} else {
strT = o.toString();
}break;
case 1275068418:
if (t.data != null) {
var sdata = t.data;
strT = (atom.i < sdata.length ? sdata[atom.i] : "");
}break;
case 1631586315:
var formalCharge = atom.getFormalCharge();
strT = (formalCharge > 0 ? "" + formalCharge + "+" : formalCharge < 0 ? "" + -formalCharge + "-" : "");
break;
case 1094717454:
strT = atom.getModelNumberForLabel();
break;
case 1128269825:
strT = "" + atom.atomPropertyInt(vwr, t.tok);
break;
case 1665140738:
floatT = atom.atomPropertyFloat(vwr, t.tok, ptTemp);
break;
case 1086324749:
strT = atom.group.getStructureId();
break;
case 1094713370:
var id = atom.group.getStrucNo();
strT = (id <= 0 ? "" : "" + id);
break;
case 1111490574:
if (Float.isNaN(floatT = atom.group.getGroupParameter(1111490574))) strT = "null";
break;
case 1111492626:
case 1111492627:
case 1111492628:
case 1111490583:
case 1111490584:
case 1111490585:
case 1111490586:
floatT = atom.atomPropertyFloat(vwr, t.tok, ptTemp);
if (Float.isNaN(floatT)) strT = "";
break;
case 1073877011:
strT = vwr.getNBOAtomLabel(atom);
break;
case 1086324747:
case 1639976963:
case 1237320707:
strT = atom.atomPropertyString(vwr, t.tok);
break;
case 1140850705:
strT = atom.getIdentityXYZ(ptTemp, 1);
break;
case 1086324754:
strT = atom.getWyckoffPosition(false);
break;
case 1086324755:
strT = atom.getWyckoffPosition(true);
break;
case 79:
strT = atom.getSymmetryOperatorList(false);
break;
case 81:
floatT = atom.getOccupancy100() / 100;
break;
default:
switch (t.tok & 1136656384) {
case 1094713344:
if (t.intAsFloat) floatT = atom.atomPropertyInt(vwr, t.tok);
 else strT = "" + atom.atomPropertyInt(vwr, t.tok);
break;
case 1111490560:
floatT = atom.atomPropertyFloat(vwr, t.tok, ptTemp);
break;
case 1086324736:
strT = atom.atomPropertyString(vwr, t.tok);
break;
case 1077936128:
ptT = atom.atomPropertyTuple(vwr, t.tok, ptTemp);
if (ptT == null) strT = "";
break;
default:
if (t.tok == 1145045003) strT = atom.atomPropertyString(vwr, 1145045003);
}
}
} catch (ioobe) {
if (Clazz_exceptionOf(ioobe,"IndexOutOfBoundsException")){
floatT = NaN;
strT = null;
ptT = null;
} else {
throw ioobe;
}
}
strT = t.format(floatT, strT, ptT);
if (strLabel == null) t.text = strT;
 else strLabel.append(strT);
}, "JV.Viewer,JM.Atom,JM.LabelToken,JU.SB,~A,JU.P3");
Clazz_defineMethod(c$, "format", 
function(floatT, strT, ptT){
if (!Float.isNaN(floatT)) {
return JU.PT.formatF(floatT, this.width, this.precision, this.alignLeft, this.zeroPad);
} else if (strT != null) {
return JU.PT.formatS(strT, this.width, this.precision, this.alignLeft, this.zeroPad);
} else if (ptT != null) {
if (this.width == 0 && this.precision == 2147483647) {
this.width = 6;
this.precision = 2;
}return JU.PT.formatF(ptT.x, this.width, this.precision, false, false) + JU.PT.formatF(ptT.y, this.width, this.precision, false, false) + JU.PT.formatF(ptT.z, this.width, this.precision, false, false);
} else {
return this.text;
}}, "~N,~S,JU.T3");
c$.labelTokenIds =  Clazz_newIntArray(-1, [1086324739, 1086326786, 1086326785, 1111492620, 1631586315, 1086326788, 1094713347, 1086324746, 1086326789, 1111490569, 1094713357, 1094713361, 1111492618, 1094715393, 1094713363, 1094715402, 1094717454, 1086324743, 1094713360, 1086324742, 79, 1088421903, 1111492619, 1111490570, 81, 1128269825, 1094715412, 1086324747, 1094713369, 1086326788, 1111490574, 1111492620, 1086324745, 1111490575, 1648363544, 1145047055, 1140850705, 1086324755, 1111492612, 1111492609, 1111492629, 1111492613, 1111492610, 1111492630, 1111492614, 1111492611, 1111492631, 1114249217, 1112152066, 1112150019, 1112150020, 1112150021, 1112152070, 1112152071, 1112152073, 1112152074, 1112152076, 1649022989, 1112152078, 1111490561, 1111490562, 1153433601, 1094713346, 1228931586, 1765808134, 1094713356, 1111490564, 1228935687, 1287653388, 1825200146, 1111490567, 1094713359, 1111490565, 1111490568, 1094713362, 1715472409, 1665140738, 1113589787, 1086324748, 1086324744, 1112152075, 1639976963, 1237320707, 1094713370, 1086324749, 1086326798, 1111490576, 1111490577, 1111490578, 1111490579, 1094715420, 1648361473, 1111492626, 1111492627, 1111492628, 1312817669, 1145045006, 1145047050, 1145047049, 1145047053, 1111492615, 1111492616, 1111492617, 1113589786, 1094713365, 1094713366, 1094713367, 1145047052, 1111490566, 1111490563, 1094713351, 1094713368, 1111490583, 1111490584, 1111490585, 1111490586, 1145045008, 1296041986, 1073877011, 1086324752, 1086324753, 1086324754, 1145045003, 1095241729]);
c$.twoCharLabelTokenIds =  Clazz_newIntArray(-1, [1111492612, 1111492613, 1111492614, 1111490577, 1111490578, 1111490579, 1111492626, 1111492627, 1111492628]);
});
;//5.0.1-v7 Mon Aug 24 10:01:38 CDT 2026
Clazz_declarePackage("JM");
Clazz_load(null, "JM.Measurement", ["JU.Measure", "$.PT", "$.SB", "J.atomdata.RadiusData", "J.c.VDW", "JM.LabelToken", "JU.Escape"], function(){
var c$ = Clazz_decorateAsClass(function(){
this.ms = null;
this.thisID = null;
this.index = 0;
this.isVisible = true;
this.isHidden = false;
this.isTrajectory = false;
this.$isValid = true;
this.colix = 0;
this.labelColix = -1;
this.mad = 0;
this.tickInfo = null;
this.traceX = -2147483648;
this.traceY = 0;
this.count = 0;
this.countPlusIndices = null;
this.pts = null;
this.value = 0;
this.property = null;
this.strFormat = null;
this.units = null;
this.text = null;
this.vwr = null;
this.strMeasurement = null;
this.type = null;
this.renderAxis = null;
this.renderArc = null;
this.fixedValue = NaN;
this.inFront = false;
this.modelIndex = 0;
this.isPending = false;
this.tainted = false;
this.useDefaultLabel = false;
this.newUnits = null;
Clazz_instantialize(this, arguments);}, JM, "Measurement", null);
Clazz_prepareFields (c$, function(){
this.countPlusIndices =  Clazz_newIntArray (5, 0);
});
Clazz_defineMethod(c$, "isTainted", 
function(){
return (this.tainted && !(this.tainted = false));
});
Clazz_defineMethod(c$, "setM", 
function(modelSet, m, value, colix, strFormat, index){
this.ms = modelSet;
this.index = index;
this.vwr = modelSet.vwr;
this.colix = colix;
this.strFormat = strFormat;
if (m != null) {
this.modelIndex = m.modelIndex;
this.tickInfo = m.tickInfo;
this.pts = m.pts;
this.mad = m.mad;
this.thisID = m.thisID;
this.text = m.text;
this.property = m.property;
this.units = m.units;
if (this.property == null && "+hz".equals(this.units)) {
this.property = "property_J";
}if (this.thisID != null && this.text != null) this.labelColix = this.text.colix;
}if (this.pts == null) this.pts =  new Array(4);
var indices = (m == null ? null : m.countPlusIndices);
this.count = (indices == null ? 0 : indices[0]);
if (this.count > 0) {
System.arraycopy(indices, 0, this.countPlusIndices, 0, this.count + 1);
this.isTrajectory = modelSet.isTrajectoryMeasurement(this.countPlusIndices);
}this.isPending = Float.isNaN(value);
this.value = (this.isPending || this.isTrajectory ? this.getMeasurement(null) : value);
this.formatMeasurement(null);
return this;
}, "JM.ModelSet,JM.Measurement,~N,~N,~S,~N");
Clazz_defineMethod(c$, "setPoints", 
function(modelSet, indices, points, tickInfo){
this.ms = modelSet;
this.countPlusIndices = indices;
this.count = indices[0];
this.pts = (points == null ?  new Array(4) : points);
this.vwr = modelSet.vwr;
this.tickInfo = tickInfo;
return this;
}, "JM.ModelSet,~A,~A,JM.TickInfo");
Clazz_defineMethod(c$, "setCount", 
function(count){
this.setCountM(count);
}, "~N");
Clazz_defineMethod(c$, "setCountM", 
function(count){
this.count = this.countPlusIndices[0] = count;
}, "~N");
Clazz_defineMethod(c$, "getAtomIndex", 
function(n){
return (n > 0 && n <= this.count ? this.countPlusIndices[n] : -1);
}, "~N");
Clazz_defineMethod(c$, "getAtom", 
function(n){
var pt = this.countPlusIndices[n];
return (pt < -1 ? this.pts[-2 - pt] : this.ms.at[pt]);
}, "~N");
Clazz_defineMethod(c$, "getLastIndex", 
function(){
return (this.count > 0 ? this.countPlusIndices[this.count] : -1);
});
Clazz_defineMethod(c$, "getString", 
function(){
return this.strMeasurement;
});
Clazz_overrideMethod(c$, "toString", 
function(){
return this.getString();
});
Clazz_defineMethod(c$, "getStringUsing", 
function(vwr, strFormat, units){
this.vwr = vwr;
this.value = this.getMeasurement(null);
this.formatMeasurementAs(strFormat, units, true);
if (strFormat == null) return this.getInfoAsString(units);
return this.strMeasurement;
}, "JV.Viewer,~S,~S");
Clazz_defineMethod(c$, "getStringDetail", 
function(){
return (this.count == 2 ? "Distance" : this.count == 3 ? "Angle" : "Torsion") + this.getMeasurementScript(" - ", false) + " : " + this.value;
});
Clazz_defineMethod(c$, "refresh", 
function(pts){
this.value = this.getMeasurement(pts);
this.isTrajectory = this.ms.isTrajectoryMeasurement(this.countPlusIndices);
this.formatMeasurement(null);
}, "~A");
Clazz_defineMethod(c$, "getMeasurementScript", 
function(sep, withModelIndex){
var sb =  new JU.SB();
var asBitSet = (sep.equals(" "));
for (var i = 1; i <= this.count; i++) sb.append(i > 1 ? sep : " ").append(this.getLabel(i, asBitSet, withModelIndex));

return sb.toString();
}, "~S,~B");
Clazz_defineMethod(c$, "formatMeasurementAs", 
function(strFormat, units, useDefault){
if (strFormat != null && strFormat.length == 0) strFormat = null;
if (!useDefault && strFormat != null && strFormat.indexOf(this.countPlusIndices[0] + ":") != 0) return;
this.strFormat = strFormat;
this.formatMeasurement(units);
}, "~S,~S,~B");
Clazz_defineMethod(c$, "formatMeasurement", 
function(units){
this.tainted = true;
switch (Float.isNaN(this.value) ? 0 : this.count) {
default:
this.strMeasurement = null;
return;
case 2:
this.strMeasurement = this.formatDistance(units);
return;
case 3:
case 4:
this.strMeasurement = this.formatAngle(this.value);
return;
}
}, "~S");
Clazz_defineMethod(c$, "reformatDistanceIfSelected", 
function(isDefault){
if (this.count == 2 && this.vwr.slm.isSelected(this.countPlusIndices[1]) && this.vwr.slm.isSelected(this.countPlusIndices[2])) {
var pt;
if (this.useDefaultLabel && this.strFormat != null && (pt = this.strFormat.indexOf("//")) >= 0) this.strFormat = this.strFormat.substring(0, pt);
if (isDefault) this.units = null;
this.formatMeasurement(null);
}}, "~B");
Clazz_defineMethod(c$, "formatDistance", 
function(units){
var label = this.getLabelString();
if (label == null) return "";
var pt = this.strFormat.indexOf("//");
if (units == null) {
units = this.units;
if (units == null) {
units = (pt >= 0 ? this.strFormat.substring(pt + 2) : this.property == null ? this.vwr.g.measureDistanceUnits : "");
}}if (pt >= 0) {
this.strFormat = this.strFormat.substring(0, pt);
}this.strFormat += "//" + units;
units = JM.Measurement.fixUnits(units);
pt = label.indexOf("//");
if (pt >= 0) {
label = label.substring(0, pt);
if (label.length == 0) label = "%VALUE";
}var f = this.fixValue(units, (label.indexOf("%V") >= 0));
return this.formatString(f, this.newUnits, label);
}, "~S");
Clazz_defineMethod(c$, "fixValue", 
function(units, andRound){
this.checkJ(units);
if (units != null && units.startsWith("+")) {
if (!this.isPending) this.value = Math.abs(this.value);
units = units.substring(1);
}this.newUnits = units;
if (this.count != 2) return this.value;
var dist = this.value;
if (units == null && this.property != null) units = "";
if (units != null) {
var isPercent = units.equals("%");
if (this.property == null && (isPercent || units.endsWith("hz"))) {
var i1 = this.getAtomIndex(1);
var i2 = this.getAtomIndex(2);
if (i1 >= 0 && i2 >= 0) {
var a1 = this.getAtom(1);
var a2 = this.getAtom(2);
var itype = JM.Measurement.nmrType(units);
var isDC = (!isPercent && itype == 1);
this.type = (isPercent ? "percent" : isDC ? "dipoleCouplingConstant" : itype == 3 ? "NOE or 3JHH" : "J-CouplingConstant");
if (itype == 3) {
var result = this.vwr.getNMRCalculation().getNOEorJHH( Clazz_newArray(-1, [a1, null, null, a2]), 11);
if (result == null) {
dist = NaN;
this.newUnits = units = "";
} else {
dist = result[1];
units = this.newUnits = (result.length == 2 ? "noe" : "hz");
}} else {
dist = (isPercent ? dist / (a1.getVanderwaalsRadiusFloat(this.vwr, J.c.VDW.AUTO) + a2.getVanderwaalsRadiusFloat(this.vwr, J.c.VDW.AUTO)) : isDC ? this.vwr.getNMRCalculation().getDipolarConstantHz(a1, a2) : this.vwr.getNMRCalculation().getIsoOrAnisoHz(true, a1, a2, units, null));
}this.$isValid = !Float.isNaN(dist);
if (isPercent) units = "pm";
}}return JM.Measurement.toUnits(dist, units, andRound);
}return (andRound ? Math.round(dist * 100) / 100 : dist);
}, "~S,~B");
Clazz_defineMethod(c$, "checkJ", 
function(units){
if (this.property != null || units != null || this.units != null) return;
units = this.vwr.g.measureDistanceUnits;
if ("+hz".equals(units)) {
this.property = "property_J";
this.units = units;
}}, "~S");
c$.nmrType = Clazz_defineMethod(c$, "nmrType", 
function(units){
return (units.indexOf("hz") < 0 ? 0 : units.equals("noe_hz") ? 3 : units.startsWith("dc_") || units.equals("khz") ? 1 : 2);
}, "~S");
Clazz_defineMethod(c$, "formatAngle", 
function(angle){
var label = this.getLabelString();
if (label.indexOf("%V") >= 0) angle = Math.round(angle * 10) / 10;
return this.formatString(angle, "\u00B0", label);
}, "~N");
Clazz_defineMethod(c$, "getLabelString", 
function(){
var atomCount = this.countPlusIndices[0];
var s = atomCount + ":";
var label = null;
if (this.strFormat != null) {
if (this.strFormat.length == 0) return null;
label = (this.strFormat.length > 2 && this.strFormat.indexOf(s) == 0 ? this.strFormat : null);
}this.useDefaultLabel = false;
if (label == null) {
this.strFormat = null;
label = this.vwr.getDefaultMeasurementLabel(this.countPlusIndices[0]);
this.useDefaultLabel = (this.units == null);
}if (label.indexOf(s) == 0) label = label.substring(2);
if (this.strFormat == null) this.strFormat = s + label;
return label;
});
Clazz_defineMethod(c$, "formatString", 
function(value, units, label){
return JM.LabelToken.formatLabelMeasure(this.vwr, this, label, value, units);
}, "~N,~S,~S");
Clazz_defineMethod(c$, "sameAsPoints", 
function(indices, points){
if (this.count != indices[0]) return false;
var isSame = true;
for (var i = 1; i <= this.count && isSame; i++) isSame = (this.countPlusIndices[i] == indices[i]);

if (isSame) for (var i = 0; i < this.count && isSame; i++) {
if (points[i] != null) isSame = (this.pts[i].distance(points[i]) < 0.01);
}
if (isSame) return true;
switch (this.count) {
default:
return true;
case 2:
return this.sameAsIJ(indices, points, 1, 2) && this.sameAsIJ(indices, points, 2, 1);
case 3:
return this.sameAsIJ(indices, points, 1, 3) && this.sameAsIJ(indices, points, 2, 2) && this.sameAsIJ(indices, points, 3, 1);
case 4:
return this.sameAsIJ(indices, points, 1, 4) && this.sameAsIJ(indices, points, 2, 3) && this.sameAsIJ(indices, points, 3, 2) && this.sameAsIJ(indices, points, 4, 1);
}
}, "~A,~A");
Clazz_defineMethod(c$, "sameAsIJ", 
function(atoms, points, i, j){
var ipt = this.countPlusIndices[i];
var jpt = atoms[j];
return (ipt >= 0 || jpt >= 0 ? ipt == jpt : this.pts[-2 - ipt].distance(points[-2 - jpt]) < 0.01);
}, "~A,~A,~N,~N");
Clazz_defineMethod(c$, "sameAs", 
function(i, j){
return this.sameAsIJ(this.countPlusIndices, this.pts, i, j);
}, "~N,~N");
Clazz_defineMethod(c$, "getPropMeasurement", 
function(pts){
if (this.countPlusIndices == null || this.count != 2) return NaN;
for (var i = this.count; --i >= 0; ) if (this.countPlusIndices[i + 1] < 0) {
return NaN;
}
try {
var ptA = (pts == null ? this.getAtom(1) : pts[0]);
var ptB = (pts == null ? this.getAtom(2) : pts[1]);
var props = this.vwr.getDataObj(this.property, null, 2);
var ia = ptA.i;
var ib = ptB.i;
return (props == null || ib >= props.length || ia >= props.length ? NaN : props[ia][ib]);
} catch (t) {
return NaN;
}
}, "~A");
Clazz_defineMethod(c$, "getMeasurement", 
function(pts){
this.checkJ(null);
if (!Float.isNaN(this.fixedValue)) return this.fixedValue;
if (this.property != null) return this.getPropMeasurement(pts);
if (this.countPlusIndices == null) return NaN;
if (this.count < 2) return NaN;
for (var i = this.count; --i >= 0; ) if (this.countPlusIndices[i + 1] == -1) {
return NaN;
}
var ptA = (pts == null ? this.getAtom(1) : pts[0]);
var ptB = (pts == null ? this.getAtom(2) : pts[1]);
var ptC;
switch (this.count) {
case 2:
return ptA.distance(ptB);
case 3:
ptC = (pts == null ? this.getAtom(3) : pts[2]);
return JU.Measure.computeAngleABC(ptA, ptB, ptC, true);
case 4:
ptC = (pts == null ? this.getAtom(3) : pts[2]);
var ptD = (pts == null ? this.getAtom(4) : pts[3]);
return JU.Measure.computeTorsion(ptA, ptB, ptC, ptD, true);
default:
return NaN;
}
}, "~A");
Clazz_defineMethod(c$, "getLabel", 
function(i, asBitSet, withModelIndex){
var atomIndex = this.countPlusIndices[i];
return (atomIndex < 0 ? (withModelIndex ? "modelIndex " + this.getAtom(i).mi + " " : "") + JU.Escape.eP(this.getAtom(i)) : asBitSet ? "({" + atomIndex + "})" : this.vwr.getAtomInfo(atomIndex));
}, "~N,~B,~B");
Clazz_defineMethod(c$, "setModelIndex", 
function(modelIndex){
this.modelIndex = modelIndex;
if (this.pts == null) return;
for (var i = 0; i < this.count; i++) {
if (this.pts[i] != null) this.pts[i].mi = modelIndex;
}
}, "~N");
Clazz_defineMethod(c$, "isValid", 
function(){
return !(this.sameAs(1, 2) || this.count > 2 && this.sameAs(1, 3) || this.count == 4 && this.sameAs(2, 4));
});
c$.find = Clazz_defineMethod(c$, "find", 
function(measurements, m){
var indices = m.countPlusIndices;
var points = m.pts;
for (var i = measurements.size(); --i >= 0; ) if (measurements.get(i).sameAsPoints(indices, points)) return i;

return -1;
}, "JU.Lst,JM.Measurement");
Clazz_defineMethod(c$, "isConnected", 
function(atoms, count){
var atomIndexLast = -1;
for (var i = 1; i <= count; i++) {
var atomIndex = this.getAtomIndex(i);
if (atomIndex < 0) continue;
if (atomIndexLast >= 0 && !atoms[atomIndex].isBonded(atoms[atomIndexLast])) return false;
atomIndexLast = atomIndex;
}
return true;
}, "~A,~N");
Clazz_defineMethod(c$, "getInfoAsString", 
function(units){
var f = this.fixValue(units, true);
var sb =  new JU.SB();
sb.append(this.count == 2 ? (this.property != null ? this.property : this.type == null ? "distance" : this.type) : this.count == 3 ? "angle" : "dihedral");
sb.append(" \t").appendF(f);
sb.append(" \t").append(JU.PT.esc(this.strMeasurement));
for (var i = 1; i <= this.count; i++) sb.append(" \t").append(this.getLabel(i, false, false));

if (this.thisID != null) sb.append(" \t").append(this.thisID);
return sb.toString();
}, "~S");
Clazz_defineMethod(c$, "isInRange", 
function(radiusData, value){
if (radiusData.factorType === J.atomdata.RadiusData.EnumType.FACTOR) {
var atom1 = this.getAtom(1);
var atom2 = this.getAtom(2);
var d = (atom1.getVanderwaalsRadiusFloat(this.vwr, radiusData.vdwType) + atom2.getVanderwaalsRadiusFloat(this.vwr, radiusData.vdwType)) * radiusData.value;
return (value <= d);
}return (radiusData.values[0] == 3.4028235E38 || value >= radiusData.values[0] && value <= radiusData.values[1]);
}, "J.atomdata.RadiusData,~N");
Clazz_defineMethod(c$, "isIntramolecular", 
function(atoms, count){
var molecule = -1;
for (var i = 1; i <= count; i++) {
var atomIndex = this.getAtomIndex(i);
if (atomIndex < 0) continue;
var m = atoms[atomIndex].getMoleculeNumber(false);
if (molecule < 0) molecule = m;
 else if (m != molecule) return false;
}
return true;
}, "~A,~N");
Clazz_defineMethod(c$, "isMin", 
function(htMin){
var a1 = this.getAtom(1);
var a2 = this.getAtom(2);
var d = Clazz_floatToInt(a2.distanceSquared(a1) * 100);
var n1 = a1.getAtomName();
var n2 = a2.getAtomName();
var key = (n1.compareTo(n2) < 0 ? n1 + n2 : n2 + n1);
var min = htMin.get(key);
return (min != null && d == min.intValue());
}, "java.util.Map");
c$.isUnits = Clazz_defineMethod(c$, "isUnits", 
function(s){
return (JU.PT.isOneOf((s.startsWith("+") ? s.substring(1) : s).toLowerCase(), ";nm;nanometers;pm;picometers;angstroms;angstroms;ang;\u00C5;au;vanderwaals;vdw;%;noe;") || s.indexOf(" ") < 0 && s.endsWith("hz"));
}, "~S");
c$.toUnits = Clazz_defineMethod(c$, "toUnits", 
function(dist, units, andRound){
if (Float.isNaN(dist)) return NaN;
if (units.equals("hz")) return (andRound ? Math.round(dist * 10) / 10 : dist);
if (units.equals("nm")) return (andRound ? Math.round(dist * 100) / 1000 : dist / 10);
if (units.equals("pm")) return (andRound ? Math.round(dist * 1000) / 10 : dist * 100);
if (units.equals("au")) return (andRound ? Math.round(dist / 0.5291772 * 1000) / 1000 : dist / 0.5291772);
if (units.endsWith("khz")) return (andRound ? Math.round(dist / 10) / 100 : dist / 1000);
return (andRound ? Math.round(dist * 100) / 100 : dist);
}, "~N,~S,~B");
c$.fromUnits = Clazz_defineMethod(c$, "fromUnits", 
function(dist, units){
if (units.equals("nm")) return dist * 10;
if (units.equals("pm")) return dist / 100;
if (units.equals("au")) return dist * 0.5291772;
if (units.equals("\u00C5")) return dist;
return 0;
}, "~N,~S");
c$.fixUnits = Clazz_defineMethod(c$, "fixUnits", 
function(u){
var units = (u.endsWith("s") ? u.substring(0, u.length - 1) : u);
if (units.equals("nanometer")) return "nm";
 else if (units.equals("bohr") || units.equals("atomicunits") || units.equals("atomic")) return "au";
 else if (units.equals("picometer")) return "pm";
 else if (units.equals("\u00E5") || units.equals("angstrom") || units.equals("a") || units.equals("ang")) return "\u00C5";
 else if (units.equals("vanderwaal") || units.equals("vdw")) return "%";
return u;
}, "~S");
Clazz_defineMethod(c$, "getDistanceFormatForState", 
function(){
return (this.useDefaultLabel ? null : this.strFormat);
});
Clazz_defineMethod(c$, "setFromMD", 
function(md, andText){
this.modelIndex = md.modelIndex;
if (md.thisID != null) {
this.thisID = md.thisID;
if (md.text != null && md.text.text != null) this.text = md.text;
}this.units = ("default".equals(md.units) ? null : md.units);
this.property = md.property;
this.fixedValue = md.fixedValue;
if (md.colix != 0) this.colix = md.colix;
if (md.mad != 0) this.mad = md.mad;
if (md.strFormat != null) {
this.strFormat = (this.strFormat == null ? md.strFormat : this.strFormat.substring(0, 2)) + md.strFormat.substring(2);
}if (md.text != null) {
if (this.text == null) {
this.text = md.text;
} else {
if (md.text.font != null) {
this.text.setFont(md.text.font, false);
this.text.fontScale = md.text.font.fontSize / md.text.font.fontSizeNominal;
}this.text.text = null;
if (md.text.align != 0) this.text.align = md.text.align;
if (md.colix != 0) this.labelColix = this.text.colix = md.text.colix;
}}this.formatMeasurement(null);
}, "JM.MeasurementData,~B");
});
;//5.0.1-v7 Mon Aug 24 10:01:38 CDT 2026
Clazz_declarePackage("JM");
Clazz_load(["J.api.JmolMeasurementClient"], "JM.MeasurementData", ["JU.Lst", "JM.Measurement"], function(){
var c$ = Clazz_decorateAsClass(function(){
this.client = null;
this.bsSelected = null;
this.measurementStrings = null;
this.measurements = null;
this.points = null;
this.mustBeConnected = false;
this.mustNotBeConnected = false;
this.tickInfo = null;
this.tokAction = 12290;
this.radiusData = null;
this.strFormat = null;
this.property = null;
this.note = null;
this.isAll = false;
this.colix = 0;
this.intramolecular = null;
this.mad = 0;
this.thisID = null;
this.text = null;
this.units = null;
this.fixedValue = 0;
this.atoms = null;
this.minArray = null;
this.ms = null;
this.allowSelf = false;
this.vwr = null;
this.iFirstAtom = 0;
this.justOneModel = true;
this.htMin = null;
this.modelIndex = 0;
Clazz_instantialize(this, arguments);}, JM, "MeasurementData", null, J.api.JmolMeasurementClient);
/*LV!1824 unnec constructor*/Clazz_defineMethod(c$, "init", 
function(id, vwr, points){
this.vwr = vwr;
this.points = points;
this.thisID = id;
return this;
}, "~S,JV.Viewer,JU.Lst");
Clazz_defineMethod(c$, "setModelSet", 
function(m){
this.ms = m;
return this;
}, "JM.ModelSet");
Clazz_defineMethod(c$, "set", 
function(tokAction, htMin, radiusData, property, strFormat, units, tickInfo, mustBeConnected, mustNotBeConnected, intramolecular, isAll, mad, colix, text, value, bsSelected){
this.ms = this.vwr.ms;
this.tokAction = tokAction;
if (this.points.size() >= 2 && Clazz_instanceOf(this.points.get(0),"JU.BS") && Clazz_instanceOf(this.points.get(1),"JU.BS")) {
this.justOneModel = this.vwr.ms.getModelBS(this.points.get(0), false).equals(this.vwr.ms.getModelBS(this.points.get(1), false));
}if (this.vwr.am.splitFrame) this.justOneModel = true;
this.bsSelected = bsSelected;
this.htMin = htMin;
this.radiusData = radiusData;
this.property = property;
this.strFormat = strFormat;
this.units = units;
this.tickInfo = tickInfo;
this.mustBeConnected = mustBeConnected;
this.mustNotBeConnected = mustNotBeConnected;
this.intramolecular = intramolecular;
this.isAll = isAll;
this.mad = mad;
this.colix = colix;
this.text = text;
this.fixedValue = value;
return this;
}, "~N,java.util.Map,J.atomdata.RadiusData,~S,~S,~S,JM.TickInfo,~B,~B,Boolean,~B,~N,~N,JM.Text,~N,JU.BS");
Clazz_defineMethod(c$, "processNextMeasure", 
function(md, m){
var value = m.getMeasurement(null);
if (this.htMin != null && !m.isMin(this.htMin) || this.radiusData != null && !m.isInRange(this.radiusData, value)) return;
if (this.measurementStrings == null && this.measurements == null) {
var f = this.minArray[this.iFirstAtom];
m.value = value;
value = m.fixValue(this.units, false);
this.minArray[this.iFirstAtom] = (1 / f == -Infinity ? value : Math.min(f, value));
return;
}if (this.measurementStrings != null) this.measurementStrings.addLast(m.getStringUsing(this.vwr, this.strFormat, this.units));
 else this.measurements.addLast(Float.$valueOf(m.getMeasurement(null)));
}, "JM.MeasurementData,JM.Measurement");
Clazz_defineMethod(c$, "getMeasurements", 
function(asFloatArray, asMinArray){
if (asMinArray) {
this.minArray =  Clazz_newFloatArray ((this.points.get(0)).cardinality(), 0);
for (var i = 0; i < this.minArray.length; i++) this.minArray[i] = -0.0;

this.define(null, this.ms);
return this.minArray;
}if (asFloatArray) {
this.allowSelf = true;
this.measurements =  new JU.Lst();
this.define(null, this.ms);
return this.measurements;
}this.measurementStrings =  new JU.Lst();
this.define(null, this.ms);
return this.measurementStrings;
}, "~B,~B");
Clazz_defineMethod(c$, "define", 
function(client, modelSet){
this.client = (client == null ? this : client);
this.atoms = modelSet.at;
var nPoints = this.points.size();
if (nPoints < 2) return;
this.modelIndex = -1;
var pts =  new Array(4);
var indices =  Clazz_newIntArray (5, 0);
var m =  new JM.Measurement().setPoints(modelSet, indices, pts, null);
m.setCount(nPoints);
m.property = this.property;
m.strFormat = this.strFormat;
m.units = this.units;
m.fixedValue = this.fixedValue;
var ptLastAtom = -1;
for (var i = 0; i < nPoints; i++) {
var obj = this.points.get(i);
if (Clazz_instanceOf(obj,"JU.BS")) {
var bs = obj;
var nAtoms = bs.cardinality();
if (nAtoms == 0) return;
if (nAtoms > 1) this.modelIndex = 0;
ptLastAtom = i;
if (i == 0) this.iFirstAtom = 0;
indices[i + 1] = bs.nextSetBit(0);
} else {
pts[i] = obj;
indices[i + 1] = -2 - i;
}}
this.nextMeasure(0, ptLastAtom, m, this.modelIndex);
}, "J.api.JmolMeasurementClient,JM.ModelSet");
Clazz_defineMethod(c$, "nextMeasure", 
function(thispt, ptLastAtom, m, thisModel){
if (thispt > ptLastAtom) {
if ((this.allowSelf && !this.mustBeConnected && !this.mustNotBeConnected || m.isValid()) && (!this.mustBeConnected || m.isConnected(this.atoms, thispt)) && (!this.mustNotBeConnected || !m.isConnected(this.atoms, thispt)) && (this.intramolecular == null || m.isIntramolecular(this.atoms, thispt) == this.intramolecular.booleanValue())) this.client.processNextMeasure(this, m);
return;
}var bs = this.points.get(thispt);
var indices = m.countPlusIndices;
var thisAtomIndex = (thispt == 0 ? 2147483647 : indices[thispt]);
if (thisAtomIndex < 0) {
this.nextMeasure(thispt + 1, ptLastAtom, m, thisModel);
return;
}var haveNext = false;
for (var i = bs.nextSetBit(0), pt = 0; i >= 0; i = bs.nextSetBit(i + 1), pt++) {
if (i == thisAtomIndex && !this.allowSelf) continue;
var modelIndex = this.atoms[i].mi;
if (thisModel >= 0 && this.justOneModel) {
if (thispt == 0) thisModel = modelIndex;
 else if (thisModel != modelIndex) continue;
}this.modelIndex = modelIndex;
indices[thispt + 1] = i;
if (thispt == 0) this.iFirstAtom = pt;
haveNext = true;
this.nextMeasure(thispt + 1, ptLastAtom, m, thisModel);
}
if (!haveNext) this.nextMeasure(thispt + 1, ptLastAtom, m, thisModel);
}, "~N,~N,JM.Measurement,~N");
});
;//5.0.1-v7 Mon Aug 24 10:01:38 CDT 2026
Clazz_declarePackage("JM");
Clazz_load(["JM.Measurement"], "JM.MeasurementPending", null, function(){
var c$ = Clazz_decorateAsClass(function(){
this.haveTarget = false;
this.haveModified = false;
this.numSet = 0;
this.lastIndex = -1;
Clazz_instantialize(this, arguments);}, JM, "MeasurementPending", JM.Measurement);
Clazz_defineMethod(c$, "set", 
function(modelSet){
return this.setM(modelSet, null, NaN, 0, null, 0);
}, "JM.ModelSet");
Clazz_defineMethod(c$, "checkPoint", 
function(ptClicked){
for (var i = 1; i <= this.numSet; i++) if (this.countPlusIndices[i] == -1 - i && this.pts[i - 1].distance(ptClicked) < 0.01) return false;

return true;
}, "JU.Point3fi");
Clazz_defineMethod(c$, "getIndexOf", 
function(atomIndex){
for (var i = 1; i <= this.numSet; i++) if (this.countPlusIndices[i] == atomIndex) return i;

return 0;
}, "~N");
Clazz_overrideMethod(c$, "setCount", 
function(count){
this.setCountM(count);
this.numSet = count;
}, "~N");
Clazz_defineMethod(c$, "addPoint", 
function(atomIndex, ptClicked, doSet){
if (atomIndex >= 0 && this.ms.vwr.am.splitFrame) {
var mi = this.ms.at[atomIndex].mi;
if (this.count > 0) {
if (mi != this.modelIndex) return this.count;
} else {
this.modelIndex = mi;
}}this.haveModified = (atomIndex != this.lastIndex);
this.lastIndex = atomIndex;
if (ptClicked == null) {
if (this.getIndexOf(atomIndex) > 0) {
if (doSet) this.numSet = this.count;
return this.count;
}this.haveTarget = (atomIndex >= 0);
if (!this.haveTarget) return this.count = this.numSet;
this.count = this.numSet + 1;
this.countPlusIndices[this.count] = atomIndex;
} else {
if (!this.checkPoint(ptClicked)) {
if (doSet) this.numSet = this.count;
return this.count;
}var pt = this.numSet;
this.haveModified = this.haveTarget = true;
this.count = this.numSet + 1;
this.pts[pt] = ptClicked;
this.countPlusIndices[this.count] = -2 - pt;
}this.countPlusIndices[0] = this.count;
if (doSet) this.numSet = this.count;
this.value = this.getMeasurement(null);
this.strFormat = null;
this.formatMeasurement(null);
return this.count;
}, "~N,JU.Point3fi,~B");
});
;//5.0.1-v7 Mon Aug 24 10:01:38 CDT 2026
Clazz_declarePackage("JM");
Clazz_load(null, "JM.Model", ["java.util.Hashtable", "JU.AU", "$.BS", "$.M3", "$.P3", "$.SB", "JS.T", "JU.BSUtil", "JV.FileManager"], function(){
var c$ = Clazz_decorateAsClass(function(){
this.ms = null;
this.mat4 = null;
this.modelIndex = 0;
this.fileIndex = 0;
this.isBioModel = false;
this.isPdbWithMultipleBonds = false;
this.isModelKit = false;
this.chains = null;
this.simpleCage = null;
this.annotationCache = null;
this.orientation = null;
this.auxiliaryInfo = null;
this.properties = null;
this.biosymmetry = null;
this.translation = null;
this.loadState = "";
this.loadScript = null;
this.hasRasmolHBonds = false;
this.structureTainted = false;
this.isJmolDataFrame = false;
this.isTrajectory = false;
this.trajectoryBaseIndex = 0;
this.altLocCount = 0;
this.insertionCount = 0;
this.act = 0;
this.bondCount = -1;
this.chainCount = 0;
this.groupCount = -1;
this.hydrogenCount = 0;
this.moleculeCount = 0;
this.biosymmetryCount = 0;
this.firstAtomIndex = 0;
this.firstMoleculeIndex = 0;
this.bsAtoms = null;
this.bsAtomsDeleted = null;
this.defaultRotationRadius = 0;
this.frameDelay = 0;
this.selectedTrajectory = -1;
this.jmolData = null;
this.jmolFrameType = null;
this.jmolFrameTypeInt = 0;
this.dataFrames = null;
this.dataSourceFrame = 0;
this.uvw = null;
this.uvw0 = null;
this.pdbID = null;
this.bsCheck = null;
this.hasChirality = false;
this.isOrderly = true;
this.bsAsymmetricUnit = null;
Clazz_instantialize(this, arguments);}, JM, "Model", null);
Clazz_makeConstructor(c$, 
function(){
this.setupArrays();
});
Clazz_defineMethod(c$, "setupArrays", 
function(){
this.chains =  new Array(8);
this.loadScript =  new JU.SB();
this.bsAtoms =  new JU.BS();
this.bsAtomsDeleted =  new JU.BS();
});
Clazz_defineMethod(c$, "set", 
function(modelSet, modelIndex, trajectoryBaseIndex, jmolData, properties, auxiliaryInfo){
this.ms = modelSet;
this.dataSourceFrame = this.modelIndex = modelIndex;
this.isTrajectory = (trajectoryBaseIndex >= 0);
this.trajectoryBaseIndex = (this.isTrajectory ? trajectoryBaseIndex : modelIndex);
if (auxiliaryInfo == null) {
auxiliaryInfo =  new java.util.Hashtable();
}this.auxiliaryInfo = auxiliaryInfo;
var bc = (auxiliaryInfo.get("biosymmetryCount"));
if (bc != null) {
this.biosymmetryCount = bc.intValue();
this.biosymmetry = auxiliaryInfo.get("bioSymmetry");
}var fname = auxiliaryInfo.get("fileName");
if (fname != null) auxiliaryInfo.put("fileName", JV.FileManager.stripTypePrefix(fname));
this.properties = properties;
if (jmolData == null) {
this.jmolFrameType = "modelSet";
} else {
var jmolDataHeader = jmolData.get("header");
this.jmolData = jmolData;
this.isJmolDataFrame = true;
auxiliaryInfo.put("jmolData", jmolData);
auxiliaryInfo.put("title", jmolDataHeader);
this.jmolFrameType = (jmolDataHeader.indexOf("ramachandran") >= 0 ? "ramachandran" : jmolDataHeader.indexOf("quaternion") >= 0 ? "quaternion" : jmolDataHeader.indexOf("spin") >= 0 ? "spin" : "data");
this.jmolFrameTypeInt = JS.T.getTokFromName(this.jmolFrameType);
System.out.println("JmolFrameType is " + JS.T.nameOf(this.jmolFrameTypeInt));
}return this;
}, "JM.ModelSet,~N,~N,java.util.Map,java.util.Properties,java.util.Map");
Clazz_defineMethod(c$, "getTrueAtomCount", 
function(){
return JU.BSUtil.andNot(this.bsAtoms, this.bsAtomsDeleted).cardinality();
});
Clazz_defineMethod(c$, "isContainedIn", 
function(bs){
if (this.bsCheck == null) this.bsCheck =  new JU.BS();
this.bsCheck.clearAll();
this.bsCheck.or(bs);
var bsa = JU.BSUtil.andNot(this.bsAtoms, this.bsAtomsDeleted);
this.bsCheck.and(bsa);
return this.bsCheck.equals(bsa);
}, "JU.BS");
Clazz_defineMethod(c$, "resetBoundCount", 
function(){
this.bondCount = -1;
});
Clazz_defineMethod(c$, "getBondCount", 
function(){
if (this.bondCount >= 0) return this.bondCount;
var bonds = this.ms.bo;
this.bondCount = 0;
for (var i = this.ms.bondCount; --i >= 0; ) if (bonds[i] != null && bonds[i].atom1.mi == this.modelIndex) this.bondCount++;

return this.bondCount;
});
Clazz_defineMethod(c$, "getChainCount", 
function(countWater){
if (this.chainCount > 1 && !countWater) for (var i = 0; i < this.chainCount; i++) if (this.chains[i].chainID == 0) return this.chainCount - 1;

return this.chainCount;
}, "~B");
Clazz_defineMethod(c$, "calcSelectedGroupsCount", 
function(bsSelected){
for (var i = this.chainCount; --i >= 0; ) this.chains[i].calcSelectedGroupsCount(bsSelected);

}, "JU.BS");
Clazz_defineMethod(c$, "getGroupCount", 
function(){
if (this.groupCount < 0) {
this.groupCount = 0;
for (var i = this.chainCount; --i >= 0; ) this.groupCount += this.chains[i].groupCount;

}return this.groupCount;
});
Clazz_defineMethod(c$, "getChainAt", 
function(i){
return (i < this.chainCount ? this.chains[i] : null);
}, "~N");
Clazz_defineMethod(c$, "getChain", 
function(chainID){
for (var i = this.chainCount; --i >= 0; ) {
var chain = this.chains[i];
if (chain.chainID == chainID) return chain;
}
return null;
}, "~N");
Clazz_defineMethod(c$, "resetDSSR", 
function(totally){
this.annotationCache = null;
if (totally) this.auxiliaryInfo.remove("dssr");
}, "~B");
Clazz_defineMethod(c$, "fixIndices", 
function(modelIndex, nAtomsDeleted, bsDeleted){
this.fixIndicesM(modelIndex, nAtomsDeleted, bsDeleted);
}, "~N,~N,JU.BS");
Clazz_defineMethod(c$, "fixIndicesM", 
function(modelIndex, nAtomsDeleted, bsDeleted){
if (this.dataSourceFrame > modelIndex) this.dataSourceFrame--;
if (this.trajectoryBaseIndex > modelIndex) this.trajectoryBaseIndex--;
this.firstAtomIndex -= nAtomsDeleted;
for (var i = 0; i < this.chainCount; i++) this.chains[i].fixIndices(nAtomsDeleted, bsDeleted);

JU.BSUtil.deleteBits(this.bsAtoms, bsDeleted);
JU.BSUtil.deleteBits(this.bsAtomsDeleted, bsDeleted);
}, "~N,~N,JU.BS");
Clazz_defineMethod(c$, "freeze", 
function(){
this.freezeM();
return false;
});
Clazz_defineMethod(c$, "freezeM", 
function(){
for (var i = 0; i < this.chainCount; i++) if (this.chains[i].groupCount == 0) {
for (var j = i + 1; j < this.chainCount; j++) this.chains[j - 1] = this.chains[j];

this.chainCount--;
}
this.chains = JU.AU.arrayCopyObject(this.chains, this.chainCount);
this.groupCount = -1;
this.getGroupCount();
for (var i = 0; i < this.chainCount; ++i) this.chains[i].groups = JU.AU.arrayCopyObject(this.chains[i].groups, this.chains[i].groupCount);

});
Clazz_defineMethod(c$, "getUVWMatrix", 
function(isUVW0){
if (this.uvw0 == null) {
return null;
}var m =  new JU.M3();
for (var i = 0; i < 3; i++) {
var p = JU.P3.newP(isUVW0 ? this.uvw0[i] : this.uvw[i]);
p.normalize();
m.setColumnV(i, p);
}
return m;
}, "~B");
});
;//5.0.1-v7 Mon Aug 24 10:19:01 CDT 2026
Clazz_declarePackage("JM");
Clazz_load(["java.util.Hashtable", "JU.BS"], "JM.ModelLoader", ["java.util.Arrays", "JU.AU", "$.Lst", "$.P3", "$.PT", "$.SB", "$.V3", "J.api.Interface", "JM.AtomCollection", "$.Chain", "$.Group", "$.Model", "$.ModelSet", "JS.T", "JU.BSUtil", "$.Elements", "$.JmolMolecule", "$.Logger", "JV.JC"], function(){
var c$ = Clazz_decorateAsClass(function(){
this.vwr = null;
this.ms = null;
this.modelSet0 = null;
this.merging = false;
this.appendNew = false;
this.jmolData = null;
this.group3Lists = null;
this.group3Counts = null;
this.specialAtomIndexes = null;
this.someModelsHaveUnitcells = false;
this.someModelsAreModulated = false;
this.is2D = false;
this.isMOL2D = false;
this.isMutate = false;
this.isTrajectory = false;
this.isPyMOLsession = false;
this.doMinimize = false;
this.doAddPDBHydrogens = false;
this.fileHeader = null;
this.jbr = null;
this.groups = null;
this.groupCount = 0;
this.modulationTUV = null;
this.noH = false;
this.htAtomMap = null;
this.chainOf = null;
this.group3Of = null;
this.seqcodes = null;
this.firstAtomIndexes = null;
this.iModel = 0;
this.model = null;
this.currentChainID = 0;
this.isNewChain = false;
this.currentChain = null;
this.currentGroupSequenceNumber = 0;
this.currentGroupInsertionCode = '\0';
this.currentGroup3 = null;
this.nullGroup = null;
this.baseModelIndex = 0;
this.baseModelCount = 0;
this.baseAtomIndex = 0;
this.baseGroupIndex = 0;
this.baseTrajectoryCount = 0;
this.adapterModelCount = 0;
this.adapterTrajectoryCount = 0;
this.noAutoBond = false;
this.modulationOn = false;
this.htGroup1 = null;
this.appendToModelIndex = null;
this.$mergeGroups = null;
this.iChain = 0;
this.vStereo = null;
this.lastModel = -1;
this.structuresDefinedInFile = null;
Clazz_instantialize(this, arguments);}, JM, "ModelLoader", null);
Clazz_prepareFields (c$, function(){
this.htAtomMap =  new java.util.Hashtable();
this.structuresDefinedInFile =  new JU.BS();
});
Clazz_makeConstructor(c$, 
function(vwr, modelSetName, loadScript, asc, modelSet0, bsNew){
this.vwr = vwr;
this.ms =  new JM.ModelSet(vwr, modelSetName);
var adapter = vwr.getModelAdapter();
this.modelSet0 = modelSet0;
this.merging = (modelSet0 != null && (modelSet0.ac > 0 || modelSet0.vwr.getOperativeSymmetry() != null));
if (this.merging) {
this.ms.canSkipLoad = false;
} else {
vwr.resetShapes(false);
}this.ms.preserveState = vwr.getPreserveState();
this.ms.showRebondTimes = vwr.getBoolean(603979934);
if (bsNew == null) {
this.initializeInfo(modelSetName, null);
this.createModelSet(null, null, null);
vwr.setStringProperty("_fileType", "");
return;
}if (!this.ms.preserveState) this.ms.canSkipLoad = false;
var info = adapter.getAtomSetCollectionAuxiliaryInfo(asc);
info.put("loadScript", loadScript);
this.initializeInfo(adapter.getFileTypeName(asc).toLowerCase().intern(), info);
this.createModelSet(adapter, asc, bsNew);
if (info.get("lowPrecision") != null) {
vwr.setBooleanPropertyTok("doublePrecision", 603979831, false);
}if (this.jbr != null) this.jbr.setLoader(null);
this.jbr = null;
}, "JV.Viewer,~S,JU.SB,~O,JM.ModelSet,JU.BS");
Clazz_defineMethod(c$, "initializeInfo", 
function(name, info){
this.ms.g3d = this.vwr.gdata;
this.ms.modelSetTypeName = name;
this.ms.isXYZ = (name === "xyz");
this.ms.msInfo = info;
this.ms.modelSetProperties = this.ms.getInfoM("properties");
this.ms.haveBioModels = this.ms.getMSInfoB(JV.JC.getBoolName(4));
if (this.ms.haveBioModels) {
this.jbr = this.vwr.getJBR().setLoader(this);
this.jbr.carbohydrates = info.get("carbohydrates");
}this.isMutate = this.ms.getMSInfoB("isMutate");
this.jmolData = (this.adapterModelCount == 0 ? this.ms.getInfoM("jmolData") : null);
this.fileHeader = this.ms.getInfoM("fileHeader");
var steps = this.ms.getInfoM("trajectorySteps");
this.isTrajectory = (steps != null);
if (this.isTrajectory) this.ms.trajectory = this.newTrajectory(this.ms, steps);
this.isPyMOLsession = this.ms.getMSInfoB("isPyMOL");
this.doAddPDBHydrogens = (this.jbr != null && !this.isTrajectory && !this.isPyMOLsession && !this.ms.getMSInfoB("pdbNoHydrogens") && (this.ms.getMSInfoB("pdbAddHydrogens") || this.vwr.getBoolean(603979894)));
if (info != null) {
info.remove("pdbNoHydrogens");
info.remove("pdbAddHydrogens");
info.remove("trajectorySteps");
if (this.isTrajectory) this.ms.vibrationSteps = info.remove("vibrationSteps");
if (info.containsKey("highPrecision")) {
this.vwr.setBooleanProperty("legacyJavaFloat", true);
}}this.htGroup1 = this.ms.getInfoM("htGroup1");
var mod = this.ms.getInfoM("modulationOn");
if (mod != null) {
this.modulationOn = true;
this.modulationTUV = (mod === Boolean.TRUE ? null : mod);
}this.noAutoBond = this.ms.getMSInfoB("noAutoBond");
this.noH = this.ms.getMSInfoB("noHydrogen");
this.is2D = this.ms.getMSInfoB("is2D");
this.doMinimize = (this.is2D && !this.noH || this.ms.getMSInfoB("minimize3D")) && this.ms.getMSInfoB("doMinimize");
this.adapterTrajectoryCount = (this.isTrajectory ? this.ms.trajectory.steps.size() : 0);
this.ms.someModelsHaveSymmetry = this.ms.getMSInfoB(JV.JC.getBoolName(1));
this.someModelsHaveUnitcells = this.ms.getMSInfoB(JV.JC.getBoolName(2));
this.someModelsAreModulated = this.ms.getMSInfoB(JV.JC.getBoolName(9));
this.ms.someModelsHaveFractionalCoordinates = this.ms.getMSInfoB(JV.JC.getBoolName(1));
if (this.merging) {
this.ms.haveBioModels = new Boolean (this.ms.haveBioModels | this.modelSet0.haveBioModels).valueOf();
this.ms.bioModelset = this.modelSet0.bioModelset;
if (this.ms.bioModelset != null) this.ms.bioModelset.set(this.vwr, this.ms);
this.ms.someModelsHaveSymmetry = new Boolean (this.ms.someModelsHaveSymmetry | this.modelSet0.getMSInfoB(JV.JC.getBoolName(1))).valueOf();
this.someModelsHaveUnitcells = new Boolean (this.someModelsHaveUnitcells | this.modelSet0.getMSInfoB(JV.JC.getBoolName(2))).valueOf();
this.ms.someModelsHaveFractionalCoordinates = new Boolean (this.ms.someModelsHaveFractionalCoordinates | this.modelSet0.getMSInfoB(JV.JC.getBoolName(0))).valueOf();
this.ms.someModelsHaveAromaticBonds = new Boolean (this.ms.someModelsHaveAromaticBonds | this.modelSet0.someModelsHaveAromaticBonds).valueOf();
this.ms.msInfo.put(JV.JC.getBoolName(1), Boolean.$valueOf(this.ms.someModelsHaveSymmetry));
this.ms.msInfo.put(JV.JC.getBoolName(2), Boolean.$valueOf(this.someModelsHaveUnitcells));
this.ms.msInfo.put(JV.JC.getBoolName(0), Boolean.$valueOf(this.ms.someModelsHaveFractionalCoordinates));
this.ms.msInfo.put(JV.JC.getBoolName(8), Boolean.$valueOf(this.ms.someModelsHaveAromaticBonds));
}}, "~S,java.util.Map");
Clazz_defineMethod(c$, "newTrajectory", 
function(ms, steps){
return (J.api.Interface.getInterface("JM.Trajectory", this.vwr, "load")).set(this.vwr, ms, steps);
}, "JM.ModelSet,JU.Lst");
Clazz_defineMethod(c$, "getGroup3", 
function(iGroup){
return (iGroup >= this.group3Of.length ? null : this.group3Of[iGroup]);
}, "~N");
Clazz_defineMethod(c$, "getFirstAtomIndex", 
function(iGroup){
return this.firstAtomIndexes[iGroup];
}, "~N");
Clazz_defineMethod(c$, "getAtomCount", 
function(){
return this.ms.ac;
});
Clazz_defineMethod(c$, "createModelSet", 
function(adapter, asc, bs2D){
var nAtoms = (adapter == null ? 0 : adapter.getAtomCount(asc, -1));
if (nAtoms > 0) JU.Logger.info("reading " + nAtoms + " atoms");
this.adapterModelCount = (adapter == null ? 1 : adapter.getAtomSetCount(asc));
this.appendToModelIndex = (this.ms.msInfo == null ? null : (this.ms.msInfo.get("appendToModelIndex")));
this.appendNew = !this.isMutate && (!this.merging || adapter == null || this.adapterModelCount > 1 || this.isTrajectory || this.vwr.getBoolean(603979792) && this.appendToModelIndex == null);
this.htAtomMap.clear();
this.chainOf =  new Array(32);
this.group3Of =  new Array(32);
this.seqcodes =  Clazz_newIntArray (32, 0);
this.firstAtomIndexes =  Clazz_newIntArray (32, 0);
this.currentChainID = 2147483647;
this.currentChain = null;
this.currentGroupInsertionCode = '\uFFFF';
this.currentGroup3 = "xxxxx";
this.iModel = -1;
this.model = null;
if (this.merging) this.mergeTrajAndVib(this.modelSet0, this.ms);
this.initializeAtomBondModelCounts(nAtoms);
if (!this.noH && bs2D != null && (this.doMinimize || this.is2D)) {
bs2D.setBits(this.baseAtomIndex, this.baseAtomIndex + adapter.getAtomCount(asc, 0));
}if (adapter == null) {
this.setModelNameNumberProperties(0, -1, "", 1, null, null, null);
} else {
if (this.adapterModelCount > 0) {
JU.Logger.info("ModelSet: haveSymmetry:" + this.ms.someModelsHaveSymmetry + " haveUnitcells:" + this.someModelsHaveUnitcells + " haveFractionalCoord:" + this.ms.someModelsHaveFractionalCoordinates);
JU.Logger.info(this.adapterModelCount + " model" + (this.ms.mc == 1 ? "" : "s") + " in this collection. Use getProperty \"modelInfo\" or" + " getProperty \"auxiliaryInfo\" to inspect them.");
}var q = this.ms.getInfoM("defaultOrientationQuaternion");
if (q != null) {
JU.Logger.info("defaultOrientationQuaternion = " + q);
JU.Logger.info("Use \"set autoLoadOrientation TRUE\" before loading or \"restore orientation DEFAULT\" after loading to view this orientation.");
}this.iterateOverAllNewModels(adapter, asc);
var iterBond = adapter.getBondIterator(asc);
var haveBonds = (iterBond != null);
this.iterateOverAllNewAtoms(adapter, asc, haveBonds);
var mad = this.vwr.getMadBond();
if (haveBonds) {
this.ms.defaultCovalentMad = (this.jmolData == null ? mad : 0);
this.iterateOverAllNewBonds(iterBond);
}this.ms.defaultCovalentMad = mad;
if (this.merging && !this.appendNew) {
var info = adapter.getAtomSetAuxiliaryInfo(asc, 0);
this.ms.setInfo(this.baseModelIndex, "initialAtomCount", info.get("initialAtomCount"));
this.ms.setInfo(this.baseModelIndex, "initialBondCount", info.get("initialBondCount"));
}this.initializeUnitCellAndSymmetry();
this.initializeBonding();
}this.finalizeGroupBuild();
if (this.is2D && this.doMinimize) {
this.setupMinimization();
}if (this.doAddPDBHydrogens) this.jbr.finalizeHydrogens();
if (adapter != null) {
this.ms.calculatePolymers(this.groups, this.groupCount, this.baseGroupIndex, null);
if (this.jbr != null) this.jbr.iterateOverAllNewStructures(adapter, asc);
}this.setDefaultRendering(this.vwr.getInt(553648170));
var rd = this.vwr.rd;
var ac = this.ms.ac;
var atoms = this.ms.at;
for (var i = this.baseAtomIndex; i < ac; i++) atoms[i].setMadAtom(this.vwr, rd);

var models = this.ms.am;
for (var i = models[this.baseModelIndex].firstAtomIndex; i < ac; i++) if (atoms[i] != null) models[atoms[i].mi].bsAtoms.set(i);

this.freeze();
this.finalizeShapes();
this.vwr.setModelSet(this.ms);
this.setAtomProperties();
if (adapter != null) adapter.finish(asc);
if (this.modelSet0 != null) {
this.modelSet0.releaseModelSet();
}this.modelSet0 = null;
}, "J.api.JmolAdapter,~O,JU.BS");
Clazz_defineMethod(c$, "mergeTrajAndVib", 
function(oldSet, newSet){
this.baseModelCount = oldSet.mc;
this.baseTrajectoryCount = 0;
if (oldSet.trajectory == null) {
if (this.isTrajectory) this.newTrajectory(oldSet,  new JU.Lst());
}if (oldSet.trajectory == null || oldSet.mc == 0) return;
this.baseTrajectoryCount = oldSet.mc;
var n = oldSet.trajectory.steps.size();
for (var i = n; i < this.baseTrajectoryCount; i++) oldSet.trajectory.steps.addLast(null);

if (this.isTrajectory) {
if (oldSet.vibrationSteps == null) {
oldSet.vibrationSteps =  new JU.Lst();
for (var i = n; --i >= 0; ) oldSet.vibrationSteps.addLast(null);

}n = newSet.trajectory.steps.size();
for (var i = 0; i < n; i++) {
oldSet.trajectory.steps.addLast(newSet.trajectory.steps.get(i));
oldSet.vibrationSteps.addLast(newSet.vibrationSteps == null ? null : newSet.vibrationSteps.get(i));
}
} else {
newSet.trajectory = this.newTrajectory(newSet, null);
}newSet.vibrationSteps = oldSet.vibrationSteps;
newSet.trajectory.steps = oldSet.trajectory.steps;
oldSet.trajectory = null;
}, "JM.ModelSet,JM.ModelSet");
Clazz_defineMethod(c$, "setDefaultRendering", 
function(maxAtoms){
if (this.isPyMOLsession) return;
var sb =  new JU.SB();
var modelCount = this.ms.mc;
var models = this.ms.am;
for (var i = this.baseModelIndex; i < modelCount; i++) if (models[i].isBioModel) (models[i]).getDefaultLargePDBRendering(sb, maxAtoms);

if (sb.length() == 0) return;
sb.append("select *;");
var script = this.ms.getInfoM("jmolscript");
if (script == null) script = "";
sb.append(script);
this.ms.msInfo.put("jmolscript", sb.toString());
}, "~N");
Clazz_defineMethod(c$, "setAtomProperties", 
function(){
var modelCount = this.ms.mc;
for (var i = this.baseModelIndex; i < modelCount; i++) {
var atomProperties = this.ms.getInfo(i, "atomProperties");
if (this.jmolData != null) this.addJmolDataProperties(this.ms.am[i], this.ms.getInfo(i, "jmolData"));
var groupList = this.ms.getInfo(i, "groupPropertyList");
if (this.ms.am[i].isBioModel && this.ms.getInfo(i, "dssr") != null) this.vwr.getAnnotationParser(1111490587).setGroup1(this.ms, i);
if (atomProperties == null) continue;
for (var entry, $entry = atomProperties.entrySet().iterator (); $entry.hasNext()&& ((entry = $entry.next ()) || true);) {
var key = entry.getKey();
var value = entry.getValue();
var bs = this.ms.getModelAtomBitSetIncludingDeleted(i, true);
if (this.doAddPDBHydrogens) {
var isGroup = (groupList != null && JU.PT.isOneOf(key, groupList));
value = this.jbr.fixPropertyValue(bs, value, isGroup);
}key = "property_" + key.toLowerCase();
JU.Logger.info("creating " + key + " for model " + this.ms.getModelName(i));
this.vwr.setData(key,  Clazz_newArray(-1, [key, value, bs, Integer.$valueOf(-1), Boolean.FALSE, entry]), this.ms.ac, 0, 0, 2147483647, 0);
}
this.ms.setInfo(i, "atomProperties", null);
}
});
Clazz_defineMethod(c$, "initializeAtomBondModelCounts", 
function(nAtoms){
var trajectoryCount = this.adapterTrajectoryCount;
if (this.merging) {
if (this.appendNew) {
this.baseModelIndex = this.baseModelCount;
this.ms.mc = this.baseModelCount + this.adapterModelCount;
} else {
this.baseModelIndex = (this.appendToModelIndex == null ? this.vwr.am.cmi : this.appendToModelIndex.intValue());
if (this.baseModelIndex < 0 || this.baseModelIndex >= this.baseModelCount) this.baseModelIndex = this.baseModelCount - 1;
this.ms.mc = this.baseModelCount;
}this.ms.ac = this.baseAtomIndex = this.modelSet0.ac;
this.ms.bondCount = this.modelSet0.bondCount;
this.$mergeGroups = this.modelSet0.getGroups();
this.groupCount = this.baseGroupIndex = this.$mergeGroups.length;
this.ms.mergeModelArrays(this.modelSet0);
this.ms.growAtomArrays(this.ms.ac + nAtoms);
} else {
this.ms.mc = this.adapterModelCount;
this.ms.ac = 0;
this.ms.bondCount = 0;
this.ms.at =  new Array(nAtoms);
this.ms.bo =  new Array(250 + nAtoms);
}if (this.doAddPDBHydrogens) this.jbr.initializeHydrogenAddition();
if (trajectoryCount > 1) this.ms.mc += trajectoryCount - 1;
this.ms.am = JU.AU.arrayCopyObject(this.ms.am, this.ms.mc);
this.ms.modelFileNumbers = JU.AU.arrayCopyI(this.ms.modelFileNumbers, this.ms.mc);
this.ms.modelNumbers = JU.AU.arrayCopyI(this.ms.modelNumbers, this.ms.mc);
this.ms.modelNumbersForAtomLabel = JU.AU.arrayCopyS(this.ms.modelNumbersForAtomLabel, this.ms.mc);
this.ms.modelNames = JU.AU.arrayCopyS(this.ms.modelNames, this.ms.mc);
this.ms.frameTitles = JU.AU.arrayCopyS(this.ms.frameTitles, this.ms.mc);
if (this.merging) for (var i = 0; i < this.modelSet0.mc; i++) (this.ms.am[i] = this.modelSet0.am[i]).ms = this.ms;

}, "~N");
Clazz_defineMethod(c$, "mergeGroups", 
function(){
var info = this.modelSet0.getModelSetAuxiliaryInfo(null);
var mergeGroup3Lists = info.get("group3Lists");
var mergeGroup3Counts = info.get("group3Counts");
var nLists = (mergeGroup3Lists == null ? 0 : mergeGroup3Lists.length);
if (mergeGroup3Lists != null) {
for (var i = 0; i < this.baseModelCount; i++) {
if (i < nLists) {
this.group3Lists[i + 1] = mergeGroup3Lists[i + 1];
this.group3Counts[i + 1] = mergeGroup3Counts[i + 1];
}this.structuresDefinedInFile.set(i);
}
this.group3Lists[0] = mergeGroup3Lists[0];
this.group3Counts[0] = mergeGroup3Counts[0];
}if (!this.appendNew && this.ms.haveBioModels) this.structuresDefinedInFile.clear(this.baseModelIndex);
});
Clazz_defineMethod(c$, "iterateOverAllNewModels", 
function(adapter, asc){
this.group3Lists =  new Array(this.ms.mc + 1);
this.group3Counts = JU.AU.newInt2(this.ms.mc + 1);
this.structuresDefinedInFile =  new JU.BS();
if (this.merging) this.mergeGroups();
var iTrajectory = (this.isTrajectory ? this.baseTrajectoryCount : -1);
var ipt = this.baseModelIndex;
for (var i = 0; i < this.adapterModelCount; ++i, ++ipt) {
var modelNumber = adapter.getAtomSetNumber(asc, i);
var modelName = adapter.getAtomSetName(asc, i);
var modelAuxiliaryInfo = adapter.getAtomSetAuxiliaryInfo(asc, i);
if (modelAuxiliaryInfo.containsKey("modelID")) modelAuxiliaryInfo.put("modelID0", modelAuxiliaryInfo.get("modelID"));
var modelProperties = modelAuxiliaryInfo.get("modelProperties");
if (!this.merging || this.appendNew) {
var ftype = modelAuxiliaryInfo.get("fileType");
this.vwr.setStringProperty("_fileType", ftype);
this.vwr.fm.setFileType(ftype);
}if (modelName == null) {
if (this.jmolData != null) {
modelName = this.jmolData.get("header");
modelName = (modelName.indexOf(";") > 2 ? modelName.substring(modelName.indexOf(":") + 2, modelName.indexOf(";")) : null);
}if (modelName == null) modelName = (this.appendNew ? "" + (modelNumber % 1000000) : "");
}this.setModelNameNumberProperties(ipt, iTrajectory, modelName, modelNumber, modelProperties, modelAuxiliaryInfo, this.jmolData);
}
var m = this.ms.am[this.appendToModelIndex == null ? this.baseModelIndex : this.ms.mc - 1];
this.vwr.setSmilesString(this.ms.msInfo.get("smilesString"));
var loadState = this.ms.msInfo.remove("loadState");
var loadScript = this.ms.msInfo.remove("loadScript");
if (loadScript.indexOf("Viewer.AddHydrogens") < 0 || !m.isModelKit) {
var lines = JU.PT.split(loadState, "\n");
var sb =  new JU.SB();
for (var i = 0; i < lines.length; i++) {
var pt = m.loadState.indexOf(lines[i]);
if (pt < 0 || pt != m.loadState.lastIndexOf(lines[i])) sb.append(lines[i]).appendC('\n');
}
m.loadState += m.loadScript.toString() + sb.toString();
m.loadScript =  new JU.SB();
if (loadScript.indexOf("load append ") >= 0 || loadScript.indexOf("data \"append ") >= 0) {
loadScript.insert(0, ";var anew = appendNew;");
loadScript.append(";set appendNew anew");
}m.loadScript.append("  ").appendSB(loadScript).append(";\n");
}if (this.isTrajectory) {
var n = (this.ms.mc - ipt + 1);
JU.Logger.info(n + " trajectory steps read");
this.ms.setInfo(this.baseModelCount, "trajectoryStepCount", Integer.$valueOf(n));
for (var ia = this.adapterModelCount, i = ipt; i < this.ms.mc; i++, ia++) {
this.ms.am[i] = this.ms.am[this.baseModelCount];
this.ms.modelNumbers[i] = adapter.getAtomSetNumber(asc, ia);
this.ms.modelNames[i] = adapter.getAtomSetName(asc, ia);
this.structuresDefinedInFile.set(i);
}
}this.finalizeModels(this.baseModelCount);
}, "J.api.JmolAdapter,~O");
Clazz_defineMethod(c$, "setModelNameNumberProperties", 
function(modelIndex, trajectoryBaseIndex, modelName, modelNumber, modelProperties, modelAuxiliaryInfo, jmolData){
if (this.appendNew) {
var modelIsPDB = (modelAuxiliaryInfo != null && Boolean.TRUE === modelAuxiliaryInfo.get(JV.JC.getBoolName(4)));
this.ms.am[modelIndex] = (modelIsPDB ? this.jbr.getBioModel(modelIndex, trajectoryBaseIndex, jmolData, modelProperties, modelAuxiliaryInfo) :  new JM.Model().set(this.ms, modelIndex, trajectoryBaseIndex, jmolData, modelProperties, modelAuxiliaryInfo));
this.ms.modelNumbers[modelIndex] = modelNumber;
this.ms.modelNames[modelIndex] = modelName;
if (modelIsPDB) this.jbr.setGroupLists(modelIndex);
} else {
var atomInfo = modelAuxiliaryInfo.get("PDB_CONECT_firstAtom_count_max");
if (atomInfo != null) this.ms.setInfo(modelIndex, "PDB_CONECT_firstAtom_count_max", atomInfo);
}var models = this.ms.am;
var atoms = this.ms.at;
models[modelIndex].bsAtoms.set(atoms.length + 1);
models[modelIndex].bsAtoms.clear(atoms.length + 1);
var codes = this.ms.getInfo(modelIndex, "altLocs");
models[modelIndex].altLocCount = (codes == null ? 0 : codes.length);
if (codes != null) {
var altlocs = codes.toCharArray();
java.util.Arrays.sort(altlocs);
codes = String.valueOf(altlocs);
this.ms.setInfo(modelIndex, "altLocs", codes);
}codes = this.ms.getInfo(modelIndex, "insertionCodes");
models[modelIndex].insertionCount = (codes == null ? 0 : codes.length);
var isModelKit = (this.ms.modelSetName != null && this.ms.modelSetName.startsWith("Jmol Model Kit") || modelName.startsWith("Jmol Model Kit") || "Jme".equals(this.ms.getInfo(modelIndex, "fileType")) && this.is2D);
models[modelIndex].isModelKit = isModelKit;
}, "~N,~N,~S,~N,java.util.Properties,java.util.Map,java.util.Map");
Clazz_defineMethod(c$, "finalizeModels", 
function(baseModelCount){
var modelCount = this.ms.mc;
if (modelCount == baseModelCount) return;
var sNum;
var modelnumber = 0;
var lastfilenumber = -1;
var modelNumbers = this.ms.modelNumbers;
var modelNames = this.ms.modelNames;
if (this.isTrajectory) for (var i = baseModelCount; ++i < this.ms.mc; ) modelNumbers[i] = modelNumbers[i - 1] + 1;

if (baseModelCount > 0) {
if (modelNumbers[0] < 1000000) {
for (var i = 0; i < baseModelCount; i++) {
if (modelNames[i].length == 0) modelNames[i] = "" + modelNumbers[i];
modelNumbers[i] += 1000000;
this.ms.modelNumbersForAtomLabel[i] = "1." + (i + 1);
}
}var filenumber = modelNumbers[baseModelCount - 1];
filenumber -= filenumber % 1000000;
if (modelNumbers[baseModelCount] < 1000000) filenumber += 1000000;
for (var i = baseModelCount; i < modelCount; i++) modelNumbers[i] += filenumber;

}var models = this.ms.am;
for (var i = baseModelCount; i < modelCount; ++i) {
this.ms.setInfo(i, "fileType", this.ms.modelSetTypeName);
if (this.fileHeader != null) this.ms.setInfo(i, "fileHeader", this.fileHeader);
var filenumber = Clazz_doubleToInt(modelNumbers[i] / 1000000);
if (filenumber != lastfilenumber) {
modelnumber = 0;
lastfilenumber = filenumber;
}modelnumber++;
if (filenumber == 0) {
sNum = "" + this.ms.getModelNumber(i);
filenumber = 1;
} else {
sNum = filenumber + "." + modelnumber;
}this.ms.modelNumbersForAtomLabel[i] = sNum;
models[i].fileIndex = filenumber - 1;
this.ms.modelFileNumbers[i] = filenumber * 1000000 + modelnumber;
if (modelNames[i] == null || modelNames[i].length == 0) modelNames[i] = sNum;
}
if (this.merging) for (var i = 0; i < baseModelCount; i++) models[i].ms = this.ms;

for (var i = 0; i < modelCount; i++) {
this.ms.setInfo(i, "modelName", modelNames[i]);
this.ms.setInfo(i, "modelNumber", Integer.$valueOf(modelNumbers[i] % 1000000));
this.ms.setInfo(i, "modelFileNumber", Integer.$valueOf(this.ms.modelFileNumbers[i]));
this.ms.setInfo(i, "modelNumberDotted", this.ms.getModelNumberDotted(i));
var codes = this.ms.getInfo(i, "altLocs");
if (codes != null) {
JU.Logger.info("model " + this.ms.getModelNumberDotted(i) + " alternative locations: " + codes);
}}
}, "~N");
Clazz_defineMethod(c$, "iterateOverAllNewAtoms", 
function(adapter, asc, haveBonds){
var iLast = -1;
var siteBase = 0;
var isPdbThisModel = false;
var addH = false;
var isLegacyHAddition = false;
var iterAtom = adapter.getAtomIterator(asc);
var nAtoms = adapter.getAtomCount(asc, -1);
this.ms.setCapacity(adapter.getAtomCount(asc, -1));
var nRead = 0;
var models = this.ms.am;
if (this.ms.mc > 0) this.nullGroup =  new JM.Group().setGroup( new JM.Chain(this.ms.am[this.baseModelIndex], 32, 0), "", 0, -1, -1);
while (iterAtom.hasNext()) {
nRead++;
var modelIndex = iterAtom.getAtomSetIndex() + this.baseModelIndex;
if (modelIndex != iLast) {
this.iChain = 0;
this.iModel = modelIndex;
this.model = models[modelIndex];
var mbs = this.model.bsAtoms;
if (this.merging && !this.appendNew && this.vwr.getOperativeSymmetry() != null) {
siteBase = this.getAtomSiteBase(mbs);
}this.currentChainID = 2147483647;
this.isNewChain = true;
mbs.set(this.ms.ac + nAtoms);
mbs.clearAll();
this.model.isOrderly = (this.appendToModelIndex == null);
isPdbThisModel = this.model.isBioModel;
iLast = modelIndex;
addH = isPdbThisModel && this.doAddPDBHydrogens;
if (this.jbr != null) this.jbr.setHaveHsAlready(false);
}var group3 = iterAtom.getGroup3();
var chainID = iterAtom.getChainID();
this.checkNewGroup(adapter, chainID, group3, iterAtom.getSequenceNumber(), iterAtom.getInsertionCode(), addH, isLegacyHAddition);
var isotope = iterAtom.getElementNumber();
if (addH && JU.Elements.getElementNumber(isotope) == 1) this.jbr.setHaveHsAlready(true);
var name = iterAtom.getAtomName();
var charge = (addH ? this.getPdbCharge(group3, name) : iterAtom.getFormalCharge());
var atom = this.addAtom(isPdbThisModel, iterAtom, name, isotope, siteBase, charge, group3);
if (haveBonds) this.htAtomMap.put(iterAtom.getUniqueID(), atom);
}
if (this.groupCount > 0 && addH) {
this.jbr.addImplicitHydrogenAtoms(adapter, this.groupCount - 1, this.isNewChain && !isLegacyHAddition ? 1 : 0);
}iLast = -1;
var vdwtypeLast = null;
var atoms = this.ms.at;
models[0].firstAtomIndex = 0;
for (var i = 0; i < this.ms.ac; i++) {
if (atoms[i] != null && atoms[i].mi > iLast) {
iLast = atoms[i].mi;
var m = models[iLast];
m.firstAtomIndex = i;
m.isOrderly = (m.act == m.bsAtoms.length() - i);
var vdwtype = this.ms.getDefaultVdwType(iLast);
if (vdwtype !== vdwtypeLast) {
JU.Logger.info("Default Van der Waals type for model" + " set to " + vdwtype.getVdwLabel());
vdwtypeLast = vdwtype;
}}}
JU.Logger.info(nRead + " atoms created");
}, "J.api.JmolAdapter,~O,~B");
Clazz_defineMethod(c$, "getAtomSiteBase", 
function(mbs){
var base = 0;
for (var i = mbs.nextSetBit(0); i >= 0; i = mbs.nextSetBit(i + 1)) {
var a = this.ms.at[i];
if (!JM.AtomCollection.isDeleted(a) && a.atomSite > base) {
base = a.atomSite;
}}
return base;
}, "JU.BS");
Clazz_defineMethod(c$, "addJmolDataProperties", 
function(m, jmolDataProperties){
if (jmolDataProperties == null) return;
var props = jmolDataProperties.get("properties");
if (props.containsKey("spinZ")) return;
var bs = m.bsAtoms;
var nAtoms = bs.cardinality();
for (var e, $e = props.entrySet().iterator (); $e.hasNext()&& ((e = $e.next ()) || true);) {
var key = e.getKey();
var data = e.getValue();
if (data.length != nAtoms) return;
var tok = (key.startsWith("property_") ? 1715472409 : JS.T.getTokFromName(key));
switch (tok) {
default:
if (JS.T.tokAttr(tok, 2048)) {
this.vwr.setAtomProperty(bs, tok, 0, 0, null, data, null);
break;
}case 1111492629:
case 1111492630:
case 1111492631:
key = "property_" + key;
tok = 1715472409;
case 1715472409:
this.vwr.setData(key,  Clazz_newArray(-1, [key, data, bs, Integer.$valueOf(1)]), 0, 0, 0, 0, 0);
}
}
}, "JM.Model,java.util.Map");
Clazz_defineMethod(c$, "getPdbCharge", 
function(group3, name){
return (group3.equals("ARG") && name.equals("NH1") || group3.equals("LYS") && name.equals("NZ") || group3.equals("HIS") && name.equals("ND1") ? 1 : 0);
}, "~S,~S");
Clazz_defineMethod(c$, "addAtom", 
function(isPDB, iterAtom, atomName, atomicAndIsotopeNumber, siteBase, formalCharge, group3){
var atomSymmetry = iterAtom.getSymmetry();
var atomSite = iterAtom.getAtomSite() + siteBase;
var partialCharge = iterAtom.getPartialCharge();
var tensors = iterAtom.getTensors();
var occupancy = iterAtom.getOccupancy();
var bfactor = iterAtom.getBfactor();
var xyz = iterAtom.getXYZ();
var isHetero = iterAtom.getIsHetero();
var isNegDisorder = (iterAtom.getPart() < 0);
var atomSerial = iterAtom.getSerial();
var atomSeqID = iterAtom.getSeqID();
var vib = iterAtom.getVib();
var alternateLocationID = iterAtom.getAltLoc();
var radius = iterAtom.getRadius();
var bondRadius = iterAtom.getBondRadius();
var specialAtomID = 0;
var atomType = null;
if (atomName != null) {
var i;
if ((i = atomName.indexOf('\0')) >= 0) {
atomType = atomName.substring(i + 1);
atomName = atomName.substring(0, i);
}if (isPDB) {
if (atomName.indexOf('*') >= 0) atomName = atomName.$replace('*', '\'');
specialAtomID = this.vwr.getJBR().lookupSpecialAtomID(atomName);
if (specialAtomID == 2 && "CA".equalsIgnoreCase(group3)) specialAtomID = 0;
}}var atom = this.ms.addAtom(this.iModel, this.nullGroup, atomicAndIsotopeNumber, atomName, atomType, atomSerial, atomSeqID, atomSite, xyz, radius, vib, formalCharge, partialCharge, occupancy, bfactor, tensors, isHetero, isNegDisorder, specialAtomID, atomSymmetry, bondRadius);
atom.altloc = alternateLocationID;
return atom;
}, "~B,J.api.JmolAdapterAtomIterator,~S,~N,~N,~N,~S");
Clazz_defineMethod(c$, "checkNewGroup", 
function(adapter, chainID, group3, groupSequenceNumber, groupInsertionCode, addH, isLegacyHAddition){
if (chainID != this.currentChainID) {
this.currentChainID = chainID;
this.currentChain = this.getOrAllocateChain(this.model, chainID);
this.currentGroupInsertionCode = '\uFFFF';
this.currentGroupSequenceNumber = -1;
this.currentGroup3 = "xxxx";
this.isNewChain = true;
}var group3i = (group3 == null ? null : group3.intern());
if (groupSequenceNumber != this.currentGroupSequenceNumber || groupInsertionCode != this.currentGroupInsertionCode || group3i !== this.currentGroup3) {
if (this.groupCount > 0 && addH) {
this.jbr.addImplicitHydrogenAtoms(adapter, this.groupCount - 1, this.isNewChain && !isLegacyHAddition ? 1 : 0);
this.jbr.setHaveHsAlready(false);
}this.currentGroupSequenceNumber = groupSequenceNumber;
this.currentGroupInsertionCode = groupInsertionCode;
this.currentGroup3 = group3i;
while (this.groupCount >= this.group3Of.length) {
this.chainOf = JU.AU.doubleLength(this.chainOf);
this.group3Of = JU.AU.doubleLengthS(this.group3Of);
this.seqcodes = JU.AU.doubleLengthI(this.seqcodes);
this.firstAtomIndexes = JU.AU.doubleLengthI(this.firstAtomIndexes);
}
this.firstAtomIndexes[this.groupCount] = this.ms.ac;
this.chainOf[this.groupCount] = this.currentChain;
this.group3Of[this.groupCount] = group3;
this.seqcodes[this.groupCount] = JM.Group.getSeqcodeFor(groupSequenceNumber, groupInsertionCode);
++this.groupCount;
}}, "J.api.JmolAdapter,~N,~S,~N,~S,~B,~B");
Clazz_defineMethod(c$, "getOrAllocateChain", 
function(model, chainID){
var chain = model.getChain(chainID);
if (chain != null) return chain;
if (model.chainCount == model.chains.length) model.chains = (model.chainCount == 0 ?  new Array(2) : JU.AU.doubleLength(model.chains));
return model.chains[model.chainCount++] =  new JM.Chain(model, chainID, (chainID == 0 || chainID == 32 ? 0 : ++this.iChain));
}, "JM.Model,~N");
Clazz_defineMethod(c$, "iterateOverAllNewBonds", 
function(iterBond){
var force1 = this.isMutate && !this.vwr.getBoolean(603979894);
var haveMultipleBonds = false;
while (iterBond.hasNext()) {
var iOrder = iterBond.getEncodedOrder();
var order = (force1 ? 1 : iOrder);
var b = this.bondAtoms(iterBond.getAtomUniqueID1(), iterBond.getAtomUniqueID2(), order);
if (b != null) {
if (order > 1 && order != 1025 && order != 1041) haveMultipleBonds = true;
var radius = iterBond.getPymolRadius();
if (radius > 0) b.setMad(Clazz_floatToShort(radius * 2000));
var colix = iterBond.getColix();
if (colix >= 0) b.colix = colix;
}}
if (haveMultipleBonds && this.ms.someModelsHaveSymmetry && !this.vwr.getBoolean(603979794)) JU.Logger.info("ModelSet: use \"set appletSymmetryToBonds TRUE \" to apply the file-based multiple bonds to symmetry-generated atoms.");
}, "J.api.JmolAdapterBondIterator");
Clazz_defineMethod(c$, "bondAtoms", 
function(atomUid1, atomUid2, order){
var atom1 = this.htAtomMap.get(atomUid1);
if (atom1 == null) {
JU.Logger.error("bondAtoms cannot find atomUid1?:" + atomUid1);
return null;
}var atom2 = this.htAtomMap.get(atomUid2);
if (atom2 == null) {
JU.Logger.error("bondAtoms cannot find atomUid2?:" + atomUid2);
return null;
}if (atom1.isBonded(atom2)) return null;
var isNear = (order == 1025);
var isFar = (order == 1041);
var bond;
if (isNear || isFar) {
var m = atom1.getModelIndex();
if (m != this.lastModel) {
this.lastModel = m;
var info = this.ms.getModelAuxiliaryInfo(m);
this.isMOL2D = (this.is2D || info != null && "2D".equals(info.get("dimension")));
}bond = this.ms.bondMutually(atom1, atom2, (this.isMOL2D ? order : 513), this.ms.getDefaultMadFromOrder(1), 0);
if (this.isMOL2D) {
if (this.vStereo == null) {
this.vStereo =  new JU.Lst();
}this.vStereo.addLast(bond);
}} else {
bond = this.ms.bondMutually(atom1, atom2, order, this.ms.getDefaultMadFromOrder(order), 0);
if (bond.isAromatic()) {
this.ms.someModelsHaveAromaticBonds = true;
}}if (this.ms.bondCount == this.ms.bo.length) {
this.ms.bo = JU.AU.arrayCopyObject(this.ms.bo, this.ms.bondCount + 250);
}this.ms.setBond(this.ms.bondCount++, bond);
return bond;
}, "~O,~O,~N");
Clazz_defineMethod(c$, "initializeUnitCellAndSymmetry", 
function(){
if (this.someModelsAreModulated && this.ms.bsModulated == null) this.ms.bsModulated =  new JU.BS();
var haveMergeCells = (this.modelSet0 != null && this.modelSet0.unitCells != null);
if (this.someModelsHaveUnitcells || haveMergeCells) {
this.ms.unitCells =  new Array(this.ms.mc);
this.ms.haveUnitCells = true;
for (var i = 0, pt = 0; i < this.ms.mc; i++) {
var info = this.ms.getModelAuxiliaryInfo(i);
if (haveMergeCells && i < this.baseModelCount) {
this.ms.unitCells[i] = this.modelSet0.unitCells[i];
} else if (info.get("spaceGroupIndex") != null) {
this.ms.unitCells[i] = J.api.Interface.getSymmetry(this.vwr, "file");
var notionalCell = null;
if (this.isTrajectory) {
var lst = this.ms.getInfoM("unitCells");
if (lst != null) notionalCell = lst.get(pt++);
}(this.ms.unitCells[i]).setSymmetryInfoFromFile(this.ms, i, notionalCell);
}}
}if (this.appendNew && this.ms.someModelsHaveSymmetry) {
this.ms.getAtoms(1088421903, null);
var atoms = this.ms.at;
for (var iAtom = this.baseAtomIndex, iModel = -1, i0 = 0; iAtom < this.ms.ac; iAtom++) {
if (atoms[iAtom].mi != iModel) {
iModel = atoms[iAtom].mi;
i0 = this.baseAtomIndex + this.ms.getInfoI(iModel, "presymmetryAtomIndex");
if (i0 < 0) break;
var n = this.ms.getInfoI(iModel, "presymmetryAtomCount");
this.ms.am[iModel].auxiliaryInfo.put("presymmetryAtomIndex", Integer.$valueOf(i0));
this.ms.setInfo(iModel, "asymmetricUnit", this.ms.am[iModel].bsAsymmetricUnit = JU.BSUtil.newBitSet2(i0, i0 + n));
i0 += n;
}if (iAtom >= i0) this.ms.bsSymmetry.set(iAtom);
}
}if (this.appendNew && this.ms.someModelsHaveFractionalCoordinates) {
var atoms = this.ms.at;
var modelIndex = -1;
var c = null;
var isFractional = false;
for (var i = this.baseAtomIndex; i < this.ms.ac; i++) {
if (atoms[i].mi != modelIndex) {
modelIndex = atoms[i].mi;
c = this.ms.getUnitCell(modelIndex);
isFractional = (c != null && c.getCoordinatesAreFractional());
}if (isFractional) {
var m = this.ms.getModulation(i);
var uca = (m == null ? c : atoms[i].getUnitCell());
uca.toCartesian(uca.toSupercell(atoms[i]), false);
}}
for (var imodel = this.baseModelIndex; imodel < this.ms.mc; imodel++) if (this.ms.isTrajectory(imodel)) this.ms.trajectory.setUnitCell(imodel);

}});
Clazz_defineMethod(c$, "initializeBonding", 
function(){
var modelCount = this.ms.mc;
var models = this.ms.am;
var modelAtomCount = 0;
var bsExclude = this.ms.getInfoM("bsExcludeBonding");
if (bsExclude == null) {
bsExclude = (this.ms.getInfoM(JV.JC.getBoolName(3)) == null ? null :  new JU.BS());
if (bsExclude != null) this.ms.setPdbConectBonding(this.baseAtomIndex, this.baseModelIndex, bsExclude);
}var symmetryAlreadyAppliedToBonds = this.vwr.getBoolean(603979794);
var doAutoBond = this.vwr.getBoolean(603979798);
var forceAutoBond = this.vwr.getBoolean(603979848);
var bs = null;
var autoBonding = false;
if (!this.noAutoBond) for (var i = this.baseModelIndex; i < modelCount; i++) {
modelAtomCount = models[i].bsAtoms.cardinality();
var modelBondCount = this.ms.getInfoI(i, "initialBondCount");
var modelIsPDB = models[i].isBioModel;
if (modelBondCount < 0) {
modelBondCount = this.ms.bondCount;
}var doBond = (forceAutoBond || doAutoBond && (modelBondCount == 0 || modelIsPDB && this.jmolData == null && (this.ms.getMSInfoB("havePDBHeaderName") || modelBondCount < Clazz_doubleToInt(modelAtomCount / 2)) || this.ms.getInfoB(i, "hasSymmetry") && !symmetryAlreadyAppliedToBonds && !this.ms.getInfoB(i, "hasBonds")));
if (!doBond) continue;
autoBonding = true;
if (this.merging || modelCount > 1) {
if (bs == null) bs = JU.BS.newN(this.ms.ac);
if (i == this.baseModelIndex || !this.isTrajectory) bs.or(models[i].bsAtoms);
}}
if (this.modulationOn) this.ms.setModulation(null, true, this.modulationTUV, false);
if (autoBonding) {
this.ms.autoBondBs4(bs, bs, bsExclude, null, this.ms.defaultCovalentMad, this.vwr.getBoolean(603979872), null);
JU.Logger.info("ModelSet: autobonding; use  autobond=false  to not generate bonds automatically");
} else {
JU.Logger.info("ModelSet: not autobonding; use  forceAutobond=true  to force automatic bond creation");
}});
Clazz_defineMethod(c$, "finalizeGroupBuild", 
function(){
this.groups =  new Array(this.groupCount);
if (this.merging) for (var i = 0; i < this.$mergeGroups.length; i++) (this.groups[i] = this.$mergeGroups[i]).chain.model.ms = this.ms;

for (var i = this.baseGroupIndex; i < this.groupCount; ++i) this.distinguishAndPropagateGroup(i, this.chainOf[i], this.group3Of[i], this.seqcodes[i], this.firstAtomIndexes[i], (i == this.groupCount - 1 ? this.ms.ac : this.firstAtomIndexes[i + 1]) - 1);

if (this.group3Lists != null) {
this.ms.msInfo.put("group3Lists", this.group3Lists);
this.ms.msInfo.put("group3Counts", this.group3Counts);
for (var i = 0; i < this.group3Counts.length; i++) if (this.group3Counts[i] == null) this.group3Counts[i] =  Clazz_newIntArray (0, 0);

}});
Clazz_defineMethod(c$, "distinguishAndPropagateGroup", 
function(groupIndex, chain, group3, seqcode, firstAtomIndex, lastAtomIndex){
if (lastAtomIndex < firstAtomIndex) throw  new NullPointerException();
var group = (group3 == null || this.jbr == null ? null : this.jbr.distinguishAndPropagateGroup(chain, group3, seqcode, firstAtomIndex, lastAtomIndex, this.specialAtomIndexes, this.ms.at));
var key;
if (group == null) {
group =  new JM.Group().setGroup(chain, group3, seqcode, firstAtomIndex, lastAtomIndex);
if (this.jbr != null) group.groupID = this.jbr.getGroupID(group3);
key = "o>";
} else {
key = (group.isProtein() ? "p>" : group.isNucleic() ? "n>" : group.isCarbohydrate() ? "c>" : "o>");
}if (group3 != null) {
this.countGroup(this.ms.at[firstAtomIndex].mi, key, group3);
if (group.isNucleic()) {
var g1 = (this.htGroup1 == null ? null : this.htGroup1.get(group3));
if (g1 != null) group.group1 = g1.charAt(0);
}}this.groups[groupIndex] = chain.addGroup(group, groupIndex);
for (var i = lastAtomIndex + 1; --i >= firstAtomIndex; ) this.ms.at[i].group = group;

}, "~N,JM.Chain,~S,~N,~N,~N");
Clazz_defineMethod(c$, "countGroup", 
function(modelIndex, code, group3){
var ptm = modelIndex + 1;
if (this.group3Lists == null || this.group3Lists[ptm] == null) return;
var g3code = (group3 + "   ").substring(0, 3);
var pt = this.group3Lists[ptm].indexOf(g3code);
if (pt < 0) {
this.group3Lists[ptm] += ",[" + g3code + "]";
pt = this.group3Lists[ptm].indexOf(g3code);
this.group3Counts[ptm] = JU.AU.arrayCopyI(this.group3Counts[ptm], this.group3Counts[ptm].length + 10);
}this.group3Counts[ptm][Clazz_doubleToInt(pt / 6)]++;
pt = this.group3Lists[ptm].indexOf(",[" + g3code);
if (pt >= 0) this.group3Lists[ptm] = this.group3Lists[ptm].substring(0, pt) + code + this.group3Lists[ptm].substring(pt + 2);
if (modelIndex >= 0) this.countGroup(-1, code, group3);
}, "~N,~S,~S");
Clazz_defineMethod(c$, "freeze", 
function(){
this.htAtomMap.clear();
if (this.ms.ac < this.ms.at.length) this.ms.growAtomArrays(this.ms.ac);
if (this.ms.bondCount < this.ms.bo.length) this.ms.bo = JU.AU.arrayCopyObject(this.ms.bo, this.ms.bondCount);
for (var i = 5; --i > 0; ) {
this.ms.numCached[i] = 0;
var bondsCache = this.ms.freeBonds[i];
for (var j = bondsCache.length; --j >= 0; ) bondsCache[j] = null;

}
this.ms.setAtomNamesAndNumbers(0, this.baseAtomIndex, this.modelSet0, false);
this.findElementsPresent();
this.ms.resetMolecules();
this.model = null;
this.currentChain = null;
if (!this.ms.haveBioModels || this.isPyMOLsession || this.isMutate) {
this.ms.freezeModels();
return;
}var asDSSP = this.vwr.getBoolean(603979826);
var ret = this.ms.calculateStructuresAllExcept(this.structuresDefinedInFile, asDSSP, false, true, true, asDSSP, JV.JC.versionInt >= 1405000 && this.ms.getInfoM("DSSP1") == null ? 2 : 1);
if (ret.length > 0) JU.Logger.info(ret);
});
Clazz_defineMethod(c$, "findElementsPresent", 
function(){
this.ms.elementsPresent =  new Array(this.ms.mc);
for (var i = 0; i < this.ms.mc; i++) this.ms.elementsPresent[i] = JU.BS.newN(64);

for (var i = this.ms.ac; --i >= 0; ) {
var a = this.ms.at[i];
if (a == null) continue;
var n = a.getAtomicAndIsotopeNumber();
if (n >= JU.Elements.elementNumberMax) n = JU.Elements.elementNumberMax + JU.Elements.altElementIndexFromNumber(n);
this.ms.elementsPresent[a.mi].set(n);
}
});
Clazz_defineMethod(c$, "setupMinimization", 
function(){
this.initialize2DMin();
var v =  new JU.V3();
var stereodir = 1;
if (this.vStereo != null) {
out : for (var i = this.vStereo.size(); --i >= 0; ) {
var b = this.vStereo.get(i);
var a1 = b.atom1;
var bonds = a1.bonds;
for (var j = a1.getBondCount(); --j >= 0; ) {
var b2 = bonds[j];
if (b2 === b) continue;
var a2 = b2.getOtherAtom(a1);
v.sub2(a2, a1);
if (Math.abs(v.x) < 0.1) {
if ((b.order == 1025) == (v.y < 0)) stereodir = -1;
break out;
}}
}
}this.set2dZ(v, stereodir);
if (this.vStereo != null) {
var bsToTest = JU.BSUtil.newBitSet2(this.baseAtomIndex, this.ms.ac);
for (var i = this.vStereo.size(); --i >= 0; ) {
var b = this.vStereo.get(i);
var dz2 = (b.order == 1025 ? 3 : -3);
b.order = 1;
if (b.atom1.getBondCount() < 6 && b.atom2.z != b.atom1.z && (dz2 < 0) == (b.atom2.z < b.atom1.z)) dz2 /= 3;
var bs = JU.JmolMolecule.getBranchBitSet(this.ms.at, b.atom2.i, bsToTest, null, b.atom1.i, false, true);
bs.set(b.atom2.i);
for (var j = bs.nextSetBit(0); j >= 0; j = bs.nextSetBit(j + 1)) this.ms.at[j].z += dz2;

b.atom2.x = (b.atom1.x + b.atom2.x) / 2;
b.atom2.y = (b.atom1.y + b.atom2.y) / 2;
}
this.vStereo = null;
}this.is2D = false;
});
Clazz_defineMethod(c$, "initialize2DMin", 
function(){
var scaling = 0;
var n = 0;
var lastModel = -1;
var i0 = this.baseAtomIndex;
var i1 = this.ms.ac;
for (var i = i0; i < i1; i++) {
var a = this.ms.at[i];
var m = a.getModelIndex();
if (m != lastModel) {
lastModel = m;
this.ms.setInfo(m, "dimension", "3D");
}var bonds = a.bonds;
if (bonds == null) continue;
for (var j = bonds.length; --j >= 0; ) {
if (bonds[j] == null) continue;
var b = bonds[j].getOtherAtom(a);
if (b.getAtomNumber() != 1 && b.getIndex() > i) {
scaling += b.distance(a);
n++;
}}
}
if (n == 0) return;
scaling = 1.45 / (scaling / n);
for (var i = i0; i < i1; i++) {
this.ms.at[i].scale(scaling);
}
});
Clazz_defineMethod(c$, "set2dZ", 
function(v, stereodir){
var iatom1 = this.baseAtomIndex;
var iatom2 = this.ms.ac;
var atomlist = JU.BS.newN(iatom2);
var bsBranch =  new JU.BS();
var v0 = JU.V3.new3(0, 1, 0);
var v1 =  new JU.V3();
var bs0 =  new JU.BS();
bs0.setBits(iatom1, iatom2);
for (var i = iatom1; i < iatom2; i++) if (!atomlist.get(i) && !bsBranch.get(i)) {
bsBranch = this.getBranch2dZ(i, -1, bs0, bsBranch, v, v0, v1, stereodir);
atomlist.or(bsBranch);
}
}, "JU.V3,~N");
Clazz_defineMethod(c$, "getBranch2dZ", 
function(atomIndex, atomIndexNot, bs0, bsBranch, v, v0, v1, dir){
var bs = JU.BS.newN(this.ms.ac);
if (atomIndex < 0) return bs;
var bsToTest = JU.BSUtil.copy(bs0);
if (atomIndexNot >= 0) bsToTest.clear(atomIndexNot);
JM.ModelLoader.setBranch2dZ(this.ms.at[atomIndex], bs, bsToTest, v, v0, v1, dir);
return bs;
}, "~N,~N,JU.BS,JU.BS,JU.V3,JU.V3,JU.V3,~N");
c$.setBranch2dZ = Clazz_defineMethod(c$, "setBranch2dZ", 
function(atom, bs, bsToTest, v, v0, v1, dir){
var atomIndex = atom.i;
if (!bsToTest.get(atomIndex)) return;
bsToTest.clear(atomIndex);
bs.set(atomIndex);
if (atom.bonds == null) return;
for (var i = atom.bonds.length; --i >= 0; ) {
var bond = atom.bonds[i];
if (bond.isHydrogen()) continue;
var atom2 = bond.getOtherAtom(atom);
JM.ModelLoader.setAtom2dZ(atom, atom2, v, v0, v1, dir);
JM.ModelLoader.setBranch2dZ(atom2, bs, bsToTest, v, v0, v1, dir);
}
}, "JM.Atom,JU.BS,JU.BS,JU.V3,JU.V3,JU.V3,~N");
c$.setAtom2dZ = Clazz_defineMethod(c$, "setAtom2dZ", 
function(atomRef, atom2, v, v0, v1, dir){
v.sub2(atom2, atomRef);
v.z = 0;
v.normalize();
v1.cross(v0, v);
var theta = Math.acos(v.dot(v0));
var f = (0.4 * -dir * Math.sin(4 * theta));
atom2.z = atomRef.z + f;
}, "JM.Atom,JM.Atom,JU.V3,JU.V3,JU.V3,~N");
Clazz_defineMethod(c$, "finalizeShapes", 
function(){
this.ms.sm = this.vwr.shm;
this.ms.sm.setModelSet(this.ms);
this.ms.setBsHidden(this.vwr.slm.getHiddenSet());
if (!this.merging) this.ms.sm.resetShapes(false);
this.ms.sm.loadDefaultShapes(this.ms);
if (this.ms.someModelsHaveAromaticBonds && this.vwr.getBoolean(603979944)) this.ms.assignAromaticBondsBs(false, null);
if (this.merging && this.baseModelCount == 1) this.ms.sm.setShapePropertyBs(6, "clearModelIndex", null, null);
});
Clazz_defineMethod(c$, "undeleteAtom", 
function(iAtom){
this.ms.at[iAtom].valence = 0;
}, "~N");
c$.createAtomDataSet = Clazz_defineMethod(c$, "createAtomDataSet", 
function(vwr, modelSet, tokType, asc, bsSelected){
if (asc == null) return null;
var adapter = vwr.getModelAdapter();
var pt =  new JU.P3();
var atoms = modelSet.at;
var tolerance = vwr.getFloat(570425363);
if (modelSet.unitCells != null) for (var i = bsSelected.nextSetBit(0); i >= 0; i = bsSelected.nextSetBit(i + 1)) if (atoms[i].atomSymmetry != null) {
tolerance = -tolerance;
break;
}
var i = -1;
var n = 0;
var loadAllData = (JU.BSUtil.cardinalityOf(bsSelected) == vwr.ms.ac);
for (var iterAtom = adapter.getAtomIterator(asc); iterAtom.hasNext(); ) {
var xyz = iterAtom.getXYZ();
if (Float.isNaN(xyz.x + xyz.y + xyz.z)) continue;
if (tokType == 1145047049) {
i = bsSelected.nextSetBit(i + 1);
if (i < 0) break;
n++;
if (JU.Logger.debugging) JU.Logger.debug("atomIndex = " + i + ": " + atoms[i] + " --> (" + xyz.x + "," + xyz.y + "," + xyz.z);
modelSet.setAtomCoord(i, xyz.x, xyz.y, xyz.z);
continue;
}pt.setT(xyz);
var bs = JU.BS.newN(modelSet.ac);
modelSet.getAtomsWithin(tolerance, pt, bs, -1);
bs.and(bsSelected);
if (loadAllData) {
n = JU.BSUtil.cardinalityOf(bs);
if (n == 0) {
JU.Logger.warn("createAtomDataSet: no atom found at position " + pt);
continue;
} else if (n > 1 && JU.Logger.debugging) {
JU.Logger.debug("createAtomDataSet: " + n + " atoms found at position " + pt);
}}switch (tokType) {
case 1145047055:
var vib = iterAtom.getVib();
if (vib == null) continue;
if (JU.Logger.debugging) JU.Logger.debug("xyz: " + pt + " vib: " + vib);
modelSet.setAtomCoords(bs, 1145047055, vib);
break;
case 1128269825:
modelSet.setAtomProperty(bs, tokType, 0, iterAtom.getOccupancy(), null, null, null);
break;
case 1111492619:
modelSet.setAtomProperty(bs, tokType, 0, iterAtom.getPartialCharge(), null, null, null);
break;
case 1111492620:
modelSet.setAtomProperty(bs, tokType, 0, iterAtom.getBfactor(), null, null, null);
break;
}
}
switch (tokType) {
case 1145047055:
var vibName = adapter.getAtomSetName(asc, 0);
JU.Logger.info("_vibrationName = " + vibName);
vwr.setStringProperty("_vibrationName", vibName);
break;
case 1145047049:
JU.Logger.info(n + " atom positions read");
modelSet.recalculateLeadMidpointsAndWingVectors(-1);
if (n == modelSet.ac) return "boundbox {*};reset";
break;
}
return null;
}, "JV.Viewer,JM.ModelSet,~N,~O,JU.BS");
});
;//5.0.1-v7 Mon Aug 24 10:01:38 CDT 2026
Clazz_declarePackage("JM");
Clazz_load(["JM.BondCollection"], "JM.ModelSet", ["java.util.Hashtable", "JU.A4", "$.AU", "$.BS", "$.Lst", "$.M3", "$.M4", "$.Measure", "$.P3", "$.P4", "$.PT", "$.Quat", "$.SB", "$.V3", "J.api.Interface", "J.atomdata.RadiusData", "J.bspt.Bspf", "J.c.PAL", "$.VDW", "JM.Atom", "$.AtomIteratorWithinModel", "$.AtomIteratorWithinModelSet", "$.HBond", "$.Model", "$.StateScript", "JS.ScriptCompiler", "JU.BSUtil", "$.BoxInfo", "$.Edge", "$.Elements", "$.Escape", "$.JmolMolecule", "$.Logger", "JV.JC"], function(){
var c$ = Clazz_decorateAsClass(function(){
this.haveBioModels = false;
this.haveMultipleChains = false;
this.bsSymmetry = null;
this.modelSetName = null;
this.am = null;
this.mc = 0;
this.unitCells = null;
this.haveUnitCells = false;
this.closest = null;
this.modelNumbers = null;
this.modelFileNumbers = null;
this.modelNumbersForAtomLabel = null;
this.modelNames = null;
this.frameTitles = null;
this.elementsPresent = null;
this.isXYZ = false;
this.modelSetProperties = null;
this.msInfo = null;
this.someModelsHaveSymmetry = false;
this.someModelsHaveAromaticBonds = false;
this.someModelsHaveFractionalCoordinates = false;
this.isBbcageDefault = false;
this.bboxModels = null;
this.bboxAtoms = null;
this.boxInfo = null;
this.stateScripts = null;
this.thisStateModel = 0;
this.vibrationSteps = null;
this.selectedMolecules = null;
this.showRebondTimes = true;
this.bsAll = null;
this.sm = null;
this.proteinStructureTainted = false;
this.htPeaks = null;
this.vOrientations = null;
this.ptTemp = null;
this.ptTemp1 = null;
this.ptTemp2 = null;
this.matTemp = null;
this.matInv = null;
this.mat4 = null;
this.mat4t = null;
this.vTemp = null;
this.defaultBBox = null;
this.haveJmolDataFrames = false;
this.echoShapeActive = false;
this.modelSetTypeName = null;
this.translations = null;
this.maxBondWarned = false;
Clazz_instantialize(this, arguments);}, JM, "ModelSet", JM.BondCollection);
Clazz_makeConstructor(c$, 
function(vwr, name){
Clazz_superConstructor (this, JM.ModelSet, []);
this.vwr = vwr;
this.modelSetName = name;
this.selectedMolecules =  new JU.BS();
this.stateScripts =  new JU.Lst();
this.boxInfo =  new JU.BoxInfo();
this.boxInfo.addBoundBoxPoint(JU.P3.new3(-10, -10, -10));
this.boxInfo.addBoundBoxPoint(JU.P3.new3(10, 10, 10));
this.am =  new Array(1);
this.modelNumbers =  Clazz_newIntArray (1, 0);
this.modelFileNumbers =  Clazz_newIntArray (1, 0);
this.modelNumbersForAtomLabel =  new Array(1);
this.modelNames =  new Array(1);
this.frameTitles =  new Array(1);
this.closest =  new Array(1);
this.ptTemp =  new JU.P3();
this.ptTemp1 =  new JU.P3();
this.ptTemp2 =  new JU.P3();
this.matTemp =  new JU.M3();
this.matInv =  new JU.M3();
this.mat4 =  new JU.M4();
this.mat4t =  new JU.M4();
this.vTemp =  new JU.V3();
this.setupBC();
}, "JV.Viewer,~S");
Clazz_defineMethod(c$, "getBoxInfo", 
function(){
return this.boxInfo;
});
Clazz_defineMethod(c$, "releaseModelSet", 
function(){
this.am = null;
this.mc = 0;
this.closest[0] = null;
this.am = null;
this.bsSymmetry = null;
this.bsAll = null;
this.unitCells = null;
this.releaseModelSetBC();
});
Clazz_defineMethod(c$, "getEchoStateActive", 
function(){
return this.echoShapeActive;
});
Clazz_defineMethod(c$, "setEchoStateActive", 
function(TF){
this.echoShapeActive = TF;
}, "~B");
Clazz_defineMethod(c$, "getModelSetTypeName", 
function(){
return this.modelSetTypeName;
});
Clazz_defineMethod(c$, "getModelNumberIndex", 
function(modelNumber, useModelNumber, doSetTrajectory){
if (useModelNumber) {
for (var i = 0; i < this.mc; i++) if (this.modelNumbers[i] == modelNumber || modelNumber < 1000000 && this.modelNumbers[i] == 1000000 + modelNumber) return i;

return -1;
}if (modelNumber < 1000000) return modelNumber;
for (var i = 0; i < this.mc; i++) if (this.modelFileNumbers[i] == modelNumber) {
if (doSetTrajectory && this.isTrajectory(i)) this.setTrajectory(i);
return i;
}
return -1;
}, "~N,~B,~B");
Clazz_defineMethod(c$, "getModelDataBaseName", 
function(bsAtoms){
for (var i = 0; i < this.mc; i++) {
if (bsAtoms.equals(this.am[i].bsAtoms)) return this.getInfo(i, "dbName");
}
return null;
}, "JU.BS");
Clazz_defineMethod(c$, "setTrajectory", 
function(modelIndex){
if (modelIndex >= 0 && this.isTrajectory(modelIndex) && this.at[this.am[modelIndex].firstAtomIndex].mi != modelIndex) this.trajectory.setModel(modelIndex);
}, "~N");
Clazz_defineMethod(c$, "getBitSetTrajectories", 
function(){
return (this.trajectory == null ? null : this.trajectory.getModelsSelected());
});
Clazz_defineMethod(c$, "setTrajectoryBs", 
function(bsModels){
if (this.trajectory != null) for (var i = 0; i < this.mc; i++) if (bsModels.get(i)) this.setTrajectory(i);

}, "JU.BS");
Clazz_defineMethod(c$, "morphTrajectories", 
function(m1, m2, f){
if (m1 >= 0 && m2 >= 0 && this.isTrajectory(m1) && this.isTrajectory(m2)) this.trajectory.morph(m1, m2, f);
}, "~N,~N,~N");
Clazz_defineMethod(c$, "getTranslation", 
function(iModel){
return (this.translations == null || iModel >= this.translations.length ? null : this.translations[iModel]);
}, "~N");
Clazz_defineMethod(c$, "translateModel", 
function(iModel, pt){
if (pt == null) {
var t = this.getTranslation(iModel);
if (t == null) return;
pt = JU.P3.newP(t);
pt.scale(-1);
this.translateModel(iModel, pt);
this.translations[iModel] = null;
return;
}if (this.translations == null || this.translations.length <= iModel) this.translations =  new Array(this.mc);
if (this.translations[iModel] == null) this.translations[iModel] =  new JU.P3();
this.translations[iModel].add(pt);
var bs = this.am[iModel].bsAtoms;
for (var i = bs.nextSetBit(0); i >= 0; i = bs.nextSetBit(i + 1)) this.at[i].add(pt);

}, "~N,JU.T3");
Clazz_defineMethod(c$, "getFrameOffsets", 
function(bsAtoms, isFull){
if (bsAtoms == null) {
if (isFull) for (var i = this.mc; --i >= 0; ) {
var m = this.am[i];
if (!m.isJmolDataFrame && !m.isTrajectory) this.translateModel(m.modelIndex, null);
}
return null;
}var i0 = bsAtoms.nextSetBit(0);
if (i0 < 0) return null;
if (isFull) {
var bs = JU.BSUtil.copy(bsAtoms);
var pt = null;
var pdiff =  new JU.P3();
for (var i = 0; i < this.mc; i++) {
var m = this.am[i];
if (!m.isJmolDataFrame && !m.isTrajectory) {
var j = bs.nextSetBit(0);
if (m.bsAtoms.get(j)) {
if (pt == null) {
pt = JU.P3.newP(this.at[j]);
} else {
pdiff.sub2(pt, this.at[j]);
this.translateModel(i, pdiff);
}}}bs.andNot(m.bsAtoms);
}
return null;
}var offsets =  new Array(this.mc);
for (var i = this.mc; --i >= 0; ) offsets[i] =  new JU.P3();

var lastModel = -1;
var n = 0;
var lastOffset = null;
var asTrajectory = (this.trajectory != null && this.trajectory.steps.size() == this.mc);
var m1 = (asTrajectory ? this.mc : 1);
for (var m = 0; m < m1; m++) {
if (asTrajectory) this.setTrajectory(m);
for (var i = 0; i <= this.ac; i++) {
if (i < this.ac && JM.AtomCollection.isDeleted(this.at[i])) continue;
if (i == this.ac || this.at[i].mi != lastModel) {
if (n > 0) {
lastOffset.scale(-1.0 / n);
if (lastModel != 0) lastOffset.sub(offsets[0]);
n = 0;
}if (i == this.ac) break;
lastModel = this.at[i].mi;
lastOffset = offsets[lastModel];
}if (!bsAtoms.get(i)) continue;
lastOffset.add(this.at[i]);
n++;
}
}
offsets[0].set(0, 0, 0);
return offsets;
}, "JU.BS,~B");
Clazz_defineMethod(c$, "getAtoms", 
function(tokType, specInfo){
switch (tokType) {
default:
return JU.BSUtil.andNot(this.getAtomBitsMaybeDeleted(tokType, specInfo), this.vwr.slm.bsDeleted);
case 1073742358:
var modelNumber = (specInfo).intValue();
var modelIndex = this.getModelNumberIndex(modelNumber, true, true);
return (modelIndex < 0 && modelNumber > 0 ?  new JU.BS() : this.vwr.getModelUndeletedAtomsBitSet(modelIndex));
case 1275203608:
var data =  Clazz_newArray(-1, [null, null, null]);
this.vwr.shm.getShapePropertyData(21, "getCenters", data);
return (data[1] == null ?  new JU.BS() : data[1]);
}
}, "~N,~O");
Clazz_defineMethod(c$, "findNearestAtomIndex", 
function(x, y, bsNot, min){
if (this.ac == 0) return -1;
this.closest[0] = null;
if (this.vwr.am.splitFrame) {
x = this.vwr.am.setSplitFrameMouse(x);
var bsOtherFrame = this.vwr.am.getSplitFrameAtoms(false);
if (bsNot == null) {
bsNot = bsOtherFrame;
} else {
bsNot = JU.BSUtil.copy(bsNot);
bsNot.or(bsOtherFrame);
}}if (this.g3d.isAntialiased()) {
x <<= 1;
y <<= 1;
}this.findNearest2(x, y, this.closest, bsNot, min);
this.sm.findNearestShapeAtomIndex(x, y, this.closest, bsNot);
var closestIndex = (this.closest[0] == null ? -1 : this.closest[0].i);
this.closest[0] = null;
return closestIndex;
}, "~N,~N,JU.BS,~N");
Clazz_defineMethod(c$, "calculatePointGroup", 
function(bsAtoms, center){
return this.calculatePointGroupForFirstModel(bsAtoms, false, false, null, 0, 0, null, center, null);
}, "JU.BS,JU.P3");
Clazz_defineMethod(c$, "getPointGroupInfo", 
function(bsAtoms, type){
return this.calculatePointGroupForFirstModel(bsAtoms, false, true, type, 0, 0, null, null, null);
}, "JU.BS,~S");
Clazz_defineMethod(c$, "getPointGroupAsString", 
function(bsAtoms, type, index, scale, pts, center, id){
return this.calculatePointGroupForFirstModel(bsAtoms, true, false, type, index, scale, pts, center, id);
}, "JU.BS,~S,~N,~N,~A,JU.P3,~S");
Clazz_defineMethod(c$, "calculatePointGroupForFirstModel", 
function(bsAtoms, doAll, asInfo, type, index, scale, pts, center, id){
var pointGroup = this.pointGroup;
var bs = null;
var haveVibration = false;
var isPolyhedron = false;
var localEnvOnly = false;
var isPoints = (pts != null);
var modelIndex = this.vwr.am.cmi;
if (!isPoints) {
var iAtom = (bsAtoms == null ? -1 : bsAtoms.nextSetBit(0));
if (modelIndex < 0 && iAtom >= 0) modelIndex = this.at[iAtom].mi;
if (modelIndex < 0) {
modelIndex = this.vwr.getVisibleFramesBitSet().nextSetBit(0);
bsAtoms = null;
}bs = this.vwr.getModelUndeletedAtomsBitSet(modelIndex);
localEnvOnly = (bsAtoms != null && bs.cardinality() != bsAtoms.cardinality());
if (bsAtoms != null) bs.and(bsAtoms);
iAtom = bs.nextSetBit(0);
if (iAtom < 0) {
bs = this.vwr.getModelUndeletedAtomsBitSet(modelIndex);
iAtom = bs.nextSetBit(0);
}var obj = this.vwr.shm.getShapePropertyIndex(18, "mad", iAtom);
haveVibration = (obj != null && (obj).intValue() != 0 || this.vwr.tm.vibrationOn);
isPolyhedron = (type != null && type.toUpperCase().indexOf(":POLY") >= 0);
if (isPolyhedron) {
var data =  Clazz_newArray(-1, [Integer.$valueOf(iAtom), null]);
this.vwr.shm.getShapePropertyData(21, "points", data);
pts = data[1];
if (pts == null) return null;
bs = null;
haveVibration = false;
pointGroup = null;
} else {
pts = this.at;
}}var tp;
if (type != null && (tp = type.indexOf(":")) >= 0) type = type.substring(0, tp);
if (type != null && (tp = type.indexOf(".")) >= 0) {
index = JU.PT.parseInt(type.substring(tp + 1));
if (index < 0) index = 0;
type = type.substring(0, tp);
}var spinModel = this.getJmolDataFrameInt(index, 1095241729);
var symmetry = null;
if (spinModel < 0 || (symmetry = this.getUnitCell(index)) == null) symmetry = J.api.Interface.getSymmetry(this.vwr, "calcPG");
pointGroup = symmetry.setPointGroup(this.vwr, pointGroup, center, pts, bs, haveVibration, (isPoints ? 0 : this.vwr.getFloat(570425382)), this.vwr.getFloat(570425384), (bs == null ? pts.length : bs.cardinality()), localEnvOnly);
if (!isPolyhedron && !isPoints) this.pointGroup = pointGroup;
if (!doAll && !asInfo) return pointGroup.getPointGroupName();
var ret = pointGroup.getPointGroupInfo(modelIndex, id, asInfo, type, index, scale);
return (asInfo ? ret : (this.mc > 1 ? "frame " + this.getModelNumberDotted(modelIndex) + "; " : "") + ret);
}, "JU.BS,~B,~B,~S,~N,~N,~A,JU.P3,~S");
Clazz_defineMethod(c$, "getDefaultStructure", 
function(bsAtoms, bsModified){
return (this.haveBioModels ? this.bioModelset.getAllDefaultStructures(bsAtoms, bsModified) : "");
}, "JU.BS,JU.BS");
Clazz_defineMethod(c$, "deleteModelBonds", 
function(modelIndex){
var bsAtoms = this.getModelAtomBitSetIncludingDeleted(modelIndex, false);
this.makeConnections(0, 3.4028235E38, 131071, 12291, bsAtoms, bsAtoms, null, false, false, 0);
}, "~N");
Clazz_defineMethod(c$, "makeConnections", 
function(minDistance, maxDistance, order, connectOperation, bsA, bsB, bsBonds, isBonds, addGroup, energy){
this.moleculeCount = 0;
var autoState = (connectOperation == 1073741852 && order != 2048 ?  new JU.SB() : null);
var result = this.makeConnections2(minDistance, maxDistance, order, connectOperation, bsA, bsB, bsBonds, isBonds, addGroup, energy, autoState);
if (autoState != null) {
this.addStateScript(autoState.toString(), null, null, null, null, false, true);
}return result;
}, "~N,~N,~N,~N,JU.BS,JU.BS,JU.BS,~B,~B,~N");
Clazz_defineMethod(c$, "setPdbConectBonding", 
function(baseAtomIndex, baseModelIndex, bsExclude){
var mad = this.vwr.getMadBond();
for (var i = baseModelIndex; i < this.mc; i++) {
var vConnect = this.getInfo(i, "PDB_CONECT_bonds");
if (vConnect == null) continue;
var nConnect = vConnect.size();
this.setInfo(i, "initialBondCount", Integer.$valueOf(nConnect));
var atomInfo = this.getInfo(i, "PDB_CONECT_firstAtom_count_max");
var firstAtom = atomInfo[0] + baseAtomIndex;
var atomMax = firstAtom + atomInfo[1];
if (atomMax > this.atomSerials.length) atomMax = this.atomSerials.length;
var max = atomInfo[2];
var serialMap =  Clazz_newIntArray (max + 1, 0);
var iSerial;
for (var iAtom = firstAtom; iAtom < atomMax; iAtom++) if ((iSerial = this.atomSerials[iAtom]) > 0) serialMap[iSerial] = iAtom + 1;

for (var iConnect = 0; iConnect < nConnect; iConnect++) {
var pair = vConnect.get(iConnect);
var sourceSerial = pair[0];
var targetSerial = pair[1];
var order = pair[2];
if (sourceSerial < 0 || targetSerial < 0 || sourceSerial > max || targetSerial > max) continue;
var sourceIndex = serialMap[sourceSerial] - 1;
var targetIndex = serialMap[targetSerial] - 1;
if (sourceIndex < 0 || targetIndex < 0) continue;
var atomA = this.at[sourceIndex];
var atomB = this.at[targetIndex];
if (bsExclude != null) {
if (atomA.isHetero()) bsExclude.set(sourceIndex);
if (atomB.isHetero()) bsExclude.set(targetIndex);
}if (atomA.altloc == atomB.altloc || atomA.altloc == '\0' || atomB.altloc == '\0') this.getOrAddBond(atomA, atomB, order, (order == 2048 ? 1 : mad), null, 0, false);
}
}
}, "~N,~N,JU.BS");
Clazz_defineMethod(c$, "deleteAllBonds", 
function(){
this.moleculeCount = 0;
for (var i = this.stateScripts.size(); --i >= 0; ) {
if (this.stateScripts.get(i).isConnect()) {
this.stateScripts.removeItemAt(i);
}}
this.deleteAllBonds2();
});
Clazz_defineMethod(c$, "includeAllRelatedFrames", 
function(bsModels, includeOriginatingModels){
var baseModel = 0;
for (var i = 0; i < this.mc; i++) {
var isTraj = this.isTrajectory(i);
var isBase = (isTraj && bsModels.get(baseModel = this.am[i].trajectoryBaseIndex));
if (bsModels.get(i)) {
if (isTraj && !isBase) {
bsModels.set(baseModel);
this.includeAllRelatedFrames(bsModels, false);
return;
}} else if (isTraj || this.isJmolDataFrame(i) && bsModels.get(this.am[i].dataSourceFrame)) {
bsModels.set(i);
} else if (includeOriginatingModels && this.am[i].dataSourceFrame >= 0) {
bsModels.set(this.am[i].dataSourceFrame);
}}
}, "JU.BS,~B");
Clazz_defineMethod(c$, "deleteModels", 
function(bsModels){
this.includeAllRelatedFrames(bsModels, false);
var nModelsDeleted = bsModels.cardinality();
if (nModelsDeleted == 0) return null;
this.moleculeCount = 0;
if (this.msInfo != null) this.msInfo.remove("models");
var bsAtomsToDelete =  new JU.BS();
for (var i = bsModels.nextSetBit(0); i >= 0; i = bsModels.nextSetBit(i + 1)) {
this.clearDataFrameReference(i);
bsAtomsToDelete.or(this.am[i].bsAtoms);
}
var bsDeleted;
if (nModelsDeleted == this.mc) {
bsDeleted = this.getModelAtomBitSetIncludingDeleted(-1, true);
this.vwr.zap(true, false, false);
return bsDeleted;
}this.validateBspf(false);
bsDeleted =  new JU.BS();
var allOrderly = true;
var isOneOfSeveral = false;
var files =  new JU.BS();
var firstAtom = bsAtomsToDelete.nextSetBit(0);
for (var i = 0; i < this.mc; i++) {
var m = this.am[i];
if (i < this.mc - 1) allOrderly = new Boolean (allOrderly & (m.isOrderly || m.bsAtoms.length() <= firstAtom)).valueOf();
if (bsModels.get(i)) {
if (m.fileIndex >= 0) files.set(m.fileIndex);
bsDeleted.or(this.getModelAtomBitSetIncludingDeleted(i, false));
} else {
if (m.fileIndex >= 0 && files.get(m.fileIndex)) isOneOfSeveral = true;
}}
if (!allOrderly || isOneOfSeveral) {
this.vwr.deleteAtoms(bsDeleted, false);
return null;
}var newModels =  new Array(this.mc - nModelsDeleted);
var oldModels = this.am;
for (var i = 0, mpt = 0; i < this.mc; i++) {
if (!bsModels.get(i)) {
var m = this.am[i];
m.modelIndex = mpt;
newModels[mpt++] = m;
}}
this.am = newModels;
var oldModelCount = this.mc;
var bsBonds = this.getBondsForSelectedAtoms(bsDeleted, true);
this.deleteBonds(bsBonds, true);
for (var i = 0, mpt = 0; i < oldModelCount; i++) {
if (!bsModels.get(i)) {
mpt++;
continue;
}var old = oldModels[i];
var nAtoms = old.act;
if (nAtoms == 0) continue;
var bsModelAtoms = old.bsAtoms;
var firstAtomIndex = old.firstAtomIndex;
JU.BSUtil.deleteBits(this.bsSymmetry, bsModelAtoms);
this.deleteModel(mpt, bsModelAtoms, bsBonds);
this.deleteModelAtoms(firstAtomIndex, nAtoms, bsModelAtoms);
this.vwr.deleteModelAtoms(mpt, firstAtomIndex, nAtoms, bsModelAtoms);
for (var j = oldModelCount; --j > i; ) oldModels[j].fixIndices(mpt, nAtoms, bsModelAtoms);

this.vwr.shm.deleteShapeAtoms( Clazz_newArray(-1, [newModels, this.at,  Clazz_newIntArray(-1, [mpt, firstAtomIndex, nAtoms])]), bsModelAtoms);
this.mc--;
}
this.haveBioModels = false;
for (var i = this.mc; --i >= 0; ) if (this.am[i].isBioModel) {
this.haveBioModels = true;
this.bioModelset.set(this.vwr, this);
}
this.validateBspf(false);
this.bsAll = null;
this.resetMolecules();
this.isBbcageDefault = false;
this.calcBoundBoxDimensions(null, 1);
return bsDeleted;
}, "JU.BS");
Clazz_defineMethod(c$, "resetMolecules", 
function(){
this.bsAll = null;
this.molecules = null;
this.moleculeCount = 0;
this.resetChirality();
});
Clazz_defineMethod(c$, "resetChirality", 
function(){
if (this.haveChirality) {
var modelIndex = -1;
for (var i = this.ac; --i >= 0; ) {
var a = this.at[i];
if (a == null) continue;
a.setCIPChirality(0);
if (a.mi != modelIndex && a.mi < this.am.length) this.am[modelIndex = a.mi].hasChirality = false;
}
}});
Clazz_defineMethod(c$, "deleteModel", 
function(modelIndex, bsModelAtoms, bsBonds){
if (modelIndex < 0) {
return;
}this.modelNumbers = JU.AU.deleteElements(this.modelNumbers, modelIndex, 1);
this.modelFileNumbers = JU.AU.deleteElements(this.modelFileNumbers, modelIndex, 1);
this.modelNumbersForAtomLabel = JU.AU.deleteElements(this.modelNumbersForAtomLabel, modelIndex, 1);
this.modelNames = JU.AU.deleteElements(this.modelNames, modelIndex, 1);
this.frameTitles = JU.AU.deleteElements(this.frameTitles, modelIndex, 1);
this.thisStateModel = -1;
var group3Lists = this.getInfoM("group3Lists");
var group3Counts = this.getInfoM("group3Counts");
var ptm = modelIndex + 1;
if (group3Lists != null && group3Lists[ptm] != null) {
for (var i = Clazz_doubleToInt(group3Lists[ptm].length / 6); --i >= 0; ) if (group3Counts[ptm][i] > 0) {
group3Counts[0][i] -= group3Counts[ptm][i];
if (group3Counts[0][i] == 0) group3Lists[0] = group3Lists[0].substring(0, i * 6) + ",[" + group3Lists[0].substring(i * 6 + 2);
}
}if (group3Lists != null) {
this.msInfo.put("group3Lists", JU.AU.deleteElements(group3Lists, modelIndex, 1));
this.msInfo.put("group3Counts", JU.AU.deleteElements(group3Counts, modelIndex, 1));
}if (this.unitCells != null) {
this.unitCells = JU.AU.deleteElements(this.unitCells, modelIndex, 1);
}for (var i = this.stateScripts.size(); --i >= 0; ) {
if (!this.stateScripts.get(i).deleteAtoms(modelIndex, bsBonds, bsModelAtoms)) {
this.stateScripts.removeItemAt(i);
}}
}, "~N,JU.BS,JU.BS");
Clazz_defineMethod(c$, "setAtomProperty", 
function(bs, tok, iValue, fValue, sValue, values, list){
switch (tok) {
case 1114249217:
case 1112152066:
case 1112152071:
case 1112152073:
case 1112152074:
case 1649022989:
case 1112152078:
if (fValue > 4.0) fValue = 4.0;
if (values != null) {
var newValues =  Clazz_newFloatArray (this.ac, 0);
try {
for (var i = bs.nextSetBit(0), ii = 0; i >= 0; i = bs.nextSetBit(i + 1)) newValues[i] = values[ii++];

} catch (e) {
if (Clazz_exceptionOf(e, Exception)){
return;
} else {
throw e;
}
}
values = newValues;
}case 1112152070:
case 1112152076:
var rd = null;
var mar = 0;
if (values == null) {
if (fValue > 16) fValue = 16.1;
if (fValue < 0) fValue = 0;
mar = Clazz_doubleToInt(Math.floor(fValue * 2000));
} else {
rd =  new J.atomdata.RadiusData(values, 0, null, null);
}this.sm.setShapeSizeBs(JV.JC.shapeTokenIndex(tok), mar, rd, bs);
return;
}
this.setAPm(bs, tok, iValue, fValue, sValue, values, list);
}, "JU.BS,~N,~N,~N,~S,~A,~A");
Clazz_defineMethod(c$, "getFileData", 
function(modelIndex){
if (modelIndex < 0) return "";
var fileData = this.getInfo(modelIndex, "fileData");
if (fileData != null) return fileData;
if (!this.getInfoB(modelIndex, "isCIF")) return this.getPDBHeader(modelIndex);
fileData = this.vwr.getCifData(modelIndex);
this.setInfo(modelIndex, "fileData", fileData);
return fileData;
}, "~N");
Clazz_defineMethod(c$, "addHydrogens", 
function(vConnections, pts){
var modelIndex = vConnections.get(0).mi;
var bs =  new JU.BS();
if (this.isTrajectory(modelIndex) || this.am[modelIndex].getGroupCount() > 1) {
return bs;
}this.growAtomArrays(this.ac + pts.length);
var rd = this.vwr.rd;
var mad = this.getDefaultMadFromOrder(1);
this.am[modelIndex].resetDSSR(false);
for (var i = 0, n = this.am[modelIndex].act + 1; i < vConnections.size(); i++, n++) {
var atom1 = vConnections.get(i);
var atom2 = this.addAtom(modelIndex, atom1.group, 1, "H" + n, null, n, atom1.getSeqID(), n, pts[i], NaN, null, 0, 0, 100, NaN, null, false, false, 0, null, NaN);
atom2.setMadAtom(this.vwr, rd);
bs.set(atom2.i);
this.bondAtoms(atom1, atom2, 1, mad, null, 0, false, false);
}
this.sm.loadDefaultShapes(this);
return bs;
}, "JU.Lst,~A");
Clazz_defineMethod(c$, "mergeModelArrays", 
function(mergeModelSet){
this.at = mergeModelSet.at;
this.bo = mergeModelSet.bo;
this.stateScripts = mergeModelSet.stateScripts;
this.proteinStructureTainted = mergeModelSet.proteinStructureTainted;
this.haveJmolDataFrames = mergeModelSet.haveJmolDataFrames;
this.thisStateModel = -1;
this.bsSymmetry = mergeModelSet.bsSymmetry;
this.modelFileNumbers = mergeModelSet.modelFileNumbers;
this.modelNumbersForAtomLabel = mergeModelSet.modelNumbersForAtomLabel;
this.modelNames = mergeModelSet.modelNames;
this.modelNumbers = mergeModelSet.modelNumbers;
this.frameTitles = mergeModelSet.frameTitles;
this.haveBioModels = mergeModelSet.haveBioModels;
this.someModelsHaveSymmetry = mergeModelSet.someModelsHaveSymmetry;
this.haveMultipleChains = mergeModelSet.haveMultipleChains;
this.haveChirality = mergeModelSet.haveChirality;
this.boxInfo.setBoundBox(mergeModelSet.boxInfo.bbCorner0, mergeModelSet.boxInfo.bbCorner1, true, 1);
if (this.msInfo != null) this.msInfo.remove("models");
this.mergeAtomArrays(mergeModelSet);
}, "JM.ModelSet");
Clazz_defineMethod(c$, "getUnitCell", 
function(modelIndex){
var returnCage = (modelIndex == -2147483648);
var returnSym = !returnCage && (modelIndex < 0);
if (returnCage) modelIndex = this.vwr.am.cmi;
 else if (returnSym) modelIndex = -1 - modelIndex;
if (modelIndex < 0 || modelIndex >= this.mc) return null;
if (this.isTrajectory(modelIndex)) modelIndex = this.am[modelIndex].trajectoryBaseIndex;
var ucSimple = this.am[modelIndex].simpleCage;
var uc = null;
if (this.unitCells != null && modelIndex < this.unitCells.length && this.unitCells[modelIndex] != null && this.unitCells[modelIndex].haveUnitCell()) uc = this.unitCells[modelIndex];
if (uc == null && ucSimple == null) {
var cellParams = this.getInfo(modelIndex, "unitCellParams");
if (cellParams != null) {
this.setModelCage(modelIndex, this.vwr.getSymTemp().setUnitCellFromParams(cellParams, false, NaN), false);
}} else if (uc != null) {
if (returnCage) {
var cai = this.vwr.getUnitCellAtomIndex();
if (cai > 0) uc = this.getUnitCellForAtom(cai);
return (ucSimple == null ? this.setModelCagePts(modelIndex, uc.getUnitCellVectors(), "cage") : ucSimple);
}if (returnSym) {
return uc;
}}if (uc == null || ucSimple != null && !uc.isSymmetryCell(ucSimple)) {
uc = ucSimple;
}return uc;
}, "~N");
Clazz_defineMethod(c$, "setModelCagePts", 
function(iModel, originABC, name){
if (iModel < 0 && (iModel = this.vwr.am.cmi) < 0) return null;
var sym = this.vwr.getSymTemp();
try {
return this.setModelCage(iModel, originABC == null ? null : sym.getUnitCell(originABC, false, name), true);
} catch (e) {
if (Clazz_exceptionOf(e, Exception)){
e.printStackTrace();
return null;
} else {
throw e;
}
}
}, "~N,~A,~S");
Clazz_defineMethod(c$, "getModelName", 
function(modelIndex){
return this.mc < 1 ? "" : modelIndex >= 0 ? this.modelNames[modelIndex] : this.modelNumbersForAtomLabel[-1 - modelIndex];
}, "~N");
Clazz_defineMethod(c$, "getModelTitle", 
function(modelIndex){
modelIndex = this.getJmolDataSourceFrame(modelIndex);
return this.getInfo(modelIndex, "title");
}, "~N");
Clazz_defineMethod(c$, "getModelFileName", 
function(modelIndex){
modelIndex = this.getJmolDataSourceFrame(modelIndex);
return this.getInfo(modelIndex, "fileName");
}, "~N");
Clazz_defineMethod(c$, "getModelFileType", 
function(modelIndex){
modelIndex = this.getJmolDataSourceFrame(modelIndex);
return this.getInfo(modelIndex, "fileType");
}, "~N");
Clazz_defineMethod(c$, "setFrameTitle", 
function(bsFrames, title){
if ((typeof(title)=='string')) {
for (var i = bsFrames.nextSetBit(0); i >= 0; i = bsFrames.nextSetBit(i + 1)) this.frameTitles[i] = title;

} else {
var list = title;
for (var i = bsFrames.nextSetBit(0), n = 0; i >= 0; i = bsFrames.nextSetBit(i + 1)) if (n < list.length) this.frameTitles[i] = list[n++];

}}, "JU.BS,~O");
Clazz_defineMethod(c$, "getFrameTitle", 
function(modelIndex){
return (modelIndex >= 0 && modelIndex < this.mc ? this.frameTitles[modelIndex] : "");
}, "~N");
Clazz_defineMethod(c$, "getModelNumberForAtomLabel", 
function(modelIndex){
return this.modelNumbersForAtomLabel[modelIndex];
}, "~N");
Clazz_defineMethod(c$, "getGroups", 
function(){
var n = 0;
for (var i = 0; i < this.mc; i++) n += this.am[i].getGroupCount();

var groups =  new Array(n);
for (var i = 0, iGroup = 0; i < this.mc; i++) for (var j = 0; j < this.am[i].chainCount; j++) for (var k = 0; k < this.am[i].chains[j].groupCount; k++) {
groups[iGroup] = this.am[i].chains[j].groups[k];
groups[iGroup].groupIndex = iGroup;
iGroup++;
}


return groups;
});
Clazz_defineMethod(c$, "getModelIndexFromFileModel", 
function(mfn){
for (var i = this.mc; --i >= 0; ) {
if (this.modelFileNumbers[i] == mfn) return i;
}
return -1;
}, "~N");
Clazz_defineMethod(c$, "setCrystallographicDefaults", 
function(){
return !this.haveBioModels && !this.haveMultipleChains && (this.someModelsHaveSymmetry && this.someModelsHaveFractionalCoordinates || this.getUnitCell(this.vwr.am.cmi) != null);
});
Clazz_defineMethod(c$, "getBoundBoxCenter", 
function(modelIndex){
return (this.isJmolDataFrame(modelIndex) ?  new JU.P3() : (this.getDefaultBoundBox() == null ? this.boxInfo : this.defaultBBox).getBoundBoxCenter());
}, "~N");
Clazz_defineMethod(c$, "getBoundBoxCornerVector", 
function(){
return this.boxInfo.getBoundBoxCornerVector();
});
Clazz_defineMethod(c$, "getBBoxVertices", 
function(){
return this.boxInfo.getBoundBoxVertices();
});
Clazz_defineMethod(c$, "setBoundBox", 
function(pt1, pt2, byCorner, scale){
if (scale == 0 && this.msInfo != null) {
this.msInfo.remove("boundbox");
this.defaultBBox = null;
this.isBbcageDefault = false;
this.calcBoundBoxDimensions(null, scale = 1);
}this.isBbcageDefault = false;
this.bboxModels = null;
this.bboxAtoms = null;
this.boxInfo.setBoundBox(pt1, pt2, byCorner, scale);
}, "JU.T3,JU.T3,~B,~N");
Clazz_defineMethod(c$, "getBoundBoxCommand", 
function(withOptions){
if (!withOptions && this.bboxAtoms != null) return "boundbox " + JU.Escape.eBS(this.bboxAtoms);
this.ptTemp.setT(this.boxInfo.getBoundBoxCenter());
var bbVector = this.boxInfo.getBoundBoxCornerVector();
var s = (withOptions ? "boundbox " + JU.Escape.eP(this.ptTemp) + " " + JU.Escape.eP(bbVector) + "\n#or\n" : "");
this.ptTemp.sub(bbVector);
s += "boundbox corners " + JU.Escape.eP(this.ptTemp) + " ";
this.ptTemp.scaleAdd2(2, bbVector, this.ptTemp);
var v = Math.abs(8 * bbVector.x * bbVector.y * bbVector.z);
s += JU.Escape.eP(this.ptTemp) + " # volume = " + v;
return s;
}, "~B");
Clazz_defineMethod(c$, "findAtomsInRectangle", 
function(rect){
var bsModels = this.vwr.getVisibleFramesBitSet();
var bs =  new JU.BS();
for (var i = this.ac; --i >= 0; ) {
var atom = this.at[i];
if (JM.AtomCollection.isDeleted(atom)) continue;
if (!bsModels.get(atom.mi)) i = this.am[atom.mi].firstAtomIndex;
 else if (atom.checkVisible() && rect.contains(atom.sX, atom.sY)) bs.set(i);
}
return bs;
}, "JU.Rectangle");
Clazz_defineMethod(c$, "getDefaultVdwType", 
function(modelIndex){
return (!this.am[modelIndex].isBioModel ? J.c.VDW.AUTO_BABEL : this.am[modelIndex].hydrogenCount == 0 ? J.c.VDW.AUTO_JMOL : J.c.VDW.AUTO_BABEL);
}, "~N");
Clazz_defineMethod(c$, "setRotationRadius", 
function(modelIndex, angstroms){
if (this.isJmolDataFrame(modelIndex)) {
this.am[modelIndex].defaultRotationRadius = angstroms;
return false;
}return true;
}, "~N,~N");
Clazz_defineMethod(c$, "calcRotationRadius", 
function(modelIndex, center, useBoundBox){
if (this.isJmolDataFrame(modelIndex)) {
var r = this.am[modelIndex].defaultRotationRadius;
return (r == 0 ? 10 : r);
}if (useBoundBox && this.getDefaultBoundBox() != null) return this.defaultBBox.getMaxDim() / 2 * 1.2;
if (this.ac == 0) return 10;
modelIndex = -2;
var maxRadius = 0;
for (var i = this.ac; --i >= 0; ) {
var atom = this.at[i];
if (JM.AtomCollection.isDeleted(atom)) continue;
if (this.isJmolDataFrameForAtom(atom)) {
modelIndex = atom.mi;
while (i >= 0 && this.at[i] != null && this.at[i].mi == modelIndex) i--;

i++;
continue;
} else if (atom.mi != modelIndex) {
modelIndex = atom.mi;
var uc = (this.am[modelIndex].isBioModel ? null : this.getUnitCell(modelIndex));
if (uc != null) {
var pts = uc.getUnitCellVerticesNoOffset();
var off = uc.getCartesianOffset();
for (var j = 0; j < 8; j++) {
this.ptTemp.setT(pts[j]);
this.ptTemp.add(off);
maxRadius = Math.max(maxRadius, center.distance(this.ptTemp));
}
}}var d = center.distance(atom) + this.getRadiusVdwJmol(atom);
if (d > maxRadius) maxRadius = d;
}
return (maxRadius == 0 ? 10 : maxRadius);
}, "~N,JU.P3,~B");
Clazz_defineMethod(c$, "calcBoundBoxDimensions", 
function(bs, scale){
if (bs != null && bs.nextSetBit(0) < 0) bs = null;
if (bs == null && this.isBbcageDefault || this.ac == 0) return;
if (this.getDefaultBoundBox() == null) {
this.bboxModels = this.getModelBS(this.bboxAtoms = JU.BSUtil.copy(bs), false);
if (this.calcAtomsMinMax(bs, this.boxInfo) == this.ac) this.isBbcageDefault = true;
if (bs == null) {
if (this.unitCells != null) this.calcUnitCellMinMax();
}} else {
var vertices = this.defaultBBox.getBoundBoxVertices();
this.boxInfo.reset();
for (var j = 0; j < 8; j++) this.boxInfo.addBoundBoxPoint(vertices[j]);

}this.boxInfo.setBbcage(scale);
}, "JU.BS,~N");
Clazz_defineMethod(c$, "getDefaultBoundBox", 
function(){
var bbox = this.getInfoM("boundbox");
if (bbox == null) this.defaultBBox = null;
 else {
if (this.defaultBBox == null) this.defaultBBox =  new JU.BoxInfo();
this.defaultBBox.setBoundBoxFromOABC(bbox);
}return this.defaultBBox;
});
Clazz_defineMethod(c$, "getBoxInfo", 
function(bs, scale){
if (bs == null) return this.boxInfo;
var bi =  new JU.BoxInfo();
this.calcAtomsMinMax(bs, bi);
bi.setBbcage(scale);
return bi;
}, "JU.BS,~N");
Clazz_defineMethod(c$, "calcAtomsMinMax", 
function(bs, boxInfo){
boxInfo.reset();
var nAtoms = 0;
var isAll = (bs == null);
var i0 = (isAll ? this.ac - 1 : bs.nextSetBit(0));
for (var i = i0; i >= 0; i = (isAll ? i - 1 : bs.nextSetBit(i + 1))) {
nAtoms++;
var a = this.at[i];
if (a != null && !this.isJmolDataFrameForAtom(a)) boxInfo.addBoundBoxPoint(a);
}
return nAtoms;
}, "JU.BS,JU.BoxInfo");
Clazz_defineMethod(c$, "calcUnitCellMinMax", 
function(){
var pt =  new JU.P3();
for (var i = 0; i < this.mc; i++) {
var uc = this.unitCells[i];
if (uc == null || !uc.getCoordinatesAreFractional()) continue;
var vertices = uc.getUnitCellVerticesNoOffset();
var offset = uc.getCartesianOffset();
for (var j = 0; j < 8; j++) {
pt.add2(offset, vertices[j]);
this.boxInfo.addBoundBoxPoint(pt);
}
}
});
Clazz_defineMethod(c$, "calcRotationRadiusBs", 
function(bs){
var center = this.getAtomSetCenter(bs);
var maxRadius = 0;
for (var i = bs.nextSetBit(0); i >= 0; i = bs.nextSetBit(i + 1)) {
var atom = this.at[i];
var distAtom = center.distance(atom);
var outerVdw = distAtom + this.getRadiusVdwJmol(atom);
if (outerVdw > maxRadius) maxRadius = outerVdw;
}
return (maxRadius == 0 ? 10 : maxRadius);
}, "JU.BS");
Clazz_defineMethod(c$, "getCenterAndPoints", 
function(vAtomSets, addCenters){
var bsAtoms1;
var bsAtoms2;
var n = (addCenters ? 1 : 0);
for (var ii = vAtomSets.size(); --ii >= 0; ) {
var bss = vAtomSets.get(ii);
bsAtoms1 = bss[0];
if (Clazz_instanceOf(bss[1],"JU.BS")) {
bsAtoms2 = bss[1];
n += Math.min(bsAtoms1.cardinality(), bsAtoms2.cardinality());
} else {
n += Math.min(bsAtoms1.cardinality(), (bss[1]).length);
}}
var points =  Clazz_newArray(2, n, null);
if (addCenters) {
points[0][0] =  new JU.P3();
points[1][0] =  new JU.P3();
}for (var ii = vAtomSets.size(); --ii >= 0; ) {
var bss = vAtomSets.get(ii);
bsAtoms1 = bss[0];
if (Clazz_instanceOf(bss[1],"JU.BS")) {
bsAtoms2 = bss[1];
for (var i = bsAtoms1.nextSetBit(0), j = bsAtoms2.nextSetBit(0); i >= 0 && j >= 0; i = bsAtoms1.nextSetBit(i + 1), j = bsAtoms2.nextSetBit(j + 1)) {
points[0][--n] = this.at[i];
points[1][n] = this.at[j];
if (addCenters) {
points[0][0].add(this.at[i]);
points[1][0].add(this.at[j]);
}}
} else {
var coords = bss[1];
for (var pt = 0, i = bsAtoms1.nextSetBit(0), j = 0; i >= 0 && j < coords.length; i = bsAtoms1.nextSetBit(i + 1), j++, pt++) {
if (addCenters) {
points[0][0].add(this.at[i]);
points[1][0].add(coords[j]);
points[0][--n] = this.at[i];
points[1][n] = coords[j];
} else {
points[0][pt] = this.at[i];
points[1][pt] = coords[j];
}}
}}
if (addCenters) {
points[0][0].scale(1 / (points[0].length - 1));
points[1][0].scale(1 / (points[1].length - 1));
}return points;
}, "JU.Lst,~B");
Clazz_defineMethod(c$, "getAtomSetCenter", 
function(bs){
var ptCenter =  new JU.P3();
var nPoints = 0;
for (var i = bs.nextSetBit(0); i >= 0; i = bs.nextSetBit(i + 1)) {
if (!this.isJmolDataFrameForAtom(this.at[i])) {
nPoints++;
ptCenter.add(this.at[i]);
}}
if (nPoints > 1) ptCenter.scale(1.0 / nPoints);
return ptCenter;
}, "JU.BS");
Clazz_defineMethod(c$, "getAverageAtomPoint", 
function(){
return this.getAtomSetCenter(this.vwr.bsA());
});
Clazz_defineMethod(c$, "setAPm", 
function(bs, tok, iValue, fValue, sValue, values, list){
this.setAPa(bs, tok, iValue, fValue, sValue, values, list);
switch (tok) {
case 1094715420:
case 1631586315:
if (this.vwr.getBoolean(603979944)) this.assignAromaticBondsBs(true, null);
break;
}
}, "JU.BS,~N,~N,~N,~S,~A,~A");
Clazz_defineMethod(c$, "addStateScript", 
function(script1, bsBonds, bsAtoms1, bsAtoms2, script2, addFrameNumber, postDefinitions){
var iModel = this.vwr.am.cmi;
if (addFrameNumber) {
if (this.thisStateModel != iModel) script1 = "frame " + (iModel < 0 ? "all #" + iModel : this.getModelNumberDotted(iModel)) + ";\n  " + script1;
this.thisStateModel = iModel;
} else {
this.thisStateModel = -1;
}var stateScript =  new JM.StateScript(this.thisStateModel, script1, bsBonds, bsAtoms1, bsAtoms2, script2, postDefinitions);
if (stateScript.isValid()) {
this.stateScripts.addLast(stateScript);
}return stateScript;
}, "~S,JU.BS,JU.BS,JU.BS,~S,~B,~B");
Clazz_defineMethod(c$, "freezeModels", 
function(){
this.haveBioModels = false;
this.haveMultipleChains = false;
for (var iModel = this.mc; --iModel >= 0; ) {
this.haveBioModels = new Boolean (this.haveBioModels | this.am[iModel].freeze()).valueOf();
if (this.am[iModel].chainCount > 1) this.haveMultipleChains = true;
}
});
Clazz_defineMethod(c$, "getStructureList", 
function(){
return this.vwr.getStructureList();
});
Clazz_defineMethod(c$, "getInfoM", 
function(keyName){
return (this.msInfo == null ? null : this.msInfo.get(keyName));
}, "~S");
Clazz_defineMethod(c$, "getMSInfoB", 
function(keyName){
var val = this.getInfoM(keyName);
return (Clazz_instanceOf(val, Boolean) && (val).booleanValue());
}, "~S");
Clazz_defineMethod(c$, "isTrajectory", 
function(modelIndex){
return this.am[modelIndex].isTrajectory;
}, "~N");
Clazz_defineMethod(c$, "isTrajectorySubFrame", 
function(i){
return (this.am[i].trajectoryBaseIndex != i);
}, "~N");
Clazz_defineMethod(c$, "isTrajectoryMeasurement", 
function(countPlusIndices){
return (this.trajectory != null && this.trajectory.hasMeasure(countPlusIndices));
}, "~A");
Clazz_defineMethod(c$, "getModelBS", 
function(atomList, allTrajectories){
var bs =  new JU.BS();
var modelIndex = 0;
var isAll = (atomList == null);
allTrajectories = new Boolean (allTrajectories & (this.trajectory != null)).valueOf();
var i0 = (isAll ? 0 : atomList.nextSetBit(0));
for (var i = i0; i >= 0 && i < this.ac; i = (isAll ? i + 1 : atomList.nextSetBit(i + 1))) {
if (JM.AtomCollection.isDeleted(this.at[i])) continue;
bs.set(modelIndex = this.at[i].mi);
if (allTrajectories) this.trajectory.getModelBS(modelIndex, bs);
var m = this.am[modelIndex];
if (m.isOrderly) i = m.firstAtomIndex + m.act - 1;
}
return bs;
}, "JU.BS,~B");
Clazz_defineMethod(c$, "getIterativeModels", 
function(allowJmolData){
var bs =  new JU.BS();
for (var i = 0; i < this.mc; i++) {
if (!allowJmolData && this.isJmolDataFrame(i)) continue;
if (!this.isTrajectorySubFrame(i)) bs.set(i);
}
return bs;
}, "~B");
Clazz_defineMethod(c$, "fillAtomData", 
function(atomData, mode){
if ((mode & 4) != 0) {
this.getMolecules();
atomData.bsMolecules =  new Array(this.molecules.length);
atomData.atomMolecule =  Clazz_newIntArray (this.ac, 0);
var bs;
for (var i = 0; i < this.molecules.length; i++) {
bs = atomData.bsMolecules[i] = this.molecules[i].atomList;
for (var iAtom = bs.nextSetBit(0); iAtom >= 0; iAtom = bs.nextSetBit(iAtom + 1)) atomData.atomMolecule[iAtom] = i;

}
}if ((mode & 8) != 0) {
var nH =  Clazz_newIntArray (1, 0);
atomData.hAtomRadius = this.vwr.getVanderwaalsMar(1) / 1000;
atomData.hAtoms = this.calculateHydrogens(atomData.bsSelected, nH, null, 512);
atomData.hydrogenAtomCount = nH[0];
return;
}if (atomData.modelIndex < 0) atomData.firstAtomIndex = (atomData.bsSelected == null ? 0 : Math.max(0, atomData.bsSelected.nextSetBit(0)));
 else atomData.firstAtomIndex = this.am[atomData.modelIndex].firstAtomIndex;
atomData.lastModelIndex = atomData.firstModelIndex = (this.ac == 0 ? 0 : this.at[atomData.firstAtomIndex].mi);
atomData.modelName = this.getModelNumberDotted(atomData.firstModelIndex);
this.fillADa(atomData, mode);
}, "J.atomdata.AtomData,~N");
Clazz_defineMethod(c$, "getModelNumberDotted", 
function(modelIndex){
return (this.mc < 1 || modelIndex >= this.mc || modelIndex < 0 ? "" : JU.Escape.escapeModelFileNumber(this.modelFileNumbers[modelIndex]));
}, "~N");
Clazz_defineMethod(c$, "getModelNumber", 
function(modelIndex){
return this.modelNumbers[modelIndex == 2147483647 ? this.mc - 1 : modelIndex];
}, "~N");
Clazz_defineMethod(c$, "getModelProperty", 
function(modelIndex, property){
var props = this.am[modelIndex].properties;
return props == null ? null : props.getProperty(property);
}, "~N,~S");
Clazz_defineMethod(c$, "getModelAuxiliaryInfo", 
function(modelIndex){
return (modelIndex < 0 ? null : this.am[modelIndex].auxiliaryInfo);
}, "~N");
Clazz_defineMethod(c$, "setInfo", 
function(modelIndex, key, value){
if (modelIndex >= 0 && modelIndex < this.mc) {
if (value == null) this.am[modelIndex].auxiliaryInfo.remove(key);
 else this.am[modelIndex].auxiliaryInfo.put(key, value);
}}, "~N,~O,~O");
Clazz_defineMethod(c$, "getInfo", 
function(modelIndex, key){
return (modelIndex < 0 ? null : this.am[modelIndex].auxiliaryInfo.get(key));
}, "~N,~S");
Clazz_defineMethod(c$, "getInfoB", 
function(modelIndex, keyName){
var info = this.am[modelIndex].auxiliaryInfo;
return (info != null && info.containsKey(keyName) && (info.get(keyName)).booleanValue());
}, "~N,~S");
Clazz_defineMethod(c$, "getInfoI", 
function(modelIndex, keyName){
var info = this.am[modelIndex].auxiliaryInfo;
if (info != null && info.containsKey(keyName)) {
return (info.get(keyName)).intValue();
}return -2147483648;
}, "~N,~S");
Clazz_defineMethod(c$, "getInsertionCountInModel", 
function(modelIndex){
return this.am[modelIndex].insertionCount;
}, "~N");
c$.modelFileNumberFromFloat = Clazz_defineMethod(c$, "modelFileNumberFromFloat", 
function(fDotM){
var file = Clazz_doubleToInt(Math.floor(fDotM));
var model = Clazz_doubleToInt(Math.floor((fDotM - file + 0.00001) * 10000));
while (model != 0 && model % 10 == 0) model /= 10;

return file * 1000000 + model;
}, "~N");
Clazz_defineMethod(c$, "getChainCountInModelWater", 
function(modelIndex, countWater){
if (modelIndex < 0) {
var chainCount = 0;
for (var i = this.mc; --i >= 0; ) chainCount += this.am[i].getChainCount(countWater);

return chainCount;
}return this.am[modelIndex].getChainCount(countWater);
}, "~N,~B");
Clazz_defineMethod(c$, "getGroupCountInModel", 
function(modelIndex){
if (modelIndex < 0) {
var groupCount = 0;
for (var i = this.mc; --i >= 0; ) groupCount += this.am[i].getGroupCount();

return groupCount;
}return this.am[modelIndex].getGroupCount();
}, "~N");
Clazz_defineMethod(c$, "calcSelectedGroupsCount", 
function(){
var bsSelected = this.vwr.bsA();
for (var i = this.mc; --i >= 0; ) this.am[i].calcSelectedGroupsCount(bsSelected);

});
Clazz_defineMethod(c$, "isJmolDataFrame", 
function(modelIndex){
return this.haveJmolDataFrames && (this.am != null && modelIndex >= 0 && modelIndex < this.mc && this.am[modelIndex].isJmolDataFrame);
}, "~N");
Clazz_defineMethod(c$, "isJmolDataFrameForAtom", 
function(atom){
return this.haveJmolDataFrames && this.am[atom.mi].isJmolDataFrame;
}, "JM.Atom");
Clazz_defineMethod(c$, "getJmolDataFrameIndex", 
function(modelIndex, type){
if (this.am[modelIndex].dataFrames == null) {
return -1;
}var index = this.am[modelIndex].dataFrames.get(type);
return (index == null ? -1 : index.intValue());
}, "~N,~S");
Clazz_defineMethod(c$, "getJmolDataFrameInt", 
function(modelIndex, type){
modelIndex = this.getJmolDataSourceFrame(modelIndex);
if (!this.haveJmolDataFrames || this.am[modelIndex].dataFrames == null) {
return -1;
}for (var e, $e = this.am[modelIndex].dataFrames.entrySet().iterator (); $e.hasNext()&& ((e = $e.next ()) || true);) {
var index = e.getValue().intValue();
if (this.am[index].jmolFrameTypeInt == type) return index;
}
return -1;
}, "~N,~N");
Clazz_defineMethod(c$, "clearDataFrameReference", 
function(modelIndex){
for (var i = 0; i < this.mc; i++) {
var df = this.am[i].dataFrames;
if (df == null) {
continue;
}var e = df.values().iterator();
while (e.hasNext()) {
if ((e.next()).intValue() == modelIndex) {
e.remove();
}}
if (df.isEmpty()) this.am[i].dataFrames = null;
}
}, "~N");
Clazz_defineMethod(c$, "getJmolFrameType", 
function(modelIndex){
return (modelIndex >= 0 && modelIndex < this.mc ? this.am[modelIndex].jmolFrameType : "modelSet");
}, "~N");
Clazz_defineMethod(c$, "getJmolFrameTypeInt", 
function(modelIndex){
return (this.haveJmolDataFrames && modelIndex >= 0 && modelIndex < this.mc ? this.am[modelIndex].jmolFrameTypeInt : 0);
}, "~N");
Clazz_defineMethod(c$, "getJmolDataSourceFrame", 
function(modelIndex){
return (modelIndex >= 0 && modelIndex < this.mc ? this.am[modelIndex].dataSourceFrame : -1);
}, "~N");
Clazz_defineMethod(c$, "saveModelOrientation", 
function(modelIndex, orientation){
this.am[modelIndex].orientation = orientation;
}, "~N,JM.Orientation");
Clazz_defineMethod(c$, "getModelOrientation", 
function(modelIndex){
return this.am[modelIndex].orientation;
}, "~N");
Clazz_defineMethod(c$, "getPDBHeader", 
function(modelIndex){
return (this.am[modelIndex].isBioModel ? (this.am[modelIndex]).getFullPDBHeader() : this.getFileHeader(modelIndex));
}, "~N");
Clazz_defineMethod(c$, "getFileHeader", 
function(modelIndex){
if (modelIndex < 0) return "";
if (this.am[modelIndex].isBioModel) return this.getPDBHeader(modelIndex);
var info = this.getInfo(modelIndex, "fileHeader");
if (info == null) info = this.modelSetName;
if (info != null) return info;
return "no header information found";
}, "~N");
Clazz_defineMethod(c$, "getAltLocCountInModel", 
function(modelIndex){
return this.am[modelIndex].altLocCount;
}, "~N");
Clazz_defineMethod(c$, "getAltLocIndexInModel", 
function(modelIndex, alternateLocationID){
if (alternateLocationID == '\0') {
return 0;
}var altLocList = this.getAltLocListInModel(modelIndex);
if (altLocList.length == 0) {
return 0;
}return altLocList.indexOf(alternateLocationID) + 1;
}, "~N,~S");
Clazz_defineMethod(c$, "getInsertionCodeIndexInModel", 
function(modelIndex, insertionCode){
if (insertionCode == '\0') return 0;
var codeList = this.getInsertionListInModel(modelIndex);
if (codeList.length == 0) return 0;
return codeList.indexOf(insertionCode) + 1;
}, "~N,~S");
Clazz_defineMethod(c$, "getAltLocListInModel", 
function(modelIndex){
var str = this.getInfo(modelIndex, "altLocs");
return (str == null ? "" : str);
}, "~N");
Clazz_defineMethod(c$, "getInsertionListInModel", 
function(modelIndex){
var str = this.getInfo(modelIndex, "insertionCodes");
return (str == null ? "" : str);
}, "~N");
Clazz_defineMethod(c$, "getModelSymmetryCount", 
function(modelIndex){
return (this.am[modelIndex].biosymmetryCount > 0 ? this.am[modelIndex].biosymmetryCount : this.unitCells == null || this.unitCells[modelIndex] == null ? 0 : this.unitCells[modelIndex].getSpaceGroupOperationCount());
}, "~N");
Clazz_defineMethod(c$, "getModelCellRange", 
function(modelIndex){
return (this.unitCells == null ? null : this.unitCells[modelIndex].getCellRange());
}, "~N");
Clazz_defineMethod(c$, "getLastVibrationVector", 
function(modelIndex, tok){
if (this.vibrations != null && modelIndex < this.vwr.ms.mc) {
var v;
var a1 = (modelIndex < 0 || this.isTrajectory(modelIndex) || modelIndex >= this.mc - 1 ? this.ac : this.am[modelIndex + 1].firstAtomIndex);
var a0 = (modelIndex <= 0 ? 0 : this.am[modelIndex].firstAtomIndex);
for (var i = a1; --i >= a0; ) {
if ((modelIndex < 0 || !JM.AtomCollection.isDeleted(this.at[i]) && this.at[i].mi == modelIndex) && ((tok == 1275072532 || tok == 0) && (v = this.getModulation(i)) != null || (tok == 4166 || tok == 0) && (v = this.getVibration(i, false)) != null) && v.isNonzero()) return i;
}
}return -1;
}, "~N,~N");
Clazz_defineMethod(c$, "getModulationList", 
function(bs, type, t456){
var list =  new JU.Lst();
if (this.vibrations != null) for (var i = bs.nextSetBit(0); i >= 0; i = bs.nextSetBit(i + 1)) if (Clazz_instanceOf(this.vibrations[i],"J.api.JmolModulationSet")) list.addLast((this.vibrations[i]).getModulation(type, t456, false));
 else list.addLast(Float.$valueOf(type == 'O' ? NaN : -1));

return list;
}, "JU.BS,~S,JU.P3");
Clazz_defineMethod(c$, "getElementsPresentBitSet", 
function(modelIndex){
if (modelIndex >= 0) return this.elementsPresent[modelIndex];
var bs =  new JU.BS();
for (var i = 0; i < this.mc; i++) bs.or(this.elementsPresent[i]);

return bs;
}, "~N");
Clazz_defineMethod(c$, "getMoleculeIndex", 
function(atomIndex, inModel){
if (this.moleculeCount == 0) this.getMolecules();
for (var i = 0; i < this.moleculeCount; i++) {
if (this.molecules[i].atomList.get(atomIndex)) return (inModel ? this.molecules[i].indexInModel : i);
}
return 0;
}, "~N,~B");
Clazz_defineMethod(c$, "getMoleculeBitSet", 
function(bs){
if (this.moleculeCount == 0) this.getMolecules();
var bsResult = JU.BSUtil.copy(bs);
var bsInitial = JU.BSUtil.copy(bs);
var i = 0;
var bsTemp =  new JU.BS();
while ((i = bsInitial.length() - 1) >= 0) {
bsTemp = this.getMoleculeBitSetForAtom(i);
if (bsTemp == null) {
bsInitial.clear(i);
bsResult.clear(i);
continue;
}bsInitial.andNot(bsTemp);
bsResult.or(bsTemp);
}
return bsResult;
}, "JU.BS");
Clazz_defineMethod(c$, "getMoleculeBitSetForAtom", 
function(atomIndex){
if (this.moleculeCount == 0) this.getMolecules();
for (var i = 0; i < this.moleculeCount; i++) if (this.molecules[i].atomList.get(atomIndex)) return this.molecules[i].atomList;

return null;
}, "~N");
Clazz_defineMethod(c$, "getModelDipole", 
function(modelIndex){
if (modelIndex < 0) return null;
var dipole = this.getInfo(modelIndex, "dipole");
if (dipole == null) dipole = this.getInfo(modelIndex, "DIPOLE_VEC");
return dipole;
}, "~N");
Clazz_defineMethod(c$, "calculateMolecularDipole", 
function(modelIndex, bsAtoms){
if (bsAtoms != null) {
var ia = bsAtoms.nextSetBit(0);
if (ia < 0) return null;
modelIndex = this.at[ia].mi;
}if (modelIndex < 0) return null;
var nPos = 0;
var nNeg = 0;
var cPos = 0;
var cNeg = 0;
var pos =  new JU.V3();
var neg =  new JU.V3();
if (bsAtoms == null) bsAtoms = this.getModelAtomBitSetIncludingDeleted(-1, false);
this.vwr.getOrCalcPartialCharges(this.am[modelIndex].bsAtoms, null);
for (var i = bsAtoms.nextSetBit(0); i >= 0; i = bsAtoms.nextSetBit(i + 1)) {
if (JM.AtomCollection.isDeleted(this.at[i]) || this.at[i].mi != modelIndex) {
continue;
}var c = this.partialCharges[i];
if (c < 0) {
nNeg++;
cNeg += c;
neg.scaleAdd2(c, this.at[i], neg);
} else if (c > 0) {
nPos++;
cPos += c;
pos.scaleAdd2(c, this.at[i], pos);
}}
if (Math.abs(cPos + cNeg) > 0.015) {
var err = "Dipole calculation requires balanced charges: " + cPos + " " + cNeg;
JU.Logger.info(err);
throw  new RuntimeException(err);
}if (nNeg == 0 || nPos == 0) return null;
pos.add(neg);
pos.scale(4.8);
return pos;
}, "~N,JU.BS");
Clazz_defineMethod(c$, "getMoleculeCountInModel", 
function(modelIndex){
var n = 0;
if (this.moleculeCount == 0) this.getMolecules();
if (modelIndex < 0) return this.moleculeCount;
for (var i = 0; i < this.mc; i++) {
if (modelIndex == i) n += this.am[i].moleculeCount;
}
return n;
}, "~N");
Clazz_defineMethod(c$, "calcSelectedMoleculesCount", 
function(){
var bsSelected = this.vwr.bsA();
if (this.moleculeCount == 0) this.getMolecules();
this.selectedMolecules.xor(this.selectedMolecules);
var bsTemp =  new JU.BS();
for (var i = 0; i < this.moleculeCount; i++) {
JU.BSUtil.copy2(bsSelected, bsTemp);
bsTemp.and(this.molecules[i].atomList);
if (bsTemp.length() > 0) {
this.selectedMolecules.set(i);
}}
});
Clazz_defineMethod(c$, "setCentroid", 
function(bs, minmax){
var bsDelete = this.getNotInCentroid(bs, minmax);
if (bsDelete != null && bsDelete.nextSetBit(0) >= 0) this.vwr.deleteAtoms(bsDelete, false);
}, "JU.BS,~A");
Clazz_defineMethod(c$, "getNotInCentroid", 
function(bs, minmax){
var iAtom0 = bs.nextSetBit(0);
if (iAtom0 < 0) return null;
var uc = this.getUnitCell(this.at[iAtom0].mi);
return (uc == null ? null : uc.notInCentroid(this, bs, minmax));
}, "JU.BS,~A");
Clazz_defineMethod(c$, "getMolecules", 
function(){
if (this.moleculeCount > 0) return this.molecules;
if (this.molecules == null) this.molecules =  new Array(4);
this.moleculeCount = 0;
var m = null;
var bsModelAtoms =  new Array(this.mc);
var biobranches = null;
for (var i = 0; i < this.mc; i++) {
bsModelAtoms[i] = this.vwr.getModelUndeletedAtomsBitSet(i);
m = this.am[i];
m.moleculeCount = 0;
biobranches = (m.isBioModel ? (m).getBioBranches(biobranches) : null);
}
this.molecules = JU.JmolMolecule.getMolecules(this.at, bsModelAtoms, biobranches, null);
this.moleculeCount = this.molecules.length;
for (var i = this.moleculeCount; --i >= 0; ) {
m = this.am[this.molecules[i].modelIndex];
m.firstMoleculeIndex = i;
m.moleculeCount++;
}
return this.molecules;
});
Clazz_defineMethod(c$, "initializeBspf", 
function(){
if (this.bspf != null && this.bspf.isValid) return;
if (this.showRebondTimes) JU.Logger.startTimer("build bspf");
var bspf =  new J.bspt.Bspf(3);
if (JU.Logger.debugging) JU.Logger.debug("sequential bspt order");
var bsNew = JU.BS.newN(this.mc);
for (var i = this.ac; --i >= 0; ) {
var atom = this.at[i];
if (!JM.AtomCollection.isDeleted(atom) && !this.isTrajectorySubFrame(atom.mi)) {
bspf.addTuple(this.am[atom.mi].trajectoryBaseIndex, atom);
bsNew.set(atom.mi);
}}
if (this.showRebondTimes) {
JU.Logger.checkTimer("build bspf", false);
bspf.stats();
}for (var i = bsNew.nextSetBit(0); i >= 0; i = bsNew.nextSetBit(i + 1)) bspf.validateModel(i, true);

bspf.isValid = true;
this.bspf = bspf;
});
Clazz_defineMethod(c$, "initializeBspt", 
function(modelIndex){
this.initializeBspf();
if (this.bspf.isInitializedIndex(modelIndex)) return;
this.bspf.initialize(modelIndex, this.at, this.vwr.getModelUndeletedAtomsBitSet(modelIndex));
}, "~N");
Clazz_defineMethod(c$, "setIteratorForPoint", 
function(iterator, modelIndex, pt, distance){
if (modelIndex < 0) {
iterator.setCenter(pt, distance);
return;
}this.initializeBspt(modelIndex);
iterator.setModel(this, modelIndex, this.am[modelIndex].firstAtomIndex, 2147483647, pt, distance, null);
}, "J.api.AtomIndexIterator,~N,JU.T3,~N");
Clazz_defineMethod(c$, "setIteratorForAtom", 
function(iterator, modelIndex, atomIndex, distance, rd){
if (modelIndex < 0) modelIndex = this.at[atomIndex].mi;
modelIndex = this.am[modelIndex].trajectoryBaseIndex;
this.initializeBspt(modelIndex);
iterator.setModel(this, modelIndex, this.am[modelIndex].firstAtomIndex, atomIndex, this.at[atomIndex], distance, rd);
}, "J.api.AtomIndexIterator,~N,~N,~N,J.atomdata.RadiusData");
Clazz_defineMethod(c$, "getSelectedAtomIterator", 
function(bsSelected, isGreaterOnly, modelZeroBased, hemisphereOnly, isMultiModel){
this.initializeBspf();
var iter;
if (isMultiModel) {
var bsModels = this.getModelBS(bsSelected, false);
for (var i = bsModels.nextSetBit(0); i >= 0; i = bsModels.nextSetBit(i + 1)) this.initializeBspt(i);

iter =  new JM.AtomIteratorWithinModelSet(bsModels);
} else {
iter =  new JM.AtomIteratorWithinModel();
}iter.initialize(this.bspf, bsSelected, isGreaterOnly, modelZeroBased, hemisphereOnly, this.vwr.isParallel());
return iter;
}, "JU.BS,~B,~B,~B,~B");
Clazz_overrideMethod(c$, "getBondCountInModel", 
function(modelIndex){
return (modelIndex < 0 ? this.bondCount : this.am[modelIndex].getBondCount());
}, "~N");
Clazz_defineMethod(c$, "getAtomCountInModel", 
function(modelIndex){
return (modelIndex < 0 ? this.ac : this.am[modelIndex].act);
}, "~N");
Clazz_defineMethod(c$, "getModelAtomBitSetIncludingDeletedBs", 
function(bsModels){
var bs =  new JU.BS();
if (bsModels == null && this.bsAll == null) this.bsAll = JU.BSUtil.setAll(this.ac);
if (bsModels == null) bs.or(this.bsAll);
 else for (var i = bsModels.nextSetBit(0); i >= 0; i = bsModels.nextSetBit(i + 1)) bs.or(this.getModelAtomBitSetIncludingDeleted(i, false));

return bs;
}, "JU.BS");
Clazz_defineMethod(c$, "getModelAtomBitSetIncludingDeleted", 
function(modelIndex, asCopy){
var bs = (modelIndex < 0 ? this.bsAll : this.am[modelIndex].bsAtoms);
if (bs == null) bs = this.bsAll = JU.BSUtil.setAll(this.ac);
return (asCopy ? JU.BSUtil.copy(bs) : bs);
}, "~N,~B");
Clazz_defineMethod(c$, "getAtomBitsMaybeDeleted", 
function(tokType, specInfo){
var bs;
var o = null;
switch (tokType) {
default:
return this.getAtomBitsMDa(tokType, specInfo, bs =  new JU.BS());
case 1073741925:
case 1073742189:
case 1111490587:
case 1073742128:
case 1073741863:
case 1086324744:
bs =  new JU.BS();
return (this.haveBioModels ? this.bioModelset.getAtomBitsStr(tokType, specInfo, bs) : bs);
case 1677721602:
case 1073742331:
return this.getAtomBitsMDb(tokType, specInfo);
case 1812599299:
var boxInfo = this.getBoxInfo(specInfo, 1);
bs = this.getAtomsWithin(boxInfo.getBoundBoxCornerVector().length() + 0.0001, boxInfo.getBoundBoxCenter(), null, -1);
for (var i = bs.nextSetBit(0); i >= 0; i = bs.nextSetBit(i + 1)) if (!boxInfo.isWithin(this.at[i])) bs.clear(i);

return bs;
case 1094713350:
bs = JU.BSUtil.newBitSet2(0, this.ac);
var pt1 = specInfo;
var minmax =  Clazz_newIntArray(-1, [Clazz_floatToInt(pt1.x) - 1, Clazz_floatToInt(pt1.y) - 1, Clazz_floatToInt(pt1.z) - 1, Clazz_floatToInt(pt1.x), Clazz_floatToInt(pt1.y), Clazz_floatToInt(pt1.z), 0]);
for (var i = this.mc; --i >= 0; ) {
var uc1 = this.getUnitCell(i);
if (uc1 == null) {
JU.BSUtil.andNot(bs, this.am[i].bsAtoms);
continue;
}bs.andNot(uc1.notInCentroid(this, this.am[i].bsAtoms, minmax));
}
return bs;
case 1094713360:
return this.getMoleculeBitSet(specInfo);
case 1073742363:
return this.getSelectCodeRange(specInfo);
case 2097196:
bs = JU.BS.newN(this.ac);
var modelIndex = -1;
var nOps = 0;
for (var i = this.ac; --i >= 0; ) {
var atom = this.at[i];
if (JM.AtomCollection.isDeleted(atom)) continue;
var bsSym = atom.atomSymmetry;
if (bsSym != null) {
if (atom.mi != modelIndex) {
modelIndex = atom.mi;
if (this.getModelCellRange(modelIndex) == null) continue;
nOps = this.getModelSymmetryCount(modelIndex);
}var n = 0;
for (var j = nOps; --j >= 0; ) if (bsSym.get(j)) if (++n > 1) {
bs.set(i);
break;
}
}}
return bs;
case 1088421903:
return JU.BSUtil.copy(this.bsSymmetry == null ? this.bsSymmetry = JU.BS.newN(this.ac) : this.bsSymmetry);
case 1814695966:
var isSU = "unitcell".equals(specInfo);
var d = (specInfo == null || isSU ? null : (o = specInfo)[1]);
var d2 = (o != null && o.length == 3 ? (o[2]) : null);
var packing = (d == null ? NaN : d.floatValue());
var packing2 = (d2 == null ? NaN : d2.floatValue());
if (o != null) specInfo = o[0];
var isWithin = (specInfo == null || (Clazz_instanceOf(specInfo,"J.api.SymmetryInterface")));
if (isWithin) {
bs =  new JU.BS();
var isStatic = (specInfo != null);
var uc1 = (Clazz_instanceOf(specInfo,"J.api.SymmetryInterface") ? specInfo : null);
if (isStatic && uc1 == null) return bs;
if (isStatic) uc1 = uc1.getUnitCellMultiplied();
var uc = uc1;
modelIndex = -1;
for (var i = this.ac; --i >= 0; ) {
if (this.at[i] != null) {
if (!isStatic) {
var mi = this.at[i].getModelIndex();
if (mi != modelIndex) {
modelIndex = mi;
uc = this.getUnitCell(mi);
if (uc != null) uc = uc.getUnitCellMultiplied();
}if (uc == null) continue;
}this.ptTemp1.setT(this.at[i]);
uc.toFractional(this.ptTemp1, false);
if (uc.checkPeriodic(this.ptTemp1, packing, packing2)) bs.set(i);
}}
return bs;
}if ("unitcell".equals(specInfo)) {
specInfo = JU.P3.new3(1, 1, 1);
}case 1094713349:
bs =  new JU.BS();
var distance;
var pt;
var uc0;
var uc;
if (Clazz_instanceOf(specInfo,"JU.P3")) {
pt = specInfo;
distance = NaN;
uc = uc0 = null;
} else {
uc = uc0 = (specInfo)[0];
distance = ((specInfo)[1] == null ? NaN : ((specInfo)[1]).floatValue());
var p4 = specInfo;
pt = JU.P3.newP(p4);
distance = p4.w;
}for (var mi = -1, i = this.ac; --i >= 0; ) {
if (JM.AtomCollection.isDeleted(this.at[i])) continue;
var mia = this.at[i].getModelIndex();
if (uc0 == null && mi != mia) {
mi = mia;
uc = this.getUnitCell(mi);
}if (uc == null) continue;
this.ptTemp.setT(this.at[i]);
uc.toFractional(this.ptTemp, false);
if (uc.isWithinUnitCell(this.ptTemp, pt.x, pt.y, pt.z, distance)) bs.set(i);
}
return bs;
}
}, "~N,~O");
Clazz_defineMethod(c$, "getSelectCodeRange", 
function(info){
var bs =  new JU.BS();
var seqcodeA = info[0];
var seqcodeB = info[1];
var chainID = info[2];
var caseSensitive = this.vwr.getBoolean(603979822);
if (chainID >= 0 && chainID < 300 && !caseSensitive) chainID = this.chainToUpper(chainID);
for (var iModel = this.mc; --iModel >= 0; ) if (this.am[iModel].isBioModel) {
var m = this.am[iModel];
var id;
for (var i = m.chainCount; --i >= 0; ) {
var chain = m.chains[i];
if (chainID == -1 || chainID == (id = chain.chainID) || !caseSensitive && id > 0 && id < 300 && chainID == this.chainToUpper(id)) {
var groups = chain.groups;
var n = chain.groupCount;
for (var index = 0; index >= 0; ) {
index = JM.ModelSet.selectSeqcodeRange(groups, n, index, seqcodeA, seqcodeB, bs);
}
}}
}
return bs;
}, "~A");
c$.selectSeqcodeRange = Clazz_defineMethod(c$, "selectSeqcodeRange", 
function(groups, n, index, seqcodeA, seqcodeB, bs){
var seqcode;
var indexA;
var indexB;
var minDiff;
var isInexact = false;
for (indexA = index; indexA < n && groups[indexA].seqcode != seqcodeA; indexA++) {
}
if (indexA == n) {
if (index > 0) return -1;
isInexact = true;
minDiff = 2147483647;
for (var i = n; --i >= 0; ) if ((seqcode = groups[i].seqcode) > seqcodeA && (seqcode - seqcodeA) < minDiff) {
indexA = i;
minDiff = seqcode - seqcodeA;
}
if (minDiff == 2147483647) return -1;
}if (seqcodeB == 2147483647) {
indexB = n - 1;
isInexact = true;
} else {
for (indexB = indexA; indexB < n && groups[indexB].seqcode != seqcodeB; indexB++) {
}
if (indexB == n) {
if (index > 0) return -1;
isInexact = true;
minDiff = 2147483647;
for (var i = indexA; i < n; i++) if ((seqcode = groups[i].seqcode) < seqcodeB && (seqcodeB - seqcode) < minDiff) {
indexB = i;
minDiff = seqcodeB - seqcode;
}
if (minDiff == 2147483647) return -1;
}}for (var i = indexA; i <= indexB; ++i) groups[i].setAtomBits(bs);

return (isInexact ? -1 : indexB + 1);
}, "~A,~N,~N,~N,~N,JU.BS");
Clazz_defineMethod(c$, "getAtomsWithinRadius", 
function(distance, bs, withinAllModels, rd, bsSubset){
var bsResult =  new JU.BS();
bs = JU.BSUtil.andNot(bs, this.vwr.slm.bsDeleted);
var iter = this.getSelectedAtomIterator(bsSubset, false, false, false, false);
if (withinAllModels) {
var fixJavaFloat = !this.vwr.g.legacyJavaFloat;
var ptTemp =  new JU.P3();
var bsModels = (bsSubset == null ? JU.BSUtil.newBitSet2(0, this.mc) : this.getModelBS(bsSubset, false));
bsModels.and(this.getIterativeModels(false));
for (var i = bs.nextSetBit(0); i >= 0; i = bs.nextSetBit(i + 1)) for (var iModel = bsModels.nextSetBit(0); iModel >= 0; iModel = bsModels.nextSetBit(iModel + 1)) {
if (distance < 0) {
this.getAtomsWithin(distance, this.at[i].getFractionalUnitCoordPt(fixJavaFloat, true, ptTemp), bsResult, iModel);
} else {
this.setIteratorForAtom(iter, iModel, i, distance, rd);
iter.addAtoms(bsResult);
}}

} else {
if (bsSubset == null) bsResult.or(bs);
for (var i = bs.nextSetBit(0); i >= 0; i = bs.nextSetBit(i + 1)) {
if (distance < 0) {
this.getAtomsWithin(distance, this.at[i], bsResult, this.at[i].mi);
} else {
this.setIteratorForAtom(iter, -1, i, distance, rd);
iter.addAtoms(bsResult);
}}
}iter.release();
return bsResult;
}, "~N,JU.BS,~B,J.atomdata.RadiusData,JU.BS");
Clazz_defineMethod(c$, "getAtomsWithin", 
function(distance, coord, bsResult, modelIndex){
if (bsResult == null) bsResult =  new JU.BS();
if (distance < 0) {
distance = -distance;
for (var i = this.ac; --i >= 0; ) {
var atom = this.at[i];
if (JM.AtomCollection.isDeleted(atom) || modelIndex >= 0 && atom.mi != modelIndex) continue;
if (!bsResult.get(i) && atom.getFractionalUnitDistance(coord, this.ptTemp1, this.ptTemp2) <= distance) bsResult.set(atom.i);
}
return bsResult;
}var iter = this.getSelectedAtomIterator(null, false, false, false, false);
var bsCheck = (modelIndex >= 0 ? JU.BSUtil.newAndSetBit(modelIndex) : this.getIterativeModels(true));
for (var m = bsCheck.nextSetBit(0); m >= 0; m = bsCheck.nextSetBit(m + 1)) {
var i = this.am[m].bsAtoms.nextSetBit(0);
if (i < 0) continue;
this.setIteratorForAtom(iter, modelIndex, i, -1, null);
iter.setCenter(coord, distance);
iter.addAtoms(bsResult);
}
iter.release();
return bsResult;
}, "~N,JU.T3,JU.BS,~N");
Clazz_defineMethod(c$, "deleteBonds", 
function(bsBonds, isFullModel){
if (!isFullModel) {
var bsA =  new JU.BS();
var bsB =  new JU.BS();
for (var i = bsBonds.nextSetBit(0); i >= 0; i = bsBonds.nextSetBit(i + 1)) {
var bond = this.bo[i];
if (bond == null) continue;
var atom1 = bond.atom1;
if (this.am[atom1.mi].isModelKit) continue;
bsA.clearAll();
bsB.clearAll();
bsA.set(atom1.i);
bsB.set(bond.getAtomIndex2());
this.addStateScript("connect ", null, bsA, bsB, "delete", false, true);
}
}this.dBb(bsBonds, isFullModel);
}, "JU.BS,~B");
Clazz_defineMethod(c$, "makeConnections2", 
function(minD, maxD, order, connectOperation, bsA, bsB, bsBonds, isBonds, addGroup, energy, state){
if (bsBonds == null) bsBonds =  new JU.BS();
var matchAny = (order == 65535);
var matchNull = (order == 131071);
var isAtrop = (order == 65537);
if (matchNull) order = 1;
var matchHbond = JU.Edge.isOrderH(order);
var identifyOnly = false;
var idOrModifyOnly = false;
var createOnly = false;
var autoAromatize = false;
switch (connectOperation) {
case 12291:
return this.deleteConnections(minD, maxD, order, bsA, bsB, isBonds, matchNull);
case 603979872:
case 1073741852:
if (order != 515) {
if (isBonds) {
var bs = bsA;
bsA =  new JU.BS();
bsB =  new JU.BS();
for (var i = bs.nextSetBit(0); i >= 0; i = bs.nextSetBit(i + 1)) {
if (this.bo[i] == null) continue;
bsA.set(this.bo[i].atom1.i);
bsB.set(this.bo[i].atom2.i);
}
}return  Clazz_newIntArray(-1, [matchHbond ? this.autoHbond(bsA, bsB, false) : this.autoBondBs4(bsA, bsB, null, bsBonds, this.vwr.getMadBond(), connectOperation == 603979872, state), 0]);
}idOrModifyOnly = autoAromatize = true;
break;
case 1086324745:
identifyOnly = idOrModifyOnly = true;
break;
case 1073742025:
idOrModifyOnly = true;
break;
case 1073741904:
createOnly = true;
break;
}
var anyOrNoId = matchAny;
var notAnyAndNoId = (!identifyOnly && !matchAny);
this.defaultCovalentMad = this.vwr.getMadBond();
var minDIsFrac = (minD < 0);
var maxDIsFrac = (maxD < 0);
var isFractional = (minDIsFrac || maxDIsFrac);
var checkDistance = (!isBonds || minD != 0.1 || maxD != 1.0E8);
if (checkDistance) {
minD = this.fixD(minD, minDIsFrac);
maxD = this.fixD(maxD, maxDIsFrac);
}var mad = this.getDefaultMadFromOrder(order);
var nNew = 0;
var nModified = 0;
var bondAB = null;
var atomA = null;
var atomB = null;
var altloc = '\u0000';
var newOrder = (order | 131072);
var isAromaticOnly = (order != 65535 && (order & 512) != 0);
try {
for (var i = bsA.nextSetBit(0); i >= 0; i = bsA.nextSetBit(i + 1)) {
if (isBonds) {
bondAB = this.bo[i];
if (bondAB == null) continue;
atomA = bondAB.atom1;
atomB = bondAB.atom2;
} else {
atomA = this.at[i];
if (atomA.isDeleted()) continue;
altloc = (this.isModulated(i) ? '\0' : atomA.altloc);
}for (var j = (isBonds ? 0 : bsB.nextSetBit(0)); j >= 0; j = bsB.nextSetBit(j + 1)) {
if (isBonds) {
j = 2147483646;
} else {
if (j == i) continue;
atomB = this.at[j];
if (atomB == null || atomA.mi != atomB.mi || atomB.isDeleted()) continue;
if (altloc != '\0' && altloc != atomB.altloc && atomB.altloc != '\0') continue;
bondAB = atomA.getBond(atomB);
}if ((bondAB == null ? idOrModifyOnly : createOnly) || checkDistance && !this.isInRange(atomA, atomB, minD, maxD, minDIsFrac, maxDIsFrac, isFractional) || isAromaticOnly && (bondAB != null && !this.allowAromaticBond(bondAB))) continue;
if (bondAB == null) {
bsBonds.set(this.bondAtoms(atomA, atomB, order, mad, bsBonds, energy, addGroup, true).index);
nNew++;
} else {
if (notAnyAndNoId) {
if (isAtrop) {
var order0 = bondAB.order;
bondAB.setOrder(order);
if (bondAB.setAtropisomerOptions()) {
this.haveAtropicBonds = true;
nModified++;
} else {
bondAB.setOrder(order0);
}} else {
bondAB.setOrder(order);
}this.bsAromatic.clear(bondAB.index);
}if (anyOrNoId || order == bondAB.order || newOrder == bondAB.order || matchHbond && bondAB.isHydrogen()) {
bsBonds.set(bondAB.index);
nModified++;
}}}
}
} catch (e) {
if (Clazz_exceptionOf(e, Exception)){
} else {
throw e;
}
}
if (autoAromatize) this.assignAromaticBondsBs(true, bsBonds);
if (!identifyOnly) this.sm.setShapeSizeBs(1, -2147483648, null, bsBonds);
return  Clazz_newIntArray(-1, [nNew, nModified]);
}, "~N,~N,~N,~N,JU.BS,JU.BS,JU.BS,~B,~B,~N,JU.SB");
Clazz_defineMethod(c$, "autoBondBs4", 
function(bsA, bsB, bsExclude, bsBonds, mad, preJmol11_9_24, state){
if (preJmol11_9_24) return this.autoBond_Pre_11_9_24(bsA, bsB, bsExclude, bsBonds, mad);
if (this.ac == 0) return 0;
if (mad == 0) mad = 1;
if (this.maxBondingRadius == 1.4E-45) this.findMaxRadii();
var bondTolerance = this.vwr.getFloat(570425348);
var minBondDistance = this.vwr.getFloat(570425364);
var minBondDistance2 = minBondDistance * minBondDistance;
var nNew = 0;
if (this.showRebondTimes) JU.Logger.startTimer("autobond");
var lastModelIndex = -1;
var isAll = (bsA == null);
var bsCheck;
var i0;
if (isAll) {
i0 = 0;
bsCheck = null;
} else {
if (bsA.equals(bsB)) {
bsCheck = bsA;
} else {
bsCheck = JU.BSUtil.copy(bsA);
bsCheck.or(bsB);
}i0 = bsCheck.nextSetBit(0);
}var iter = this.getSelectedAtomIterator(null, false, false, true, false);
var useOccupation = false;
for (var i = i0; i >= 0 && i < this.ac; i = (isAll ? i + 1 : bsCheck.nextSetBit(i + 1))) {
var isAtomInSetA = (isAll || bsA.get(i));
var isAtomInSetB = (isAll || bsB.get(i));
var atom = this.at[i];
if (JM.AtomCollection.isDeleted(atom)) continue;
var modelIndex = atom.mi;
if (modelIndex != lastModelIndex) {
lastModelIndex = modelIndex;
if (this.isJmolDataFrame(modelIndex)) {
i = this.am[modelIndex].firstAtomIndex + this.am[modelIndex].act - 1;
continue;
}useOccupation = this.getInfoB(modelIndex, "autoBondUsingOccupation");
}var myBondingRadius = atom.getBondingRadius();
if (myBondingRadius == 0) continue;
var myFormalCharge = atom.getFormalCharge();
var useCharge = (myFormalCharge != 0);
if (useCharge) myFormalCharge = Math.signum(myFormalCharge);
var isFirstExcluded = (bsExclude != null && bsExclude.get(i));
var searchRadius = myBondingRadius + this.maxBondingRadius + bondTolerance;
this.setIteratorForAtom(iter, -1, i, searchRadius, null);
while (iter.hasNext()) {
var atomNear = this.at[iter.next()];
if (atomNear.isDeleted()) continue;
var j = atomNear.i;
var isNearInSetA = (isAll || bsA.get(j));
var isNearInSetB = (isAll || bsB.get(j));
if (!isNearInSetA && !isNearInSetB || !(isAtomInSetA && isNearInSetB || isAtomInSetB && isNearInSetA) || isFirstExcluded && bsExclude.get(j) || useOccupation && this.occupancies != null && (this.occupancies[i] < 50) != (this.occupancies[j] < 50) || useCharge && (Math.signum(atomNear.getFormalCharge()) == myFormalCharge)) continue;
var order = (this.isBondable(myBondingRadius, atomNear.getBondingRadius(), iter.foundDistance2(), minBondDistance2, bondTolerance) ? 1 : 0);
if (order > 0 && this.autoBondCheck(atom, atomNear, order, mad, bsBonds)) {
nNew++;
if (state != null) state.append("connect ({" + i + "}) ({" + j + "});");
}}
iter.release();
}
if (this.showRebondTimes) JU.Logger.checkTimer("autoBond", false);
return nNew;
}, "JU.BS,JU.BS,JU.BS,JU.BS,~N,~B,JU.SB");
Clazz_defineMethod(c$, "isBondable", 
function(bondingRadiusA, bondingRadiusB, distance2, minBondDistance2, bondTolerance){
if (bondingRadiusA == 0 || bondingRadiusB == 0 || distance2 < minBondDistance2) return false;
var maxAcceptable = bondingRadiusA + bondingRadiusB + bondTolerance;
var maxAcceptable2 = maxAcceptable * maxAcceptable;
return (distance2 <= maxAcceptable2);
}, "~N,~N,~N,~N,~N");
Clazz_defineMethod(c$, "autoBondCheck", 
function(atomA, atomB, order, mad, bsBonds){
if (atomA.getCurrentBondCount() > 20 || atomB.getCurrentBondCount() > 20) {
if (!this.maxBondWarned) JU.Logger.warn("maximum auto bond count reached");
this.maxBondWarned = true;
return false;
}var formalChargeA = atomA.getFormalCharge();
if (formalChargeA != 0) {
var formalChargeB = atomB.getFormalCharge();
if ((formalChargeA < 0 && formalChargeB < 0) || (formalChargeA > 0 && formalChargeB > 0)) return false;
}if (atomA.altloc != atomB.altloc && atomA.altloc != '\0' && atomB.altloc != '\0' && this.getModulation(atomA.i) == null) return false;
this.getOrAddBond(atomA, atomB, order, mad, bsBonds, 0, false);
return true;
}, "JM.Atom,JM.Atom,~N,~N,JU.BS");
Clazz_defineMethod(c$, "autoBond_Pre_11_9_24", 
function(bsA, bsB, bsExclude, bsBonds, mad){
if (this.ac == 0) return 0;
if (mad == 0) mad = 1;
if (this.maxBondingRadius == 1.4E-45) this.findMaxRadii();
var bondTolerance = this.vwr.getFloat(570425348);
var minBondDistance = this.vwr.getFloat(570425364);
var minBondDistance2 = minBondDistance * minBondDistance;
var nNew = 0;
this.initializeBspf();
var lastModelIndex = -1;
for (var i = this.ac; --i >= 0; ) {
var atom = this.at[i];
if (JM.AtomCollection.isDeleted(atom)) continue;
var isAtomInSetA = (bsA == null || bsA.get(i));
var isAtomInSetB = (bsB == null || bsB.get(i));
if (!isAtomInSetA && !isAtomInSetB) continue;
if (atom.isDeleted()) continue;
var modelIndex = atom.mi;
if (modelIndex != lastModelIndex) {
lastModelIndex = modelIndex;
if (this.isJmolDataFrame(modelIndex)) {
for (; --i >= 0; ) if (JM.AtomCollection.isDeleted(this.at[i]) || this.at[i].mi != modelIndex) break;

i++;
continue;
}}var myBondingRadius = atom.getBondingRadius();
if (myBondingRadius == 0) continue;
var searchRadius = myBondingRadius + this.maxBondingRadius + bondTolerance;
this.initializeBspt(modelIndex);
var iter = this.bspf.getCubeIterator(modelIndex);
iter.initialize(atom, searchRadius, true);
while (iter.hasMoreElements()) {
var atomNear = iter.nextElement();
if (atomNear === atom || atomNear.isDeleted()) continue;
var atomIndexNear = atomNear.i;
var isNearInSetA = (bsA == null || bsA.get(atomIndexNear));
var isNearInSetB = (bsB == null || bsB.get(atomIndexNear));
if (!isNearInSetA && !isNearInSetB || bsExclude != null && bsExclude.get(atomIndexNear) && bsExclude.get(i)) continue;
if (!(isAtomInSetA && isNearInSetB || isAtomInSetB && isNearInSetA)) continue;
var order = (this.isBondable(myBondingRadius, atomNear.getBondingRadius(), iter.foundDistance2(), minBondDistance2, bondTolerance) ? 1 : 0);
if (order > 0) {
if (this.autoBondCheck(atom, atomNear, order, mad, bsBonds)) nNew++;
}}
iter.release();
}
return nNew;
}, "JU.BS,JU.BS,JU.BS,JU.BS,~N");
Clazz_defineMethod(c$, "autoHbond", 
function(bsA, bsB, onlyIfHaveCalculated){
if (onlyIfHaveCalculated) {
var bsModels = this.getModelBS(bsA, false);
for (var i = bsModels.nextSetBit(0); i >= 0 && onlyIfHaveCalculated; i = bsModels.nextSetBit(i + 1)) onlyIfHaveCalculated = !this.am[i].hasRasmolHBonds;

if (onlyIfHaveCalculated) return 0;
}var haveHAtoms = false;
for (var i = bsA.nextSetBit(0); i >= 0; i = bsA.nextSetBit(i + 1)) if (this.at[i].getElementNumber() == 1) {
haveHAtoms = true;
break;
}
var bsHBonds =  new JU.BS();
var useRasMol = this.vwr.getBoolean(603979853);
if (bsB == null || useRasMol && !haveHAtoms) {
JU.Logger.info((bsB == null ? "DSSP/DSSR " : "RasMol") + " pseudo-hbond calculation");
this.calcRasmolHydrogenBonds(bsA, bsB, null, false, 2147483647, false, bsHBonds);
return -bsHBonds.cardinality();
}JU.Logger.info(haveHAtoms ? "Standard Hbond calculation" : "Jmol pseudo-hbond calculation");
var bsCO = null;
if (!haveHAtoms) {
bsCO =  new JU.BS();
for (var i = bsA.nextSetBit(0); i >= 0; i = bsA.nextSetBit(i + 1)) {
var atomID = this.at[i].atomID;
switch (atomID) {
case 64:
case 4:
case 14:
case 15:
case 16:
case 17:
bsCO.set(i);
break;
}
}
}var dmax;
var min2;
if (haveHAtoms) {
dmax = this.vwr.getFloat(570425361);
min2 = 1;
} else {
dmax = this.vwr.getFloat(570425360);
min2 = JM.ModelSet.hbondMinRasmol * JM.ModelSet.hbondMinRasmol;
}var max2 = dmax * dmax;
var minAttachedAngle = (this.vwr.getFloat(570425359) * 3.141592653589793 / 180);
var nNew = 0;
var d2 = 0;
if (this.showRebondTimes && JU.Logger.debugging) JU.Logger.startTimer("hbond");
var C = null;
var D = null;
var iter = this.getSelectedAtomIterator(bsB, false, false, false, false);
for (var i = bsA.nextSetBit(0); i >= 0; i = bsA.nextSetBit(i + 1)) {
var atom = this.at[i];
var elementNumber = atom.getElementNumber();
var isH = (elementNumber == 1);
if (isH ? !haveHAtoms : haveHAtoms || elementNumber != 7 && elementNumber != 8) continue;
var firstIsCO;
if (isH) {
firstIsCO = false;
var b = atom.bonds;
if (b == null) continue;
var isOK = false;
for (var j = 0; !isOK && j < b.length; j++) {
var a2 = b[j].getOtherAtom(atom);
var element = a2.getElementNumber();
isOK = (element == 7 || element == 8);
}
if (!isOK) continue;
} else {
firstIsCO = bsCO.get(i);
}this.setIteratorForAtom(iter, -1, atom.i, dmax, null);
while (iter.hasNext()) {
var atomNear = this.at[iter.next()];
var elementNumberNear = atomNear.getElementNumber();
if (atomNear === atom || (isH ? elementNumberNear == 1 : elementNumberNear != 7 && elementNumberNear != 8) || (d2 = iter.foundDistance2()) < min2 || d2 > max2 || firstIsCO && bsCO.get(atomNear.i) || atom.isBonded(atomNear)) {
continue;
}this.v1.sub2(atom, atomNear);
if ((D = JM.ModelSet.checkMinAttachedAngle(atom, minAttachedAngle, this.v1, this.v2, haveHAtoms)) == null) continue;
this.v1.scale(-1);
if ((C = JM.ModelSet.checkMinAttachedAngle(atomNear, minAttachedAngle, this.v1, this.v2, haveHAtoms)) == null) continue;
var energy = 0;
var bo;
if (isH && !Float.isNaN(C.x) && !Float.isNaN(D.x)) {
bo = 4096;
energy = JM.HBond.calcEnergy(Math.sqrt(d2), C.distance(atom), C.distance(D), atomNear.distance(D)) / 1000;
} else {
bo = 2048;
}bsHBonds.set(this.addHBond(atom, atomNear, bo, energy));
nNew++;
}
}
iter.release();
this.sm.setShapeSizeBs(1, -2147483648, null, bsHBonds);
if (this.showRebondTimes) JU.Logger.checkTimer("hbond", false);
return (haveHAtoms ? nNew : -nNew);
}, "JU.BS,JU.BS,~B");
c$.checkMinAttachedAngle = Clazz_defineMethod(c$, "checkMinAttachedAngle", 
function(atom1, minAngle, v1, v2, haveHAtoms){
var bonds = atom1.bonds;
var ignore = true;
var X = null;
if (bonds != null && bonds.length > 0) {
var dMin = 3.4028235E38;
for (var i = bonds.length; --i >= 0; ) if (bonds[i].isCovalent()) {
ignore = false;
var atomA = bonds[i].getOtherAtom(atom1);
if (!haveHAtoms && atomA.getElementNumber() == 1) continue;
v2.sub2(atom1, atomA);
var d = v2.angle(v1);
if (d < minAngle) return null;
if (d < dMin) {
X = atomA;
dMin = d;
}}
}return (ignore ? JU.P3.new3(NaN, 0, 0) : X);
}, "JM.Atom,~N,JU.V3,JU.V3,~B");
Clazz_defineMethod(c$, "setStructureIndexes", 
function(){
var id;
var idnew = 0;
var lastid = -1;
var imodel = -1;
var lastmodel = -1;
for (var i = 0; i < this.ac; i++) {
if (JM.AtomCollection.isDeleted(this.at[i])) continue;
if ((imodel = this.at[i].mi) != lastmodel) {
idnew = 0;
lastmodel = imodel;
lastid = -1;
}if ((id = this.at[i].group.getStrucNo()) != lastid && id != 0) {
this.at[i].group.setStrucNo(++idnew);
lastid = idnew;
}}
});
Clazz_defineMethod(c$, "getModelInfoAsString", 
function(){
var sb =  new JU.SB().append("<models count=\"");
sb.appendI(this.mc).append("\" modelSetHasVibrationVectors=\"").append(this.modelSetHasVibrationVectors() + "\">\n<properties>");
if (this.modelSetProperties != null) {
var e = this.modelSetProperties.propertyNames();
while (e.hasMoreElements()) {
var propertyName = e.nextElement();
sb.append("\n <property name=\"").append(propertyName).append("\" value=").append(JU.PT.esc(this.modelSetProperties.getProperty(propertyName))).append(" />");
}
sb.append("\n</properties>");
}for (var i = 0; i < this.mc; ++i) {
sb.append("\n<model index=\"").appendI(i).append("\" n=\"").append(this.getModelNumberDotted(i)).append("\" id=").append(JU.PT.esc("" + this.getInfo(i, "modelID")));
var ib = this.vwr.getJDXBaseModelIndex(i);
if (ib != i) sb.append(" baseModelId=").append(JU.PT.esc(this.getInfo(ib, "jdxModelID")));
sb.append(" name=").append(JU.PT.esc(this.getModelName(i))).append(" title=").append(JU.PT.esc(this.getModelTitle(i))).append(" hasVibrationVectors=\"").appendB(this.vwr.modelHasVibrationVectors(i)).append("\" />");
}
sb.append("\n</models>");
return sb.toString();
});
Clazz_defineMethod(c$, "getSymmetryInfoAsString", 
function(){
var sb =  new JU.SB().append("Symmetry Information:");
for (var i = 0; i < this.mc; ++i) {
sb.append("\nmodel #").append(this.getModelNumberDotted(i)).append("; name=").append(this.getModelName(i)).append("\n");
var unitCell = this.getUnitCell(i);
sb.append(unitCell == null ? "no symmetry information" : unitCell.getSymmetryInfoStr());
}
return sb.toString();
});
Clazz_defineMethod(c$, "createModels", 
function(n){
var newModelCount = this.mc + n;
var newModels = JU.AU.arrayCopyObject(this.am, newModelCount);
this.validateBspf(false);
this.modelNumbers = JU.AU.arrayCopyI(this.modelNumbers, newModelCount);
this.modelFileNumbers = JU.AU.arrayCopyI(this.modelFileNumbers, newModelCount);
this.modelNumbersForAtomLabel = JU.AU.arrayCopyS(this.modelNumbersForAtomLabel, newModelCount);
this.modelNames = JU.AU.arrayCopyS(this.modelNames, newModelCount);
this.frameTitles = JU.AU.arrayCopyS(this.frameTitles, newModelCount);
var f = Clazz_doubleToInt(this.modelFileNumbers[this.mc - 1] / 1000000) + 1;
for (var i = this.mc, pt = 0; i < newModelCount; i++) {
this.modelNumbers[i] = i + this.mc;
this.modelFileNumbers[i] = f * 1000000 + (++pt);
this.modelNumbersForAtomLabel[i] = this.modelNames[i] = f + "." + pt;
}
this.thisStateModel = -1;
var group3Lists = this.getInfoM("group3Lists");
if (group3Lists != null) {
var group3Counts = this.getInfoM("group3Counts");
group3Lists = JU.AU.arrayCopyS(group3Lists, newModelCount);
group3Counts = JU.AU.arrayCopyII(group3Counts, newModelCount);
this.msInfo.put("group3Lists", group3Lists);
this.msInfo.put("group3Counts", group3Counts);
}this.unitCells = (this.unitCells == null ?  new Array(newModelCount) : JU.AU.arrayCopyObject(this.unitCells, newModelCount));
for (var i = this.mc; i < newModelCount; i++) {
newModels[i] =  new JM.Model().set(this, i, -1, null, null, null);
newModels[i].loadState = " model create #" + i + ";";
}
this.am = newModels;
this.mc = newModelCount;
this.vwr.setAnimationRange(-1, -1);
}, "~N");
Clazz_defineMethod(c$, "deleteAtoms", 
function(bs){
if (bs == null) return;
var bsModels = this.getModelBS(bs, false);
var bsBonds =  new JU.BS();
var doNull = false;
for (var i = bs.nextSetBit(0); i >= 0 && i < this.ac; i = bs.nextSetBit(i + 1)) {
if (JM.AtomCollection.isDeleted(this.at[i])) continue;
this.at[i].$delete(bsBonds);
if (doNull) this.at[i] = null;
}
var bsAtoms = JU.BSUtil.copy(bs);
for (var i = 0; i < this.mc; i++) {
var m = this.am[i];
m.resetDSSR(false);
m.bsAtomsDeleted.or(bs);
m.bsAtomsDeleted.and(m.bsAtoms);
if (m.bsAsymmetricUnit != null) m.bsAsymmetricUnit.andNot(bs);
if (bsModels.get(m.modelIndex)) {
this.updateBasisFromSite(m.modelIndex);
}bs = JU.BSUtil.andNot(m.bsAtoms, m.bsAtomsDeleted);
m.firstAtomIndex = bs.nextSetBit(0);
m.act = bs.cardinality();
m.isOrderly = (m.act == m.bsAtoms.length() - m.firstAtomIndex);
}
this.dBb(bsBonds, false);
this.vwr.shm.notifyAtoms("atomsDeleted",  Clazz_newArray(-1, [bsAtoms, bsModels]));
this.validateBspf(false);
}, "JU.BS");
Clazz_defineMethod(c$, "clearDB", 
function(atomIndex){
this.getModelAuxiliaryInfo(this.at[atomIndex].mi).remove("dbName");
}, "~N");
Clazz_defineMethod(c$, "adjustAtomArrays", 
function(map, i0, ac){
this.ac = ac;
for (var i = i0; i < ac; i++) {
this.at[i] = this.at[map[i]];
this.at[i].i = i;
var m = this.am[this.at[i].mi];
if (m.firstAtomIndex == map[i]) m.firstAtomIndex = i;
m.bsAtoms.set(i);
}
if (this.vibrations != null) for (var i = i0; i < ac; i++) this.vibrations[i] = this.vibrations[map[i]];

if (this.atomTensorList != null) {
for (var i = i0; i < ac; i++) {
var list = this.atomTensorList[i] = this.atomTensorList[map[i]];
if (list != null) for (var j = list.length; --j >= 0; ) {
var t = list[j];
if (t != null) {
t.atomIndex1 = i;
}}
}
}if (this.atomNames != null) for (var i = i0; i < ac; i++) this.atomNames[i] = this.atomNames[map[i]];

if (this.atomTypes != null) for (var i = i0; i < ac; i++) this.atomTypes[i] = this.atomTypes[map[i]];

if (this.atomResnos != null) for (var i = i0; i < ac; i++) this.atomResnos[i] = this.atomResnos[map[i]];

if (this.atomSerials != null) for (var i = i0; i < ac; i++) this.atomSerials[i] = this.atomSerials[map[i]];

if (this.atomSeqIDs != null) for (var i = i0; i < ac; i++) this.atomSeqIDs[i] = this.atomSeqIDs[map[i]];

if (this.bfactor100s != null) for (var i = i0; i < ac; i++) this.bfactor100s[i] = this.bfactor100s[map[i]];

if (this.occupancies != null) for (var i = i0; i < ac; i++) this.occupancies[i] = this.occupancies[map[i]];

if (this.partialCharges != null) for (var i = i0; i < ac; i++) this.partialCharges[i] = this.partialCharges[map[i]];

}, "~A,~N,~N");
Clazz_defineMethod(c$, "growAtomArrays", 
function(newLength){
this.at = JU.AU.arrayCopyObject(this.at, newLength);
if (this.vibrations != null) this.vibrations = JU.AU.arrayCopyObject(this.vibrations, newLength);
if (this.occupancies != null) this.occupancies = JU.AU.arrayCopyF(this.occupancies, newLength);
if (this.bfactor100s != null) this.bfactor100s = JU.AU.arrayCopyShort(this.bfactor100s, newLength);
if (this.partialCharges != null) this.partialCharges = JU.AU.arrayCopyF(this.partialCharges, newLength);
if (this.atomTensorList != null) this.atomTensorList = JU.AU.arrayCopyObject(this.atomTensorList, newLength);
if (this.atomNames != null) this.atomNames = JU.AU.arrayCopyS(this.atomNames, newLength);
if (this.atomTypes != null) this.atomTypes = JU.AU.arrayCopyS(this.atomTypes, newLength);
if (this.atomResnos != null) this.atomResnos = JU.AU.arrayCopyI(this.atomResnos, newLength);
if (this.atomSerials != null) this.atomSerials = JU.AU.arrayCopyI(this.atomSerials, newLength);
if (this.atomSeqIDs != null) this.atomSeqIDs = JU.AU.arrayCopyI(this.atomSeqIDs, newLength);
}, "~N");
Clazz_defineMethod(c$, "addAtom", 
function(modelIndex, group, atomicAndIsotopeNumber, atomName, atomType, atomSerial, atomSeqID, atomSite, xyz, radius, vib, formalCharge, partialCharge, occupancy, bfactor, tensors, isHetero, isNegDisorder, specialAtomID, atomSymmetry, bondRadius){
var atom =  new JM.Atom().setAtom(modelIndex, this.ac, xyz, radius, atomSymmetry, atomSite, atomicAndIsotopeNumber, formalCharge, isHetero, isNegDisorder);
this.am[modelIndex].act++;
this.am[modelIndex].bsAtoms.set(this.ac);
if (JU.Elements.isElement(atomicAndIsotopeNumber, 1)) this.am[modelIndex].hydrogenCount++;
if (this.ac >= this.at.length) this.growAtomArrays(this.ac + 100);
this.at[this.ac] = atom;
this.setBFactor(this.ac, bfactor, false);
this.setOccupancy(this.ac, occupancy, false);
this.setPartialCharge(this.ac, partialCharge, false);
if (tensors != null) this.setAtomTensors(this.ac, tensors);
atom.group = group;
atom.colixAtom = this.vwr.cm.getColixAtomPalette(atom, J.c.PAL.CPK.id);
if (isNegDisorder) atom.setTranslucent(true, 0.5);
if (atomName != null) {
if (atomType != null) {
if (this.atomTypes == null) this.atomTypes =  new Array(this.at.length);
this.atomTypes[this.ac] = atomType;
}atom.atomID = specialAtomID;
if (specialAtomID == 0) {
if (this.atomNames == null) this.atomNames =  new Array(this.at.length);
this.atomNames[this.ac] = atomName.intern();
}}if (atomSerial != -2147483648) {
if (this.atomSerials == null) this.atomSerials =  Clazz_newIntArray (this.at.length, 0);
this.atomSerials[this.ac] = atomSerial;
}if (atomSeqID != 0) {
if (this.atomSeqIDs == null) this.atomSeqIDs =  Clazz_newIntArray (this.at.length, 0);
this.atomSeqIDs[this.ac] = atomSeqID;
}if (vib != null) this.setVibrationVector(this.ac, vib);
if (!Float.isNaN(bondRadius)) this.setBondingRadius(this.ac, bondRadius);
this.ac++;
return atom;
}, "~N,JM.Group,~N,~S,~S,~N,~N,~N,JU.P3,~N,JU.V3,~N,~N,~N,~N,JU.Lst,~B,~B,~N,JU.BS,~N");
Clazz_defineMethod(c$, "getInlineData", 
function(modelIndex){
var data = null;
if (modelIndex >= 0) data = this.am[modelIndex].loadScript;
 else for (modelIndex = this.mc; --modelIndex >= 0; ) if ((data = this.am[modelIndex].loadScript).length() > 0) break;

var pt = data.lastIndexOf("data \"");
if (pt < 0) {
var s = JU.PT.getQuotedStringAt(data.toString(), 0);
return JS.ScriptCompiler.unescapeString(s, 0, s.length);
}pt = data.indexOf2("\"", pt + 7);
var pt2 = data.lastIndexOf("end \"");
if (pt2 < pt || pt < 0) return null;
return data.substring2(pt + 2, pt2);
}, "~N");
Clazz_defineMethod(c$, "isAtomPDB", 
function(i){
return i >= 0 && this.am[this.at[i].mi].isBioModel;
}, "~N");
Clazz_defineMethod(c$, "setAtomNamesAndNumbers", 
function(iFirst, baseAtomIndex, mergeSet, isModelKit){
var mi0 = -1;
if (isModelKit) {
while (iFirst < this.ac && JM.AtomCollection.isDeleted(this.at[iFirst])) iFirst++;

if (iFirst >= this.ac) return;
mi0 = this.at[iFirst].mi;
iFirst = this.am[mi0].firstAtomIndex;
}if (this.atomSerials == null) this.atomSerials =  Clazz_newIntArray (this.ac, 0);
if (this.atomNames == null) this.atomNames =  new Array(this.ac);
var isZeroBased = this.isXYZ && this.vwr.getBoolean(603979978);
var thisModelIndex = 2147483647;
var atomNo = 1;
for (var i = iFirst; i < this.ac; ++i) {
var atom = this.at[i];
if (JM.AtomCollection.isDeleted(atom)) continue;
if (atom.mi != thisModelIndex) {
if (isModelKit && thisModelIndex != 2147483647 && atom.mi != mi0) continue;
thisModelIndex = atom.mi;
atomNo = (isZeroBased ? 0 : 1);
}var ano = this.atomSerials[i];
if (i >= -baseAtomIndex) {
if (ano == 0 || isModelKit) this.atomSerials[i] = (i < baseAtomIndex ? mergeSet.atomSerials[i] : atomNo);
if (this.atomNames[i] == null || isModelKit) this.atomNames[i] = (atom.getElementSymbol() + this.atomSerials[i]).intern();
} else {
if (ano > atomNo) {
atomNo = ano;
}if (isModelKit) {
this.atomNames[i] = (atom.getElementSymbol() + ano).intern();
}}if (!this.am[thisModelIndex].isModelKit || atom.getElementNumber() > 0) atomNo++;
}
}, "~N,~N,JM.AtomCollection,~B");
Clazz_defineMethod(c$, "connect", 
function(connections){
this.resetMolecules();
var bsDelete =  new JU.BS();
for (var i = 0; i < connections.length; i++) {
var f = connections[i];
if (f == null || f.length < 2) continue;
var index1 = Clazz_floatToInt(f[0]);
var addGroup = (index1 < 0);
if (addGroup) index1 = -1 - index1;
var index2 = Clazz_floatToInt(f[1]);
if (index2 < 0 || index1 >= this.ac || index2 >= this.ac) continue;
var order = (f.length > 2 ? Clazz_floatToInt(f[2]) : 1);
if (order < 0) order &= 0xFFFF;
var mad = (f.length > 3 ? Clazz_floatToShort(1000 * connections[i][3]) : this.getDefaultMadFromOrder(order));
if (order == 0 || mad == 0 && order != 32768 && !JU.Edge.isOrderH(order)) {
var b = this.at[index1].getBond(this.at[index2]);
if (b != null) bsDelete.set(b.index);
continue;
}var energy = (f.length > 4 ? f[4] : 0);
this.bondAtoms(this.at[index1], this.at[index2], order, mad, null, energy, addGroup, true);
}
if (bsDelete.nextSetBit(0) >= 0) this.deleteBonds(bsDelete, false);
}, "~A");
Clazz_defineMethod(c$, "setFrameDelayMs", 
function(millis, bsModels){
for (var i = bsModels.nextSetBit(0); i >= 0; i = bsModels.nextSetBit(i + 1)) this.am[this.am[i].trajectoryBaseIndex].frameDelay = millis;

}, "~N,JU.BS");
Clazz_defineMethod(c$, "getFrameDelayMs", 
function(i){
return (i < this.am.length && i >= 0 ? this.am[this.am[i].trajectoryBaseIndex].frameDelay : 0);
}, "~N");
Clazz_defineMethod(c$, "getModelIndexFromId", 
function(id){
var haveFile = (id.indexOf("#") >= 0);
var isBaseModel = id.toLowerCase().endsWith(".basemodel");
if (isBaseModel) id = id.substring(0, id.length - 10);
var errCode = -1;
var fname = null;
for (var i = 0; i < this.mc; i++) {
var mid = this.getInfo(i, "modelID");
var mnum = (id.startsWith("~") ? "~" + this.getModelNumberDotted(i) : null);
if (mnum == null && mid == null && (mid = this.getModelTitle(i)) == null) continue;
if (haveFile) {
fname = this.getModelFileName(i);
if (fname.endsWith("#molfile")) {
mid = fname;
} else {
fname += "#";
mid = fname + mid;
}}if (id.equalsIgnoreCase(mid) || id.equalsIgnoreCase(mnum)) return (isBaseModel ? this.vwr.getJDXBaseModelIndex(i) : i);
if (fname != null && id.startsWith(fname)) errCode = -2;
}
return (fname == null && !haveFile ? -2 : errCode);
}, "~S");
Clazz_defineMethod(c$, "getModelSetAuxiliaryInfo", 
function(bsModels){
var info = this.msInfo;
if (info == null) info =  new java.util.Hashtable();
if (bsModels != null || !info.containsKey("models")) {
var minfo =  new JU.Lst();
for (var i = 0; i < this.mc; ++i) if (bsModels == null || bsModels.get(i)) {
var m = this.getModelAuxiliaryInfo(i);
m.put("modelIndex", Integer.$valueOf(i));
minfo.addLast(m);
}
info.put("models", minfo);
}return info;
}, "JU.BS");
Clazz_defineMethod(c$, "getDihedralMap", 
function(alist){
var list =  new JU.Lst();
var n = alist.length;
var ai = null;
var aj = null;
var ak = null;
var al = null;
for (var i = n - 1; --i >= 0; ) for (var j = n; --j > i; ) {
ai = this.at[alist[i]];
aj = this.at[alist[j]];
if (ai.isBonded(aj)) {
for (var k = n; --k >= 0; ) if (k != i && k != j && (ak = this.at[alist[k]]).isBonded(ai)) for (var l = n; --l >= 0; ) if (l != i && l != j && l != k && (al = this.at[alist[l]]).isBonded(aj)) {
var a =  Clazz_newIntArray (4, 0);
a[0] = ak.i;
a[1] = ai.i;
a[2] = aj.i;
a[3] = al.i;
list.addLast(a);
}

}}

n = list.size();
var ilist = JU.AU.newInt2(n);
for (var i = n; --i >= 0; ) ilist[n - i - 1] = list.get(i);

return ilist;
}, "~A");
Clazz_defineMethod(c$, "setModulation", 
function(bs, isOn, qtOffset, isQ){
if (this.bsModulated == null) {
if (isOn) this.bsModulated =  new JU.BS();
 else if (bs == null) return;
}if (bs == null) bs = this.getModelAtomBitSetIncludingDeleted(-1, false);
var scale = this.vwr.getFloat(1275072532);
var haveMods = false;
for (var i = bs.nextSetBit(0); i >= 0; i = bs.nextSetBit(i + 1)) {
var ms = this.getModulation(i);
if (ms == null) continue;
ms.setModTQ(this.at[i], isOn, qtOffset, isQ, scale);
if (this.bsModulated != null) this.bsModulated.setBitTo(i, isOn);
haveMods = true;
}
if (!haveMods) this.bsModulated = null;
}, "JU.BS,~B,JU.P3,~B");
Clazz_defineMethod(c$, "getBoundBoxOrientation", 
function(type, bsAtoms, points){
var dx = 0;
var dy = 0;
var dz = 0;
var q = null;
var qBest = null;
var j0 = bsAtoms.nextSetBit(0);
var vMin = 0;
if (j0 >= 0) {
if (this.vOrientations == null) {
var n = 0;
var p4 =  new JU.P4();
var av =  new Array(3375);
for (var i = -7; i <= 7; i++) for (var j = -7; j <= 7; j++) for (var k = 0; k <= 14; k++, n++) if ((av[n] = JU.V3.new3(i / 7, j / 7, k / 14)).length() > 1) --n;



this.vOrientations =  new Array(n);
for (var i = n; --i >= 0; ) {
p4.set4(av[i].x, av[i].y, av[i].z, 0);
this.vOrientations[i] = JU.Quat.newP4(p4);
}
for (var i = n; --i >= 0; ) {
var cos = Math.sqrt(1 - av[i].lengthSquared());
if (Float.isNaN(cos)) cos = 0;
p4.set4(av[i].x, av[i].y, av[i].z, cos);
this.vOrientations[i] = JU.Quat.newP4(p4);
}
}var pt =  new JU.P3();
vMin = 3.4028235E38;
var bBest = null;
var v;
var b =  new JU.BoxInfo();
b.setMargin(type == 1312817669 ? 0 : 0.1);
for (var i = this.vOrientations.length; --i >= 0; ) {
q = this.vOrientations[i];
b.reset();
if (points == null) {
for (var j = j0; j >= 0; j = bsAtoms.nextSetBit(j + 1)) {
var p = q.transform2(this.at[j], pt);
b.addBoundBoxPoint(p);
}
} else {
for (var j = points.length; --j >= 0; ) b.addBoundBoxPoint(q.transform2(points[j], pt));

}switch (type) {
default:
case 1312817669:
case 1073741864:
case 1814695966:
v = (b.bbCorner1.x - b.bbCorner0.x) * (b.bbCorner1.y - b.bbCorner0.y) * (b.bbCorner1.z - b.bbCorner0.z);
break;
case 1111492629:
v = b.bbCorner1.x - b.bbCorner0.x;
break;
case 1111492630:
v = b.bbCorner1.y - b.bbCorner0.y;
break;
case 1111492631:
v = b.bbCorner1.z - b.bbCorner0.z;
break;
}
if (v < vMin) {
qBest = q;
bBest = b;
b =  new JU.BoxInfo();
b.setMargin(0.1);
vMin = v;
}}
switch (type) {
default:
return qBest;
case 1814695966:
var pts = bBest.getBoundBoxVertices();
pts =  Clazz_newArray(-1, [pts[0], pts[4], pts[2], pts[1]]);
qBest = qBest.inv();
for (var i = 0; i < 4; i++) {
qBest.transform2(pts[i], pts[i]);
if (i > 0) pts[i].sub(pts[0]);
}
return pts;
case 1312817669:
case 1073741864:
q = JU.Quat.newQ(qBest);
dx = bBest.bbCorner1.x - bBest.bbCorner0.x;
dy = bBest.bbCorner1.y - bBest.bbCorner0.y;
dz = bBest.bbCorner1.z - bBest.bbCorner0.z;
if (dx < dy) {
pt.set(0, 0, 1);
q = JU.Quat.newVA(pt, 90).mulQ(q);
var f = dx;
dx = dy;
dy = f;
}if (dy < dz) {
if (dz > dx) {
pt.set(0, 1, 0);
q = JU.Quat.newVA(pt, 90).mulQ(q);
var f = dx;
dx = dz;
dz = f;
}pt.set(1, 0, 0);
q = JU.Quat.newVA(pt, 90).mulQ(q);
var f = dy;
dy = dz;
dz = f;
}break;
}
}return (type == 1312817669 ? vMin + "\t{" + dx + " " + dy + " " + dz + "}\t" + bsAtoms : type == 1814695966 ? null : q == null || q.getTheta() == 0 ?  new JU.Quat() : q);
}, "~N,JU.BS,~A");
Clazz_defineMethod(c$, "getUnitCellForAtom", 
function(index){
if (index < 0 || index > this.ac || this.at[index] == null) return null;
if (this.bsModulated != null) {
var ms = this.getModulation(index);
var uc = (ms == null ? null : ms.getSubSystemUnitCell());
if (uc != null) return uc;
}return this.getUnitCell(this.at[index].mi);
}, "~N");
Clazz_defineMethod(c$, "clearCache", 
function(){
for (var i = this.mc; --i >= 0; ) this.am[i].resetDSSR(false);

});
Clazz_defineMethod(c$, "getSymMatrices", 
function(modelIndex){
var n = this.getModelSymmetryCount(modelIndex);
if (n == 0) return null;
var ops =  new Array(n);
var unitcell = this.am[modelIndex].biosymmetry;
if (unitcell == null) unitcell = this.getUnitCell(modelIndex);
for (var i = n; --i >= 0; ) ops[i] = unitcell.getSpaceGroupOperation(i);

return ops;
}, "~N");
Clazz_defineMethod(c$, "getSymmetryInvariant", 
function(iatom){
var a = this.getBasisAtom(iatom, true);
if (a == null) return  Clazz_newIntArray (0, 0);
return this.getUnitCellForAtom(a.i).getInvariantSymops(a, null);
}, "~N");
Clazz_defineMethod(c$, "getBsBranches", 
function(dihedralList){
var n = Clazz_doubleToInt(dihedralList.length / 6);
var bsBranches =  new Array(n);
var map =  new java.util.Hashtable();
for (var i = 0, pt = 0; i < n; i++, pt += 6) {
var dv = dihedralList[pt + 5] - dihedralList[pt + 4];
if (Math.abs(dv) < 1) continue;
var i0 = Clazz_floatToInt(dihedralList[pt + 1]);
var i1 = Clazz_floatToInt(dihedralList[pt + 2]);
var s = "" + i0 + "_" + i1;
if (map.containsKey(s)) continue;
map.put(s, Boolean.TRUE);
var bs = this.vwr.getBranchBitSet(i1, i0, true);
var bonds = this.at[i0].bonds;
var a0 = this.at[i0];
for (var j = 0; j < bonds.length; j++) {
var b = bonds[j];
if (!b.isCovalent()) continue;
var i2 = b.getOtherAtom(a0).i;
if (i2 == i1) continue;
if (bs.get(i2)) {
bs = null;
break;
}}
bsBranches[i] = bs;
}
return bsBranches;
}, "~A");
Clazz_defineMethod(c$, "recalculatePositionDependentQuantities", 
function(bsAtoms, mat){
if ((this.vwr.shm.getShape(21) != null)) this.vwr.shm.getShapePropertyData(21, "move",  Clazz_newArray(-1, [bsAtoms, mat]));
if (this.haveStraightness) this.calculateStraightnessAll();
this.recalculateLeadMidpointsAndWingVectors(-1);
var bsModels = this.getModelBS(bsAtoms, false);
for (var i = bsModels.nextSetBit(0); i >= 0; i = bsModels.nextSetBit(i + 1)) {
this.sm.notifyAtomPositionsChanged(i, bsAtoms, mat);
if (mat != null) {
var m = this.am[i];
if (m.isContainedIn(bsAtoms)) {
if (m.mat4 == null) m.mat4 = JU.M4.newM4(null);
m.mat4.mul2(mat, m.mat4);
}}}
}, "JU.BS,JU.M4");
Clazz_defineMethod(c$, "moveAtoms", 
function(m4, mNew, rotation, translation, bs, center, isInternal, translationOnly){
if (m4 != null) {
for (var i = bs.nextSetBit(0); i >= 0; i = bs.nextSetBit(i + 1)) {
m4.rotTrans(this.at[i]);
this.taintAtom(i, 2);
}
this.mat4.setM4(m4);
translation = null;
} else if (translationOnly) {
if (!isInternal) {
this.matInv.setM3(rotation);
this.matInv.invert();
this.matInv.rotate(translation);
}} else {
if (mNew == null) {
this.matTemp.setM3(rotation);
} else {
this.ptTemp.set(0, 0, 0);
this.matInv.setM3(rotation);
this.matInv.invert();
this.matTemp.mul2(mNew, rotation);
this.matTemp.mul2(this.matInv, this.matTemp);
}if (isInternal) {
this.vTemp.setT(center);
this.mat4.setIdentity();
this.mat4.setTranslation(this.vTemp);
this.mat4t.setToM3(this.matTemp);
this.mat4.mul(this.mat4t);
this.mat4t.setIdentity();
this.vTemp.scale(-1);
this.mat4t.setTranslation(this.vTemp);
this.mat4.mul(this.mat4t);
} else {
this.mat4.setToM3(this.matTemp);
}for (var i = bs.nextSetBit(0); i >= 0; i = bs.nextSetBit(i + 1)) {
if (isInternal) {
this.mat4.rotTrans(this.at[i]);
} else {
this.ptTemp.add(this.at[i]);
this.mat4.rotTrans(this.at[i]);
this.ptTemp.sub(this.at[i]);
}this.taintAtom(i, 2);
}
if (!isInternal) {
this.ptTemp.scale(1 / bs.cardinality());
if (translation == null) translation =  new JU.V3();
translation.add(this.ptTemp);
}}if (translation != null) {
for (var i = bs.nextSetBit(0); i >= 0; i = bs.nextSetBit(i + 1)) {
this.at[i].add(translation);
this.taintAtom(i, 2);
}
if (!translationOnly) {
this.mat4t.setIdentity();
this.mat4t.setTranslation(translation);
this.mat4.mul2(this.mat4t, this.mat4);
}}this.recalculatePositionDependentQuantities(bs, this.mat4);
}, "JU.M4,JU.M3,JU.M3,JU.V3,JU.BS,JU.P3,~B,~B");
Clazz_defineMethod(c$, "setDihedrals", 
function(dihedralList, bsBranches, f){
var n = Clazz_doubleToInt(dihedralList.length / 6);
if (f > 1) f = 1;
for (var j = 0, pt = 0; j < n; j++, pt += 6) {
var bs = bsBranches[j];
if (bs == null || bs.isEmpty()) continue;
var a1 = this.at[Clazz_floatToInt(dihedralList[pt + 1])];
var v = JU.V3.newVsub(this.at[Clazz_floatToInt(dihedralList[pt + 2])], a1);
var angle = (dihedralList[pt + 5] - dihedralList[pt + 4]) * f;
var aa = JU.A4.newVA(v, (-angle / 57.29577951308232));
this.matTemp.setAA(aa);
this.ptTemp.setT(a1);
for (var i = bs.nextSetBit(0); i >= 0; i = bs.nextSetBit(i + 1)) {
this.at[i].sub(this.ptTemp);
this.matTemp.rotate(this.at[i]);
this.at[i].add(this.ptTemp);
this.taintAtom(i, 2);
}
}
}, "~A,~A,~N");
Clazz_defineMethod(c$, "setAtomCoordsRelative", 
function(offset, bs){
this.setAtomsCoordRelative(bs, offset.x, offset.y, offset.z);
this.mat4.setIdentity();
this.vTemp.setT(offset);
this.mat4.setTranslation(this.vTemp);
this.recalculatePositionDependentQuantities(bs, this.mat4);
}, "JU.T3,JU.BS");
Clazz_defineMethod(c$, "setAtomCoords", 
function(bs, tokType, xyzValues){
this.setAtomCoord2(bs, tokType, xyzValues);
switch (tokType) {
case 1111492626:
case 1111492627:
case 1111492628:
case 1145047055:
break;
default:
this.recalculatePositionDependentQuantities(bs, null);
}
}, "JU.BS,~N,~O");
Clazz_defineMethod(c$, "invertSelected", 
function(pt, plane, iAtom, bsAtoms){
this.resetChirality();
if (pt != null) {
for (var i = bsAtoms.nextSetBit(0); i >= 0; i = bsAtoms.nextSetBit(i + 1)) {
var x = (pt.x - this.at[i].x) * 2;
var y = (pt.y - this.at[i].y) * 2;
var z = (pt.z - this.at[i].z) * 2;
this.setAtomCoordRelative(i, x, y, z);
}
return;
}if (plane != null) {
var norm = JU.V3.new3(plane.x, plane.y, plane.z);
norm.normalize();
var d = Math.sqrt(plane.x * plane.x + plane.y * plane.y + plane.z * plane.z);
for (var i = bsAtoms.nextSetBit(0); i >= 0; i = bsAtoms.nextSetBit(i + 1)) {
var twoD = -JU.Measure.distanceToPlaneD(plane, d, this.at[i]) * 2;
var x = norm.x * twoD;
var y = norm.y * twoD;
var z = norm.z * twoD;
this.setAtomCoordRelative(i, x, y, z);
}
return;
}if (iAtom >= 0) {
var thisAtom = this.at[iAtom];
var bonds = thisAtom.bonds;
if (bonds == null) return;
var bsToMove =  new JU.BS();
var vNot =  new JU.Lst();
var bsModel = this.vwr.getModelUndeletedAtomsBitSet(thisAtom.mi);
for (var i = 0; i < bonds.length; i++) {
var a = bonds[i].getOtherAtom(thisAtom);
if (bsAtoms.get(a.i)) {
bsToMove.or(JU.JmolMolecule.getBranchBitSet(this.at, a.i, bsModel, null, iAtom, true, true));
} else {
vNot.addLast(a);
}}
if (vNot.size() == 0) return;
pt = JU.Measure.getCenterAndPoints(vNot)[0];
var v = JU.V3.newVsub(thisAtom, pt);
var q = JU.Quat.newVA(v, 180);
this.moveAtoms(null, null, q.getMatrix(), null, bsToMove, thisAtom, true, false);
}}, "JU.P3,JU.P4,~N,JU.BS");
Clazz_defineMethod(c$, "getCellWeights", 
function(bsAtoms){
var wts = null;
var i = bsAtoms.nextSetBit(0);
var iModel = -1;
var sym;
var a;
if (i >= 0 && (sym = this.getUnitCell(iModel = (a = this.at[i]).mi)) != null) {
sym = sym.getUnitCellMultiplied();
var bs = this.getModelAtomBitSetIncludingDeleted(iModel, true);
bs.and(bsAtoms);
wts =  Clazz_newFloatArray (bsAtoms.cardinality(), 0);
var pt =  new JU.P3();
for (var p = 0; i >= 0; i = bsAtoms.nextSetBit(i + 1)) {
a = this.at[i];
pt.setT(a);
sym.toFractional(pt, false);
sym.unitize(pt);
wts[p++] = sym.getCellWeight(pt);
}
}return wts;
}, "JU.BS");
Clazz_defineMethod(c$, "getAtomGroupQuaternions", 
function(bsAtoms, nMax, qtype){
var n = 0;
var v =  new JU.Lst();
bsAtoms = JU.BSUtil.copy(bsAtoms);
var bsDone =  new JU.BS();
for (var i = bsAtoms.nextSetBit(0); i >= 0 && n < nMax; i = bsAtoms.nextSetBit(i + 1)) {
var g = this.at[i].group;
g.setAtomBits(bsDone);
bsAtoms.andNot(bsDone);
var q = g.getQuaternion(qtype);
if (q == null) {
if (!this.am[this.at[i].mi].isBioModel) q = g.getQuaternionFrame(this.at);
if (q == null) continue;
}n++;
v.addLast(q);
}
return v.toArray( new Array(v.size()));
}, "JU.BS,~N,~S");
Clazz_defineMethod(c$, "getConformation", 
function(modelIndex, conformationIndex, doSet, bsSelected){
var bs =  new JU.BS();
for (var i = this.mc; --i >= 0; ) {
if (modelIndex >= 0 && i != modelIndex) continue;
var m = this.am[i];
var bsAtoms = this.vwr.getModelUndeletedAtomsBitSet(modelIndex);
if (bsSelected != null) bsAtoms.and(bsSelected);
if (bsAtoms.nextSetBit(0) < 0) continue;
if (conformationIndex > m.altLocCount) {
if (conformationIndex == 1) bs.or(bsAtoms);
continue;
}var c0;
if (this.am[i].isBioModel) {
if (conformationIndex < -1000) {
c0 = 1000 + conformationIndex;
var altLocs = this.getAltLocListInModel(i);
if (c0 != -32 && altLocs.indexOf(String.fromCharCode(-c0)) < 0) c0 = -2147483648;
} else if (conformationIndex < 0) {
var altLocs = this.getAltLocListInModel(i);
c0 = -1 - conformationIndex;
c0 = (c0 >= altLocs.length ? -2147483648 : -(altLocs.charAt(c0)).charCodeAt(0));
} else {
c0 = conformationIndex;
}if (c0 == -2147483648) continue;
(this.am[i]).getConformation(c0, doSet, bsAtoms, bs);
} else {
var nAltLocs = this.getAltLocCountInModel(i);
var altLocs = this.getAltLocListInModel(i);
var bsTemp =  new JU.BS();
if (conformationIndex < -1000) {
var c = String.fromCharCode(-1000 - conformationIndex);
c0 = altLocs.indexOf(c);
} else if (conformationIndex < 0) {
c0 = -conformationIndex;
var parts = this.vwr.getDataObj("property_part", bsAtoms, 1);
if (parts == null) {
c0 -= 1;
} else {
for (var p = 0, ia = bsAtoms.nextSetBit(0); ia >= 0; ia = bsAtoms.nextSetBit(ia + 1)) {
var part = parts[p++];
if (part != 0 && part != c0 && part != -c0) bsAtoms.clear(ia);
}
bs.or(bsAtoms);
c0 = -1;
}} else {
c0 = conformationIndex - 1;
}if (c0 < 0 || c0 >= nAltLocs) {
continue;
}for (var c = nAltLocs; --c >= 0; ) if (c != c0) bsAtoms.andNot(this.getAtomBitsMDa(1073742355, altLocs.substring(c, c + 1), bsTemp));

}bs.or(bsAtoms);
}
return bs;
}, "~N,~N,~B,JU.BS");
Clazz_defineMethod(c$, "getSequenceBits", 
function(specInfo, bsAtoms, bsResult){
return (this.haveBioModels ? this.bioModelset.getAllSequenceBits(specInfo, bsAtoms, bsResult) : bsResult);
}, "~S,JU.BS,JU.BS");
Clazz_defineMethod(c$, "getBioPolymerCountInModel", 
function(modelIndex){
return (this.haveBioModels ? this.bioModelset.getBioPolymerCountInModel(modelIndex) : 0);
}, "~N");
Clazz_defineMethod(c$, "getPolymerPointsAndVectors", 
function(bs, vList, isTraceAlpha, sheetSmoothing){
if (this.haveBioModels) this.bioModelset.getAllPolymerPointsAndVectors(bs, vList, isTraceAlpha, sheetSmoothing);
}, "JU.BS,JU.Lst,~B,~N");
Clazz_defineMethod(c$, "recalculateLeadMidpointsAndWingVectors", 
function(modelIndex){
if (this.haveBioModels) this.bioModelset.recalculatePoints(modelIndex);
}, "~N");
Clazz_defineMethod(c$, "calcRasmolHydrogenBonds", 
function(bsA, bsB, vHBonds, nucleicOnly, nMax, dsspIgnoreHydrogens, bsHBonds){
if (this.haveBioModels) this.bioModelset.calcAllRasmolHydrogenBonds(bsA, bsB, vHBonds, nucleicOnly, nMax, dsspIgnoreHydrogens, bsHBonds, 2);
}, "JU.BS,JU.BS,JU.Lst,~B,~N,~B,JU.BS");
Clazz_defineMethod(c$, "calculateStraightnessAll", 
function(){
if (this.haveBioModels && !this.haveStraightness) this.bioModelset.calculateStraightnessAll();
});
Clazz_defineMethod(c$, "calculateStruts", 
function(bs1, bs2){
return (this.haveBioModels ? this.bioModelset.calculateStruts(bs1, bs2) : 0);
}, "JU.BS,JU.BS");
Clazz_defineMethod(c$, "getGroupsWithin", 
function(nResidues, bs){
return (this.haveBioModels ? this.bioModelset.getGroupsWithinAll(nResidues, bs) :  new JU.BS());
}, "~N,JU.BS");
Clazz_defineMethod(c$, "getProteinStructureState", 
function(bsAtoms, mode){
return (this.haveBioModels ? this.bioModelset.getFullProteinStructureState(bsAtoms, mode) : "");
}, "JU.BS,~N");
Clazz_defineMethod(c$, "calculateStructures", 
function(bsAtoms, asDSSP, doReport, dsspIgnoreHydrogen, setStructure, version){
return (this.haveBioModels ? this.bioModelset.calculateAllStuctures(bsAtoms, asDSSP, doReport, dsspIgnoreHydrogen, setStructure, version) : "");
}, "JU.BS,~B,~B,~B,~B,~N");
Clazz_defineMethod(c$, "calculateStructuresAllExcept", 
function(alreadyDefined, asDSSP, doReport, dsspIgnoreHydrogen, setStructure, includeAlpha, version){
this.freezeModels();
return (this.haveBioModels ? this.bioModelset.calculateAllStructuresExcept(alreadyDefined, asDSSP, doReport, dsspIgnoreHydrogen, setStructure, includeAlpha, version) : "");
}, "JU.BS,~B,~B,~B,~B,~B,~N");
Clazz_defineMethod(c$, "recalculatePolymers", 
function(bsModelsExcluded){
this.bioModelset.recalculateAllPolymers(bsModelsExcluded, this.getGroups());
}, "JU.BS");
Clazz_defineMethod(c$, "calculatePolymers", 
function(groups, groupCount, baseGroupIndex, modelsExcluded){
if (this.bioModelset != null) this.bioModelset.calculateAllPolymers(groups, groupCount, baseGroupIndex, modelsExcluded);
}, "~A,~N,~N,JU.BS");
Clazz_defineMethod(c$, "calcSelectedMonomersCount", 
function(){
if (this.haveBioModels) this.bioModelset.calcSelectedMonomersCount();
});
Clazz_defineMethod(c$, "setProteinType", 
function(bs, type){
if (this.haveBioModels) this.bioModelset.setAllProteinType(bs, type);
}, "JU.BS,J.c.STR");
Clazz_defineMethod(c$, "setStructureList", 
function(structureList){
if (this.haveBioModels) this.bioModelset.setAllStructureList(structureList);
}, "java.util.Map");
Clazz_defineMethod(c$, "setConformation", 
function(bsAtoms){
if (this.haveBioModels) this.bioModelset.setAllConformation(bsAtoms);
return JU.BSUtil.copy(bsAtoms);
}, "JU.BS");
Clazz_defineMethod(c$, "getHeteroList", 
function(modelIndex){
var o = (this.haveBioModels ? this.bioModelset.getAllHeteroList(modelIndex) : null);
return (o == null ? this.getInfoM("hetNames") : o);
}, "~N");
Clazz_defineMethod(c$, "getUnitCellPointsWithin", 
function(distance, bs, pt, asMap){
var lst =  new JU.Lst();
var map = null;
var lstI = null;
if (asMap) {
map =  new java.util.Hashtable();
lstI =  new JU.Lst();
map.put("atoms", lstI);
map.put("points", lst);
}var iAtom = (bs == null ? -1 : bs.nextSetBit(0));
bs = this.vwr.getModelUndeletedAtomsBitSet(iAtom < 0 ? this.vwr.am.cmi : this.at[iAtom].mi);
if (iAtom < 0) iAtom = bs.nextSetBit(0);
if (iAtom >= 0) {
var unitCell = this.getUnitCellForAtom(iAtom);
if (unitCell != null) {
var iter = unitCell.getIterator(this.vwr, this.at[iAtom], bs, distance);
if (pt != null) iter.setCenter(pt, distance);
while (iter.hasNext()) {
iAtom = iter.next();
pt = iter.getPosition();
lst.addLast(pt);
if (asMap) {
lstI.addLast(Integer.$valueOf(iAtom));
}}
}}return (asMap ? map : lst);
}, "~N,JU.BS,JU.P3,~B");
Clazz_defineMethod(c$, "calculateDssrProperty", 
function(dataType){
if (this.bioModelset == null || !this.bioModelset.haveDSSR) return;
this.bioModelset.getDSSRProperties(dataType);
}, "~S");
Clazz_defineMethod(c$, "getAtomCIPChiralityCode", 
function(atom){
this.haveChirality = true;
var m = this.am[atom.mi];
if (!m.hasChirality) {
this.calculateChiralityForAtoms(m.bsAtoms, false);
m.hasChirality = true;
}return atom.getCIPChiralityCode();
}, "JM.Atom");
Clazz_defineMethod(c$, "calculateChiralityForAtoms", 
function(bsAtoms, withReturn){
this.haveChirality = true;
for (var i = bsAtoms.nextSetBit(0); i >= 0; i = bsAtoms.nextSetBit(i + 1)) this.at[i].setCIPChirality(0);

J.api.Interface.getSymmetry(this.vwr, "ms").calculateCIPChiralityForAtoms(this.vwr, bsAtoms);
if (!withReturn) return null;
var s = "";
for (var i = bsAtoms.nextSetBit(0); i >= 0; i = bsAtoms.nextSetBit(i + 1)) s += this.at[i].getCIPChirality(false);

return s;
}, "JU.BS,~B");
Clazz_defineMethod(c$, "getPointTransf", 
function(i, a, q, pTemp){
if (this.isTrajectory(i >= 0 ? i : a.mi)) this.trajectory.getFractional(a, pTemp);
 else pTemp.setT(a);
if (q != null) q.transform2(pTemp, pTemp);
}, "~N,JM.Atom,JU.Quat,JU.P3");
Clazz_defineMethod(c$, "getSymmetryEquivAtoms", 
function(bsAtoms, sym, bsModelAtoms){
bsAtoms = JU.BS.copy(bsAtoms);
var bsEquiv = JU.BS.copy(bsAtoms);
var iAtom = bsAtoms.nextSetBit(0);
if (sym == null) sym = this.getUnitCellForAtom(iAtom);
if (sym != null) {
if (bsModelAtoms == null) bsModelAtoms = this.vwr.getModelUndeletedAtomsBitSet(this.at[iAtom].mi);
var bsRemaining = JU.BSUtil.copy(bsModelAtoms);
for (var i = bsAtoms.nextSetBit(0); i >= 0; i = bsAtoms.nextSetBit(i + 1)) {
this.getSymmetryEquivAtomsForAtom(i, bsAtoms, bsRemaining, bsEquiv);
}
}return bsEquiv;
}, "JU.BS,J.api.SymmetryInterface,JU.BS");
Clazz_defineMethod(c$, "getSymmetryEquivAtomsForAtom", 
function(i, bsAtoms, bsCheck, bsEquiv){
var a = this.at[i];
var site = a.getAtomSite();
if (site > 0) {
for (var j = bsCheck.nextSetBit(0); j >= 0; j = bsCheck.nextSetBit(j + 1)) {
if (this.at[j].getAtomSite() == site) {
bsEquiv.set(j);
if (bsAtoms != null) {
bsAtoms.clear(j);
bsCheck.clear(j);
}}}
} else {
}}, "~N,JU.BS,JU.BS,JU.BS");
Clazz_defineMethod(c$, "setSpaceGroup", 
function(mi, sg, basis){
if (this.unitCells == null) this.unitCells =  new Array(this.mc);
this.unitCells[mi] = sg;
this.haveUnitCells = true;
var isP1 = (sg.getSpaceGroupOperationCount() == 1);
var nops = sg.getFinalOperationCount();
if (basis != null) {
var needBasis = basis.isEmpty();
var bs = this.vwr.getModelUndeletedAtomsBitSet(mi);
if (needBasis) {
basis = JU.BSUtil.copy(bs);
} else {
this.setAsymmetricUnit(mi, bs, basis, !isP1);
}if (nops > 1) this.setModelCage(mi, null, false);
var nid = (this.atomSeqIDs == null ? 0 : this.atomSeqIDs.length);
if (nid > 0) {
for (var i = bs.nextSetBit(0); i >= 0; i = bs.nextSetBit(i + 1)) {
this.atomSeqIDs[i] = 0;
}
}if (isP1) {
this.fixP1AtomSites(sg, bs);
} else {
var haveOccupancies = (this.occupancies != null);
var ops = sg.getSymmetryOperations();
var a =  new JU.P3();
var b =  new JU.P3();
var t =  new JU.P3();
var site = 0;
for (var j = basis.nextSetBit(0); j >= 0; j = basis.nextSetBit(j + 1)) {
var bb = this.at[j];
b.setT(bb);
sg.toFractional(b, false);
sg.unitize(b);
if (needBasis) this.setSite(bb, ++site, true);
site = bb.atomSite;
bs.clear(j);
var occj = (haveOccupancies ? this.occupancies[j] : 0);
out : for (var i = bs.nextSetBit(needBasis ? j + 1 : 0); i >= 0; i = bs.nextSetBit(i + 1)) {
var ba = this.at[i];
var type = ba.atomNumberFlags;
if (ba.atomNumberFlags != type || haveOccupancies && occj != this.occupancies[i]) continue;
a.setT(ba);
sg.toFractional(a, false);
sg.unitize(a);
for (var k = 0; k < nops; k++) {
t.setT(b);
ops[k].rotTrans(t);
sg.unitize(t);
if (t.distanceSquared(a) < 1.96E-6) {
this.setSite(ba, site, true);
bs.clear(i);
basis.clear(i);
continue out;
}}
}
}
if (!bs.isEmpty()) {
System.err.println("Model basis atoms not found for " + bs);
}if (needBasis) {
this.setAsymmetricUnit(mi, null, basis, !isP1);
}}}this.setInfo(mi, "unitCellParams", sg.getUnitCellParams());
this.setInfo(mi, "spaceGroupAssigned", Boolean.TRUE);
this.setInfo(mi, "spaceGroupInfo", null);
this.setInfo(mi, "symmetryOperations", sg.getSymopList(false));
this.setInfo(mi, "spaceGroup", sg.getSpaceGroupName());
if (this.am[mi].simpleCage != null) {
sg.getUnitCell(this.am[mi].simpleCage.getUnitCellVectors(), false, null);
this.setInfo(mi, "unitCellParams", sg.getUnitCellParams());
}this.setModelCage(mi, null, false);
}, "~N,J.api.SymmetryInterface,JU.BS");
Clazz_defineMethod(c$, "setAsymmetricUnit", 
function(mi, bsModelAtoms, basis, haveSymmetry){
if (bsModelAtoms == null) bsModelAtoms = this.vwr.getModelUndeletedAtomsBitSet(mi);
this.am[mi].bsAsymmetricUnit = basis;
if (this.bsSymmetry == null) this.bsSymmetry = JU.BS.newN(this.ac);
this.bsSymmetry.or(bsModelAtoms);
this.bsSymmetry.andNot(basis);
if (haveSymmetry) {
for (var p = 0, i = bsModelAtoms.nextSetBit(0); i >= 0; i = bsModelAtoms.nextSetBit(i + 1)) {
var isBasis = basis.get(i);
this.at[i].setSymop(isBasis ? 1 : 0, false);
if (isBasis) this.setSite(this.at[i], ++p, false);
}
bsModelAtoms.andNot(basis);
}}, "~N,JU.BS,JU.BS,~B");
Clazz_defineMethod(c$, "setModelCage", 
function(modelIndex, simpleCage, andSetInfo){
if (modelIndex >= 0 && modelIndex < this.mc) {
this.am[modelIndex].simpleCage = simpleCage;
if (simpleCage != null && andSetInfo) this.setInfo(modelIndex, "unitCellParams", simpleCage.getUnitCellParams());
this.haveUnitCells = true;
}return simpleCage;
}, "~N,J.api.SymmetryInterface,~B");
Clazz_defineMethod(c$, "fixP1AtomSites", 
function(sym, bsAtoms){
if (sym == null || sym.getSpaceGroupOperationCount() != 1) return;
var n = bsAtoms.cardinality();
var baseAtoms =  new Array(n);
var nbase = 0;
var slop2 = sym.getPrecision();
slop2 *= slop2;
for (var i = bsAtoms.nextSetBit(0); i >= 0; i = bsAtoms.nextSetBit(i + 1)) {
var a = this.at[i];
var p =  new JU.A4();
p.setT(a);
sym.toFractional(p, false);
sym.unitize(p);
var found = false;
for (var ib = 0; ib < nbase; ib++) {
var b = baseAtoms[ib];
if (a.atomNumberFlags == b.angle && b.distanceSquared(p) < slop2) {
found = true;
this.setSite(a, ib + 1, true);
break;
}}
if (!found) {
p.angle = a.atomNumberFlags;
baseAtoms[nbase] = p;
this.setSite(a, ++nbase, true);
}}
}, "J.api.SymmetryInterface,JU.BS");
Clazz_defineMethod(c$, "getBasisAtom", 
function(iatom, doCheck){
var a = this.at[iatom];
if (!doCheck || this.getUnitCellForAtom(iatom) != null) {
var site = a.atomSite;
if (site > 0) {
var au = this.am[a.mi].bsAsymmetricUnit;
if (au != null) {
for (var i = au.nextSetBit(0); i >= 0; i = au.nextSetBit(i + 1)) {
if (this.at[i].atomSite == site) return this.at[i];
}
}}}return a;
}, "~N,~B");
Clazz_defineMethod(c$, "updateBasisFromSite", 
function(imodel){
if (this.getUnitCell(imodel) == null) return;
var bsAU = this.am[imodel].bsAsymmetricUnit;
if (bsAU == null) return;
bsAU.clearAll();
var bsSites =  new JU.BS();
var bs = this.am[imodel].bsAtoms;
for (var i = bs.nextSetBit(0); i >= 0; i = bs.nextSetBit(i + 1)) {
if (JM.AtomCollection.isDeleted(this.at[i])) continue;
var site = this.at[i].atomSite;
if (!bsSites.get(site)) {
bsSites.set(site);
bsAU.set(i);
}}
var sites =  Clazz_newIntArray (bsSites.length(), 0);
for (var p = 0, i = bsSites.nextSetBit(0); i >= 0; i = bsSites.nextSetBit(i + 1)) {
sites[i] = ++p;
}
for (var i = bs.nextSetBit(0); i >= 0; i = bs.nextSetBit(i + 1)) {
if (JM.AtomCollection.isDeleted(this.at[i])) continue;
var site = this.at[i].atomSite;
this.setSite(this.at[i], -1, false);
this.setSite(this.at[i], sites[site], true);
}
if (this.bsSymmetry == null) this.bsSymmetry = JU.BS.newN(this.ac);
this.bsSymmetry.or(bs);
this.bsSymmetry.andNot(bsAU);
}, "~N");
Clazz_defineMethod(c$, "getConnectingAtoms", 
function(bsAtoms, bsFixed){
var bs =  new JU.BS();
var bsAttached =  new JU.BS();
for (var i = bsAtoms.nextSetBit(0); i >= 0; i = bsAtoms.nextSetBit(i + 1)) {
var a = this.at[i];
var bonds = a.bonds;
for (var k = 0, j = a.getBondCount(); --j >= 0; ) {
if (bonds[j].isCovalent() && !bsAtoms.get(k = bonds[j].getOtherAtom(a).i)) {
bs.set(i);
bsAttached.set(k);
}}
}
bsAtoms.or(bsAttached);
bsFixed.or(bsAttached);
return bs;
}, "JU.BS,JU.BS");
Clazz_defineMethod(c$, "saveAtomPositions", 
function(){
var pos =  new Array(this.at.length);
for (var i = pos.length; --i >= 0; ) {
var a = this.at[i];
if (!JM.AtomCollection.isDeleted(a)) pos[i] = JU.P3.newP(a);
}
return pos;
});
Clazz_defineMethod(c$, "restoreAtomPositions", 
function(apos0){
for (var i = apos0.length; --i >= 0; ) {
var a = this.at[i];
if (!JM.AtomCollection.isDeleted(a)) a.setT(apos0[i]);
}
}, "~A");
Clazz_defineMethod(c$, "clearUnitCell", 
function(modelIndex){
if (this.unitCells == null) return;
if (modelIndex < 0) {
for (var i = 0; i < this.mc; i++) this.clearUnitCell(i);

} else {
this.am[modelIndex].simpleCage = null;
if (modelIndex < this.unitCells.length) {
this.unitCells[modelIndex] = null;
var info = this.getModelAuxiliaryInfo(modelIndex);
var it = info.entrySet().iterator();
while (it.hasNext()) {
if (JV.JC.isSpaceGroupInfoKey(it.next().getKey())) it.remove();
}
if (this.mc > 1) return;
}}this.unitCells = null;
this.haveUnitCells = false;
}, "~N");
Clazz_defineMethod(c$, "fixDeletedBonds", 
function(bs){
var bsFixed =  new JU.BS();
if (this.bo == null) return bs;
for (var i = 0, i0 = 0; i < this.bondCount; i++) {
if (this.bo[i] != null) {
if (i0 >= 0) bsFixed.setBitTo(i, bs.get(i0));
i0++;
}}
return bsFixed;
}, "JU.BS");
Clazz_defineMethod(c$, "getEquivalentAtoms", 
function(iatom){
var bs = this.vwr.getModelUndeletedAtomsBitSet(this.at[iatom].mi);
bs.and(this.getAtomBitsMaybeDeleted(1094713369, JU.BSUtil.newAndSetBit(iatom)));
return bs;
}, "~N");
Clazz_defineMethod(c$, "morphAtoms", 
function(bsAtoms, points, ipt, f, ptemp){
for (var i = bsAtoms.nextSetBit(0); i >= 0; i = bsAtoms.nextSetBit(i + 1), ipt++) {
var a = this.vwr.ms.at[i];
ptemp.sub2(points[1][ipt], points[0][ipt]);
ptemp.scaleAdd2(f, ptemp, points[0][ipt]);
a.setT(ptemp);
this.taintAtom(i, 2);
}
}, "JU.BS,~A,~N,~N,JU.P3");
Clazz_defineMethod(c$, "getCurrentSpinAtoms", 
function(){
var bs = this.vwr.getVisibleFramesBitSet();
this.includeAllRelatedFrames(bs, true);
bs = this.vwr.getModelUndeletedAtomsBitSetBs(bs);
bs.and(this.getAtoms(1095241729, bs));
return bs;
});
Clazz_defineMethod(c$, "getSpin", 
function(atomIndex){
var a = this.at[atomIndex];
if (a == null) return 0;
var v = this.vibrations[atomIndex];
if (v == null || v.magMoment == 0) return 0;
var op = a.getSymOp() - 1;
if (op < 0) return 0;
var uc = this.getUnitCellForAtom(atomIndex);
return (uc == null ? 0 : uc.getSpinIndex(op) + 1);
}, "~N");
Clazz_defineMethod(c$, "refreshDataFramePointGroup", 
function(dataFrameIndex){
var sym = this.getUnitCell(-1 - dataFrameIndex);
if (sym != null) {
sym.updatePointGroup();
}}, "~N");
Clazz_defineMethod(c$, "getStructureAssignments", 
function(){
if (this.bioModelset != null && this.bioModelset.haveDSSR) this.bioModelset.getStructureDSSRAssignments();
});
Clazz_defineMethod(c$, "getAtomicDSSRDataFloat", 
function(key, i){
return (this.bioModelset != null && this.bioModelset.haveDSSR ? this.bioModelset.getAtomicDSSRDataFloat(key, i) : NaN);
}, "~S,~N");
Clazz_defineMethod(c$, "getDSSRProperties", 
function(prop){
return (this.bioModelset != null && this.bioModelset.haveDSSR ? this.bioModelset.getDSSRProperties(prop) : null);
}, "~S");
/*if3*/;(function(){
var c$ = Clazz_decorateAsClass(function(){
this.isValid = false;
this.dataPath = null;
this.key = null;
this.floatData = null;
this.stringData = null;
this.parts = null;
Clazz_instantialize(this, arguments);}, JM.ModelSet, "DataList", null);
Clazz_makeConstructor(c$, 
function(dataPath){
this.dataPath = dataPath;
this.parts = dataPath.$plit("\\.");
}, "~S");
Clazz_defineMethod(c$, "setFloats", 
function(nAtoms){
if (this.floatData != null && this.floatData.length >= nAtoms) return this.floatData;
this.stringData = null;
this.floatData =  Clazz_newFloatArray (nAtoms, 0);
for (var i = 0; i < nAtoms; i++) this.floatData[i] = NaN;

this.isValid = true;
return this.floatData;
}, "~N");
Clazz_defineMethod(c$, "setStringData", 
function(nAtoms){
if (this.stringData != null && this.stringData.length >= nAtoms) return this.stringData;
this.floatData = null;
this.stringData =  new Array(nAtoms);
this.isValid = true;
return this.stringData;
}, "~N");
Clazz_defineMethod(c$, "isFloat", 
function(){
return this.floatData != null;
});
Clazz_defineMethod(c$, "getData", 
function(){
return (this.isFloat() ? this.floatData : this.stringData);
});
/*eoif3*/})();
c$.hbondMinRasmol = 2.5;
});
;//5.0.1-v7 Thu Aug 27 08:44:56 CDT 2026
Clazz_declarePackage("JM");
Clazz_load(["JU.M3", "$.P3"], "JM.Orientation", ["JU.PT", "JU.Escape"], function(){
var c$ = Clazz_decorateAsClass(function(){
this.saveName = null;
this.rotationMatrix = null;
this.xTrans = 0;
this.yTrans = 0;
this.zoom = 0;
this.rotationRadius = 0;
this.center = null;
this.navCenter = null;
this.xNav = NaN;
this.yNav = NaN;
this.navDepth = NaN;
this.cameraDepth = NaN;
this.cameraX = NaN;
this.cameraY = NaN;
this.windowCenteredFlag = false;
this.navigationMode = false;
this.moveToText = null;
this.pymolView = null;
this.vwr = null;
Clazz_instantialize(this, arguments);}, JM, "Orientation", null);
Clazz_prepareFields (c$, function(){
this.rotationMatrix =  new JU.M3();
this.center =  new JU.P3();
this.navCenter =  new JU.P3();
});
Clazz_makeConstructor(c$, 
function(vwr, asDefault, pymolView){
this.vwr = vwr;
if (pymolView != null) {
this.pymolView = pymolView;
this.moveToText = "moveTo -1.0 PyMOL " + JU.Escape.eAF(pymolView);
return;
}vwr.finalizeTransformParameters();
if (asDefault) {
var rot = vwr.ms.getInfoM("defaultOrientationMatrix");
if (rot == null) this.rotationMatrix.setScale(1);
 else this.rotationMatrix.setM3(rot);
} else {
vwr.tm.getRotation(this.rotationMatrix);
}this.xTrans = vwr.tm.getTranslationXPercent();
this.yTrans = vwr.tm.getTranslationYPercent();
this.zoom = vwr.tm.getZoomSetting();
this.center.setT(vwr.tm.fixedRotationCenter);
this.windowCenteredFlag = vwr.tm.isWindowCentered();
this.rotationRadius = vwr.getFloat(570425388);
this.navigationMode = vwr.getBoolean(603979889);
this.moveToText = vwr.tm.getMoveToText(-1, false);
if (this.navigationMode) {
this.xNav = vwr.tm.getNavigationOffsetPercent('X');
this.yNav = vwr.tm.getNavigationOffsetPercent('Y');
this.navDepth = vwr.tm.navigationDepthPercent;
this.navCenter = JU.P3.newP(vwr.tm.navigationCenter);
}if (vwr.tm.camera.z != 0) {
this.cameraDepth = vwr.tm.getCameraDepth();
this.cameraX = vwr.tm.camera.x;
this.cameraY = vwr.tm.camera.y;
}}, "JV.Viewer,~B,~A");
Clazz_overrideMethod(c$, "toString", 
function(){
return "[Orientation " + this.saveName + " " + this.rotationRadius + "]";
});
Clazz_defineMethod(c$, "getMoveToText", 
function(asCommand){
return (asCommand ? "   " + this.moveToText + "\n  save orientation " + JU.PT.esc(this.saveName.substring(12)) + ";\n" : this.moveToText);
}, "~B");
Clazz_defineMethod(c$, "restore", 
function(timeSeconds, isAll){
if (isAll) {
this.vwr.setBooleanProperty("windowCentered", this.windowCenteredFlag);
this.vwr.setBooleanProperty("navigationMode", this.navigationMode);
if (this.pymolView == null) this.vwr.moveTo(null, timeSeconds, this.center, null, NaN, this.rotationMatrix, this.zoom, this.xTrans, this.yTrans, this.rotationRadius, this.navCenter, this.xNav, this.yNav, this.navDepth, this.cameraDepth, this.cameraX, this.cameraY);
 else this.vwr.tm.moveToPyMOL(this.vwr.eval, timeSeconds, this.pymolView);
} else {
this.vwr.tm.setRotation(this.rotationMatrix);
}return true;
}, "~N,~B");
});
;//5.0.1-v7 Mon Aug 24 10:01:38 CDT 2026
Clazz_declarePackage("JM");
Clazz_load(null, "JM.StateScript", ["JU.SB", "JU.BSUtil", "$.Escape"], function(){
var c$ = Clazz_decorateAsClass(function(){
this.modelIndex = 0;
this.bsBonds = null;
this.bsAtoms1 = null;
this.bsAtoms2 = null;
this.script1 = null;
this.script2 = null;
this.inDefinedStateBlock = false;
Clazz_instantialize(this, arguments);}, JM, "StateScript", null);
Clazz_makeConstructor(c$, 
function(modelIndex, script1, bsBonds, bsAtoms1, bsAtoms2, script2, inDefinedStateBlock){
this.modelIndex = modelIndex;
this.script1 = script1;
this.bsBonds = JU.BSUtil.copy(bsBonds);
this.bsAtoms1 = JU.BSUtil.copy(bsAtoms1);
this.bsAtoms2 = JU.BSUtil.copy(bsAtoms2);
this.script2 = script2;
this.inDefinedStateBlock = inDefinedStateBlock;
}, "~N,~S,JU.BS,JU.BS,JU.BS,~S,~B");
Clazz_defineMethod(c$, "isValid", 
function(){
return this.script1 != null && this.script1.length > 0 && (this.bsBonds == null || this.bsBonds.nextSetBit(0) >= 0) && (this.bsAtoms1 == null || this.bsAtoms1.nextSetBit(0) >= 0) && (this.bsAtoms2 == null || this.bsAtoms2.nextSetBit(0) >= 0);
});
Clazz_overrideMethod(c$, "toString", 
function(){
if (!this.isValid()) return "";
var sb = JU.SB.newS(this.script1);
if (this.bsBonds != null) sb.append(" ").append(JU.Escape.eBond(this.bsBonds));
if (this.bsAtoms1 != null) sb.append(" ").append(JU.Escape.eBS(this.bsAtoms1));
if (this.bsAtoms2 != null) sb.append(" ").append(JU.Escape.eBS(this.bsAtoms2));
if (this.script2 != null) sb.append(" ").append(this.script2);
var s = sb.toString();
if (!s.endsWith(";")) s += ";";
return s;
});
Clazz_defineMethod(c$, "isConnect", 
function(){
return (this.script1.indexOf("connect") >= 0);
});
Clazz_defineMethod(c$, "deleteAtoms", 
function(modelIndex, bsBonds, bsAtoms){
if (modelIndex == this.modelIndex) return false;
if (modelIndex > this.modelIndex) {
return true;
}JU.BSUtil.deleteBits(this.bsBonds, bsBonds);
JU.BSUtil.deleteBits(this.bsAtoms1, bsAtoms);
JU.BSUtil.deleteBits(this.bsAtoms2, bsAtoms);
return this.isValid();
}, "~N,JU.BS,JU.BS");
Clazz_defineMethod(c$, "setModelIndex", 
function(index){
this.modelIndex = index;
}, "~N");
});
;//5.0.1-v7 Mon Aug 17 10:07:10 MDT 2026
Clazz_declarePackage("JM");
Clazz_declareInterface(JM, "Structure");
;//5.0.1-v7 Mon Aug 17 10:07:10 MDT 2026
Clazz_declarePackage("JM");
(function(){
var c$ = Clazz_decorateAsClass(function(){
this.id = "";
this.type = ' ';
this.ticks = null;
this.tickLabelFormats = null;
this.scale = null;
this.first = 0;
this.signFactor = 1;
this.reference = null;
Clazz_instantialize(this, arguments);}, JM, "TickInfo", null);
Clazz_makeConstructor(c$, 
function(ticks){
this.ticks = ticks;
}, "JU.P3");
})();
;//5.0.1-v7 Mon Aug 17 10:07:10 MDT 2026
Clazz_declarePackage("JU");
Clazz_load(["JU.P3", "$.V3"], "JU.BoxInfo", ["java.util.Hashtable", "JU.Measure", "$.P4", "JU.Point3fi"], function(){
var c$ = Clazz_decorateAsClass(function(){
this.bbCorner0 = null;
this.bbCorner1 = null;
this.bbCenter = null;
this.bbVector = null;
this.bbVertices = null;
this.isScaleSet = false;
this.margin = 0;
Clazz_instantialize(this, arguments);}, JU, "BoxInfo", null);
Clazz_prepareFields (c$, function(){
this.bbCorner0 =  new JU.P3();
this.bbCorner1 =  new JU.P3();
this.bbCenter =  new JU.P3();
this.bbVector =  new JU.V3();
this.bbVertices =  new Array(8);
{
for (var i = 0; i < 8; i++) {
JU.BoxInfo.unitBboxPoints[i] = JU.P3.new3(-1, -1, -1);
JU.BoxInfo.unitBboxPoints[i].scaleAdd2(2, JU.BoxInfo.unitCubePoints[i], JU.BoxInfo.unitBboxPoints[i]);
}
}});
Clazz_makeConstructor(c$, 
function(){
for (var i = 8; --i >= 0; ) this.bbVertices[i] =  new JU.Point3fi();

this.reset();
});
Clazz_defineMethod(c$, "reset", 
function(){
this.isScaleSet = false;
this.bbCorner0.set(3.4028235E38, 3.4028235E38, 3.4028235E38);
this.bbCorner1.set(-3.4028235E38, -3.4028235E38, -3.4028235E38);
});
c$.scaleBox = Clazz_defineMethod(c$, "scaleBox", 
function(pts, scale){
if (scale == 0 || scale == 1) return;
var center =  new JU.P3();
var v =  new JU.V3();
for (var i = 0; i < 8; i++) center.add(pts[i]);

center.scale(0.125);
for (var i = 0; i < 8; i++) {
v.sub2(pts[i], center);
v.scale(scale);
pts[i].add2(center, v);
}
}, "~A,~N");
c$.getVerticesFromOABC = Clazz_defineMethod(c$, "getVerticesFromOABC", 
function(oabc){
var vertices =  new Array(8);
for (var i = 0; i <= 7; i++) {
vertices[i] = JU.P3.newP(oabc[0]);
if ((i & 4) == 4) vertices[i].add(oabc[1]);
if ((i & 2) == 2) vertices[i].add(oabc[2]);
if ((i & 1) == 1) vertices[i].add(oabc[3]);
}
return vertices;
}, "~A");
c$.getCanonicalCopy = Clazz_defineMethod(c$, "getCanonicalCopy", 
function(boxPoints, scale){
var pts =  new Array(8);
for (var i = 0; i < 8; i++) pts[JU.BoxInfo.toCanonical[i]] = JU.P3.newP(boxPoints[i]);

JU.BoxInfo.scaleBox(pts, scale);
return pts;
}, "~A,~N");
c$.toOABC = Clazz_defineMethod(c$, "toOABC", 
function(bbVertices, offset){
var center = JU.P3.newP(bbVertices[0]);
var a = JU.P3.newP(bbVertices[4]);
var b = JU.P3.newP(bbVertices[2]);
var c = JU.P3.newP(bbVertices[1]);
a.sub(center);
b.sub(center);
c.sub(center);
if (offset != null) center.add(offset);
return  Clazz_newArray(-1, [center, a, b, c]);
}, "~A,JU.T3");
Clazz_defineMethod(c$, "getBoundBoxCenter", 
function(){
if (!this.isScaleSet) this.setBbcage(1);
return this.bbCenter;
});
Clazz_defineMethod(c$, "getBoundBoxCornerVector", 
function(){
if (!this.isScaleSet) this.setBbcage(1);
return this.bbVector;
});
Clazz_defineMethod(c$, "getBoundBoxPoints", 
function(isAll){
if (!this.isScaleSet) this.setBbcage(1);
return (isAll ?  Clazz_newArray(-1, [this.bbCenter, JU.P3.newP(this.bbVector), this.bbCorner0, this.bbCorner1]) :  Clazz_newArray(-1, [this.bbCorner0, this.bbCorner1]));
}, "~B");
Clazz_defineMethod(c$, "getBoundBoxVertices", 
function(){
if (!this.isScaleSet) this.setBbcage(1);
return this.bbVertices;
});
Clazz_defineMethod(c$, "setBoundBoxFromOABC", 
function(points){
var origin = JU.P3.newP(points[0]);
var pt111 =  new JU.P3();
for (var i = 0; i < 4; i++) pt111.add(points[i]);

this.setBoundBox(origin, pt111, true, 1);
}, "~A");
Clazz_defineMethod(c$, "setBoundBox", 
function(pt1, pt2, byCorner, scale){
if (pt1 != null) {
if (scale == 0) return;
if (byCorner) {
if (pt1.distance(pt2) == 0) return;
this.bbCorner0.set(Math.min(pt1.x, pt2.x), Math.min(pt1.y, pt2.y), Math.min(pt1.z, pt2.z));
this.bbCorner1.set(Math.max(pt1.x, pt2.x), Math.max(pt1.y, pt2.y), Math.max(pt1.z, pt2.z));
} else {
if (pt2.x == 0 || pt2.y == 0 && pt2.z == 0) return;
this.bbCorner0.set(pt1.x - pt2.x, pt1.y - pt2.y, pt1.z - pt2.z);
this.bbCorner1.set(pt1.x + pt2.x, pt1.y + pt2.y, pt1.z + pt2.z);
}}this.setBbcage(scale);
}, "JU.T3,JU.T3,~B,~N");
Clazz_defineMethod(c$, "setMargin", 
function(m){
this.margin = m;
}, "~N");
Clazz_defineMethod(c$, "addBoundBoxPoint", 
function(pt){
this.isScaleSet = false;
JU.BoxInfo.addPoint(pt, this.bbCorner0, this.bbCorner1, this.margin);
}, "JU.T3");
c$.addPoint = Clazz_defineMethod(c$, "addPoint", 
function(pt, xyzMin, xyzMax, margin){
if (pt.x - margin < xyzMin.x) xyzMin.x = pt.x - margin;
if (pt.x + margin > xyzMax.x) xyzMax.x = pt.x + margin;
if (pt.y - margin < xyzMin.y) xyzMin.y = pt.y - margin;
if (pt.y + margin > xyzMax.y) xyzMax.y = pt.y + margin;
if (pt.z - margin < xyzMin.z) xyzMin.z = pt.z - margin;
if (pt.z + margin > xyzMax.z) xyzMax.z = pt.z + margin;
}, "JU.T3,JU.T3,JU.T3,~N");
c$.addPointXYZ = Clazz_defineMethod(c$, "addPointXYZ", 
function(x, y, z, xyzMin, xyzMax, margin){
if (x - margin < xyzMin.x) xyzMin.x = x - margin;
if (x + margin > xyzMax.x) xyzMax.x = x + margin;
if (y - margin < xyzMin.y) xyzMin.y = y - margin;
if (y + margin > xyzMax.y) xyzMax.y = y + margin;
if (z - margin < xyzMin.z) xyzMin.z = z - margin;
if (z + margin > xyzMax.z) xyzMax.z = z + margin;
}, "~N,~N,~N,JU.P3,JU.P3,~N");
Clazz_defineMethod(c$, "setBbcage", 
function(scale){
this.isScaleSet = true;
this.bbCenter.add2(this.bbCorner0, this.bbCorner1);
this.bbCenter.scale(0.5);
this.bbVector.sub2(this.bbCorner1, this.bbCenter);
if (scale > 0) {
this.bbVector.scale(scale);
} else {
this.bbVector.x -= scale / 2;
this.bbVector.y -= scale / 2;
this.bbVector.z -= scale / 2;
}for (var i = 8; --i >= 0; ) {
var pt = this.bbVertices[i];
pt.setT(JU.BoxInfo.unitBboxPoints[i]);
pt.x *= this.bbVector.x;
pt.y *= this.bbVector.y;
pt.z *= this.bbVector.z;
pt.add(this.bbCenter);
}
if (scale != 1) {
this.bbCorner0.setT(this.bbVertices[0]);
this.bbCorner1.setT(this.bbVertices[7]);
}}, "~N");
Clazz_defineMethod(c$, "isWithin", 
function(pt){
if (!this.isScaleSet) this.setBbcage(1);
return (pt.x >= this.bbCorner0.x && pt.x <= this.bbCorner1.x && pt.y >= this.bbCorner0.y && pt.y <= this.bbCorner1.y && pt.z >= this.bbCorner0.z && pt.z <= this.bbCorner1.z);
}, "JU.P3");
Clazz_defineMethod(c$, "getMaxDim", 
function(){
return this.bbVector.length() * 2;
});
Clazz_defineMethod(c$, "getInfo", 
function(what){
var vol = Double.$valueOf(Math.abs(8 * this.bbVector.x * this.bbVector.y * this.bbVector.z));
if ("volume".equals(what)) {
return vol;
}var c = JU.P3.newP(this.bbCenter);
if ("center".equals(what)) {
return c;
}if (what == null || "info".equals(what)) {
var m =  new java.util.Hashtable();
m.put("center", c);
var v = JU.V3.newVsub(this.bbCorner1, this.bbCorner0);
m.put("dimensions", v);
m.put("girth", Double.$valueOf(v.x + v.y + v.z));
m.put("area", Double.$valueOf(2 * (v.x * v.y + v.x * v.z + v.z * v.y)));
m.put("volume", vol);
return m;
}return null;
}, "~S");
Clazz_overrideMethod(c$, "toString", 
function(){
return "" + this.bbCorner0 + this.bbCorner1;
});
c$.getBoxFacesFromOABC = Clazz_defineMethod(c$, "getBoxFacesFromOABC", 
function(oabc){
var faces =  new Array(6);
var vNorm =  new JU.V3();
var vAB =  new JU.V3();
var pta =  new JU.P3();
var ptb =  new JU.P3();
var ptc =  new JU.P3();
var vertices = (oabc == null ? JU.BoxInfo.unitCubePoints : JU.BoxInfo.getVerticesFromOABC(oabc));
for (var i = 0; i < 6; i++) {
pta.setT(vertices[JU.BoxInfo.facePoints[i][0]]);
ptb.setT(vertices[JU.BoxInfo.facePoints[i][1]]);
ptc.setT(vertices[JU.BoxInfo.facePoints[i][2]]);
faces[i] = JU.Measure.getPlaneThroughPoints(pta, ptb, ptc, vNorm, vAB,  new JU.P4());
}
return faces;
}, "~A");
c$.bbcageTickEdges =  Clazz_newCharArray(-1, ['z', '\0', '\0', 'y', 'x', '\0', '\0', '\0', '\0', '\0', '\0', '\0']);
c$.uccageTickEdges =  Clazz_newCharArray(-1, ['z', 'y', 'x', '\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0']);
c$.edges =  Clazz_newByteArray(-1, [0, 1, 0, 2, 0, 4, 1, 3, 1, 5, 2, 3, 2, 6, 3, 7, 4, 5, 4, 6, 5, 7, 6, 7]);
c$.faceOrder =  Clazz_newIntArray(-1, [0, 3, 5, 2, 1, 4]);
c$.facePoints =  Clazz_newArray(-1, [ Clazz_newIntArray(-1, [4, 0, 6]),  Clazz_newIntArray(-1, [4, 6, 5]),  Clazz_newIntArray(-1, [5, 7, 1]),  Clazz_newIntArray(-1, [1, 3, 0]),  Clazz_newIntArray(-1, [6, 2, 7]),  Clazz_newIntArray(-1, [1, 0, 5]),  Clazz_newIntArray(-1, [0, 2, 6]),  Clazz_newIntArray(-1, [6, 7, 5]),  Clazz_newIntArray(-1, [7, 3, 1]),  Clazz_newIntArray(-1, [3, 2, 0]),  Clazz_newIntArray(-1, [2, 3, 7]),  Clazz_newIntArray(-1, [0, 4, 5])]);
c$.unitCubePoints =  Clazz_newArray(-1, [JU.P3.new3(0, 0, 0), JU.P3.new3(0, 0, 1), JU.P3.new3(0, 1, 0), JU.P3.new3(0, 1, 1), JU.P3.new3(1, 0, 0), JU.P3.new3(1, 0, 1), JU.P3.new3(1, 1, 0), JU.P3.new3(1, 1, 1)]);
c$.toCanonical =  Clazz_newIntArray(-1, [0, 3, 4, 7, 1, 2, 5, 6]);
c$.unitBboxPoints =  new Array(8);
});
;//5.0.1-v7 Mon Aug 17 10:07:10 MDT 2026
Clazz_declarePackage("JU");
Clazz_load(["JU.BS"], "JU.BSUtil", null, function(){
var c$ = Clazz_declareType(JU, "BSUtil", null);
c$.newAndSetBit = Clazz_defineMethod(c$, "newAndSetBit", 
function(i){
var bs = JU.BS.newN(i + 1);
bs.set(i);
return bs;
}, "~N");
c$.areEqual = Clazz_defineMethod(c$, "areEqual", 
function(a, b){
return (a == null || b == null ? a == null && b == null : a.equals(b));
}, "JU.BS,JU.BS");
c$.haveCommon = Clazz_defineMethod(c$, "haveCommon", 
function(a, b){
return (a == null || b == null ? false : a.intersects(b));
}, "JU.BS,JU.BS");
c$.cardinalityOf = Clazz_defineMethod(c$, "cardinalityOf", 
function(bs){
return (bs == null ? 0 : bs.cardinality());
}, "JU.BS");
c$.newBitSet2 = Clazz_defineMethod(c$, "newBitSet2", 
function(i0, i1){
var bs = JU.BS.newN(i1);
bs.setBits(i0, i1);
return bs;
}, "~N,~N");
c$.setAll = Clazz_defineMethod(c$, "setAll", 
function(n){
var bs = JU.BS.newN(n);
bs.setBits(0, n);
return bs;
}, "~N");
c$.andNot = Clazz_defineMethod(c$, "andNot", 
function(a, b){
if (b != null && a != null) a.andNot(b);
return a;
}, "JU.BS,JU.BS");
c$.copy = Clazz_defineMethod(c$, "copy", 
function(bs){
return bs == null ? null : bs.clone();
}, "JU.BS");
c$.copy2 = Clazz_defineMethod(c$, "copy2", 
function(a, b){
if (a == null || b == null) return null;
b.clearAll();
b.or(a);
return b;
}, "JU.BS,JU.BS");
c$.copyInvert = Clazz_defineMethod(c$, "copyInvert", 
function(bs, n){
return (bs == null ? null : JU.BSUtil.andNot(JU.BSUtil.setAll(n), bs));
}, "JU.BS,~N");
c$.invertInPlace = Clazz_defineMethod(c$, "invertInPlace", 
function(bs, n){
return JU.BSUtil.copy2(JU.BSUtil.copyInvert(bs, n), bs);
}, "JU.BS,~N");
c$.toggleInPlace = Clazz_defineMethod(c$, "toggleInPlace", 
function(a, b){
if (a.equals(b)) {
a.clearAll();
} else if (JU.BSUtil.andNot(JU.BSUtil.copy(b), a).length() == 0) {
JU.BSUtil.andNot(a, b);
} else {
a.or(b);
}return a;
}, "JU.BS,JU.BS");
c$.deleteBits = Clazz_defineMethod(c$, "deleteBits", 
function(bs, bsDelete){
if (bs == null || bsDelete == null) return bs;
var ipt = bsDelete.nextSetBit(0);
if (ipt < 0) return bs;
var len = bs.length();
var lend = Math.min(len, bsDelete.length());
var i;
for (i = bsDelete.nextClearBit(ipt); i < lend && i >= 0; i = bsDelete.nextClearBit(i + 1)) bs.setBitTo(ipt++, bs.get(i));

for (i = lend; i < len; i++) bs.setBitTo(ipt++, bs.get(i));

if (ipt < len) bs.clearBits(ipt, len);
return bs;
}, "JU.BS,JU.BS");
c$.shiftBits = Clazz_defineMethod(c$, "shiftBits", 
function(bs, bsAdded, setIfFound, iLast){
if (bs == null || bsAdded == null) return;
var n = bsAdded.length();
var bsNew = JU.BS.newN(n);
var isFound = false;
var doSet = false;
var checkFound = setIfFound;
for (var j = 0, i = 0; j < n && i < iLast; j++) {
if (bsAdded.get(j)) {
if (doSet) bsNew.set(j);
checkFound = setIfFound;
isFound = false;
} else if (bs.get(i++)) {
bsNew.set(j);
if (checkFound) {
checkFound = false;
isFound = true;
doSet = true;
}} else if (checkFound && !isFound) {
doSet = false;
}}
bs.clearAll();
bs.or(bsNew);
}, "JU.BS,JU.BS,~B,~N");
c$.offset = Clazz_defineMethod(c$, "offset", 
function(bs0, pos, offset){
if (bs0 == null) return;
var bsTemp = JU.BS.newN(bs0.length() + offset);
for (var i = bs0.nextSetBit(0); i >= pos; i = bs0.nextSetBit(i + 1)) bsTemp.set(i + offset);

JU.BSUtil.copy2(bsTemp, bs0);
}, "JU.BS,~N,~N");
c$.setMapBitSet = Clazz_defineMethod(c$, "setMapBitSet", 
function(ht, i1, i2, key){
var bs;
if (ht.containsKey(key)) bs = ht.get(key);
 else ht.put(key, bs =  new JU.BS());
bs.setBits(i1, i2 + 1);
}, "java.util.Map,~N,~N,~S");
c$.emptySet =  new JU.BS();
});
;//5.0.1-v7 Mon Aug 17 10:07:10 MDT 2026
Clazz_declarePackage("JU");
Clazz_load(["JU.Int2IntHash"], "JU.C", ["JU.AU", "$.CU", "$.PT", "$.SB", "J.c.PAL", "JU.Escape", "$.Logger"], function(){
var c$ = Clazz_declareType(JU, "C", null);
/*LV!1824 unnec constructor*/c$.getColix = Clazz_defineMethod(c$, "getColix", 
function(argb){
if (argb == 0) return 0;
var translucentFlag = 0;
argb |= 0xFF000000;
var c = JU.C.colixHash.get(argb);
return ((c > 0 ? c : JU.C.allocateColix(argb, false)) | translucentFlag);
}, "~N");
c$.allocateColix = Clazz_defineMethod(c$, "allocateColix", 
function(argb, forceLast){
var n;
if (forceLast) {
n = 2047;
} else {
if (argb == -74566) return 3;
for (var i = JU.C.colixMax; --i >= 4; ) if ((argb & 0xFFFFFF) == (JU.C.argbs[i] & 0xFFFFFF)) return i;

n = JU.C.colixMax;
}if (n >= JU.C.argbs.length) {
var newSize = (forceLast ? n + 1 : JU.C.colixMax * 2);
if (newSize > 2048) newSize = 2048;
JU.C.argbs = JU.AU.arrayCopyI(JU.C.argbs, newSize);
if (JU.C.argbsGreyscale != null) JU.C.argbsGreyscale = JU.AU.arrayCopyI(JU.C.argbsGreyscale, newSize);
}JU.C.argbs[n] = argb;
if (JU.C.argbsGreyscale != null) JU.C.argbsGreyscale[n] = JU.CU.toFFGGGfromRGB(argb);
JU.C.colixHash.put(argb, n);
return (n < 2047 ? JU.C.colixMax++ : JU.C.colixMax);
}, "~N,~B");
c$.setLastGrey = Clazz_defineMethod(c$, "setLastGrey", 
function(argb){
JU.C.calcArgbsGreyscale();
JU.C.argbsGreyscale[2047] = JU.CU.toFFGGGfromRGB(argb);
}, "~N");
c$.calcArgbsGreyscale = Clazz_defineMethod(c$, "calcArgbsGreyscale", 
function(){
if (JU.C.argbsGreyscale != null) return;
var a =  Clazz_newIntArray (JU.C.argbs.length, 0);
for (var i = JU.C.argbs.length; --i >= 4; ) a[i] = JU.CU.toFFGGGfromRGB(JU.C.argbs[i]);

JU.C.argbsGreyscale = a;
});
c$.getArgbGreyscale = Clazz_defineMethod(c$, "getArgbGreyscale", 
function(colix){
if (JU.C.argbsGreyscale == null) JU.C.calcArgbsGreyscale();
return JU.C.argbsGreyscale[colix & -30721];
}, "~N");
c$.getColixO = Clazz_defineMethod(c$, "getColixO", 
function(obj){
if (obj == null) return 0;
if (Clazz_instanceOf(obj,"J.c.PAL")) return ((obj) === J.c.PAL.NONE ? 0 : 2);
if (Clazz_instanceOf(obj, Integer)) return JU.C.getColix((obj).intValue());
if ((typeof(obj)=='string')) return JU.C.getColixS(obj);
if (Clazz_instanceOf(obj, Byte)) return ((obj).byteValue() == 0 ? 0 : 2);
if (JU.Logger.debugging) {
JU.Logger.debug("?? getColix(" + obj + ")");
}return 22;
}, "~O");
c$.getTranslucentFlag = Clazz_defineMethod(c$, "getTranslucentFlag", 
function(translucentLevel){
if (translucentLevel == 0) return 0;
if (translucentLevel < 0) return 30720;
if (Float.isNaN(translucentLevel) || translucentLevel >= 255 || translucentLevel == 1.0) return 16384;
var iLevel = Clazz_doubleToInt(Math.floor(translucentLevel < 1 ? translucentLevel * 256 : translucentLevel >= 15 ? translucentLevel : translucentLevel <= 9 ? (Clazz_doubleToInt(Math.floor(translucentLevel - 1))) << 5 : 256));
return (((iLevel >> 5) & 0xF) << 11);
}, "~N");
c$.isColixLastAvailable = Clazz_defineMethod(c$, "isColixLastAvailable", 
function(colix){
return (colix > 0 && (colix & 2047) == 2047);
}, "~N");
c$.getArgb = Clazz_defineMethod(c$, "getArgb", 
function(colix){
return JU.C.argbs[colix & -30721];
}, "~N");
c$.isColixColorInherited = Clazz_defineMethod(c$, "isColixColorInherited", 
function(colix){
switch (colix) {
case 0:
case 1:
return true;
default:
return (colix & -30721) == 1;
}
}, "~N");
c$.getColixInherited = Clazz_defineMethod(c$, "getColixInherited", 
function(myColix, parentColix){
switch (myColix) {
case 0:
return parentColix;
case 1:
return (parentColix & -30721);
default:
return ((myColix & -30721) == 1 ? (parentColix & -30721 | myColix & 30720) : myColix);
}
}, "~N,~N");
c$.renderPass2 = Clazz_defineMethod(c$, "renderPass2", 
function(colix){
var c = colix & 30720;
return (c != 0 && c != 30720);
}, "~N");
c$.isColixTranslucent = Clazz_defineMethod(c$, "isColixTranslucent", 
function(colix){
return ((colix & 30720) != 0);
}, "~N");
c$.getChangeableColixIndex = Clazz_defineMethod(c$, "getChangeableColixIndex", 
function(colix){
return (colix >= 0 ? -1 : (colix & 2047));
}, "~N");
c$.getColixTranslucent3 = Clazz_defineMethod(c$, "getColixTranslucent3", 
function(colix, isTranslucent, translucentLevel){
colix &= -30721;
if (colix == 0) colix = 1;
return (isTranslucent ? (colix | JU.C.getTranslucentFlag(translucentLevel)) : colix);
}, "~N,~B,~N");
c$.copyColixTranslucency = Clazz_defineMethod(c$, "copyColixTranslucency", 
function(colixFrom, colixTo){
return JU.C.getColixTranslucent3(colixTo, JU.C.isColixTranslucent(colixFrom), JU.C.getColixTranslucencyLevel(colixFrom));
}, "~N,~N");
c$.getColixTranslucencyFractional = Clazz_defineMethod(c$, "getColixTranslucencyFractional", 
function(colix){
var translevel = JU.C.getColixTranslucencyLevel(colix);
return (translevel == -1 ? 0.5 : translevel == 0 ? 0 : translevel == 255 ? 1 : translevel / 256);
}, "~N");
c$.getColixTranslucencyLabel = Clazz_defineMethod(c$, "getColixTranslucencyLabel", 
function(colix){
return "translucent " + ((colix & 30720) == 30720 ? -1 : JU.C.getColixTranslucencyFractional(colix));
}, "~N");
c$.getColixTranslucencyLevel = Clazz_defineMethod(c$, "getColixTranslucencyLevel", 
function(colix){
var logAlpha = (colix >> 11) & 0xF;
switch (logAlpha) {
case 0:
return 0;
case 1:
case 2:
case 3:
case 4:
case 5:
case 6:
case 7:
return logAlpha << 5;
case 15:
return -1;
default:
return 255;
}
}, "~N");
c$.isTransparent = Clazz_defineMethod(c$, "isTransparent", 
function(colix){
return (colix & 30720) == 16384;
}, "~N");
c$.getColixS = Clazz_defineMethod(c$, "getColixS", 
function(colorName){
var argb = JU.CU.getArgbFromString(colorName);
if (argb != 0) return JU.C.getColix(argb);
if ("none".equalsIgnoreCase(colorName)) return 0;
if ("opaque".equalsIgnoreCase(colorName)) return 1;
return 2;
}, "~S");
c$.getColixArray = Clazz_defineMethod(c$, "getColixArray", 
function(colorNames){
if (colorNames == null || colorNames.length == 0) return null;
var colors = JU.PT.getTokens(colorNames);
var colixes =  Clazz_newShortArray (colors.length, 0);
for (var j = 0; j < colors.length; j++) {
colixes[j] = JU.C.getColix(JU.CU.getArgbFromString(colors[j]));
if (colixes[j] == 0) return null;
}
return colixes;
}, "~S");
c$.getHexCode = Clazz_defineMethod(c$, "getHexCode", 
function(colix){
return JU.Escape.escapeColor(JU.C.getArgb(colix));
}, "~N");
c$.getHexCodes = Clazz_defineMethod(c$, "getHexCodes", 
function(colixes){
if (colixes == null) return null;
var s =  new JU.SB();
for (var i = 0; i < colixes.length; i++) s.append(i == 0 ? "" : " ").append(JU.C.getHexCode(colixes[i]));

return s.toString();
}, "~A");
c$.getColixTranslucent = Clazz_defineMethod(c$, "getColixTranslucent", 
function(argb){
var a = (argb >> 24) & 0xFF;
return (a == 0xFF ? JU.C.getColix(argb) : JU.C.getColixTranslucent3(JU.C.getColix(argb), true, a / 255));
}, "~N");
c$.getBgContrast = Clazz_defineMethod(c$, "getBgContrast", 
function(argb){
return ((JU.CU.toFFGGGfromRGB(argb) & 0xFF) < 128 ? 8 : 4);
}, "~N");
c$.getColixShadedRGB = Clazz_defineMethod(c$, "getColixShadedRGB", 
function(colix){
return JU.C.getShadedRGB(JU.C.getArgb(colix), JU.C.getColixTranslucencyFractional(colix));
}, "~N");
c$.getShadedRGB = Clazz_defineMethod(c$, "getShadedRGB", 
function(ic, translucentLevel){
return (translucentLevel == 0 ? ic : JU.C.getShade(ic, translucentLevel));
}, "~N,~N");
c$.getShade = Clazz_defineMethod(c$, "getShade", 
function(ic, translucentLevel){
var opacity = 1 - translucentLevel;
return JU.C.shade(ic, 16, opacity) | JU.C.shade(ic, 8, opacity) | JU.C.shade(ic, 0, opacity);
}, "~N,~N");
c$.shade = Clazz_defineMethod(c$, "shade", 
function(ic, off, opacity){
return Math.max(0, Math.min(Clazz_doubleToInt((((ic >> off) & 0xFF) - 0xFF) * opacity + 0xFF), 0xFF)) << off;
}, "~N,~N,~N");
c$.colixMax = 4;
c$.argbs =  Clazz_newIntArray (128, 0);
{
JU.C.argbs[3] = -74566;
}c$.argbsGreyscale = null;
c$.colixHash =  new JU.Int2IntHash(256);
{
var predefinedArgbs =  Clazz_newIntArray(-1, [0xFF000000, 0xFFFFA500, 0xFFFFC0CB, 0xFF0000FF, 0xFFFFFFFF, 0xFF00FFFF, 0xFFFF0000, 0xFF008000, 0xFF808080, 0xFFC0C0C0, 0xFF00FF00, 0xFF800000, 0xFF000080, 0xFF808000, 0xFF800080, 0xFF008080, 0xFFFF00FF, 0xFFFFFF00, 0xFFFF69B4, 0xFFFFD700]);
for (var i = 0; i < predefinedArgbs.length; ++i) JU.C.getColix(predefinedArgbs[i]);

}});
;//5.0.1-v7 Mon Aug 17 10:07:10 MDT 2026
Clazz_declarePackage("JU");
Clazz_load(null, "JU.ColorEncoder", ["java.util.Hashtable", "JU.AU", "$.CU", "$.Lst", "$.PT", "$.Rdr", "J.c.PAL", "JU.C", "$.Escape", "$.Logger", "JV.FileManager", "$.JC"], function(){
var c$ = Clazz_decorateAsClass(function(){
this.vwr = null;
this.paletteBW = null;
this.paletteWB = null;
this.paletteFriendly = null;
this.argbsCpk = null;
this.argbsRoygb = null;
this.argbsRwb = null;
this.argbsShapely = null;
this.argbsAmino = null;
this.argbsNucleic = null;
this.ihalf = 0;
this.schemes = null;
this.currentPalette = 0;
this.currentSegmentCount = 1;
this.isTranslucent = false;
this.lo = 0;
this.hi = 0;
this.isReversed = false;
this.userScale = null;
this.thisScale = null;
this.thisName = "scheme";
this.isColorIndex = false;
this.ce = null;
Clazz_instantialize(this, arguments);}, JU, "ColorEncoder", null);
Clazz_prepareFields (c$, function(){
this.userScale =  Clazz_newIntArray(-1, [-8355712]);
this.thisScale =  Clazz_newIntArray(-1, [-8355712]);
});
Clazz_makeConstructor(c$, 
function(ce, vwr){
if (ce == null) {
this.vwr = vwr;
this.schemes =  new java.util.Hashtable();
this.argbsCpk = J.c.PAL.argbsCpk;
this.argbsRoygb = JV.JC.argbsRoygbScale;
this.argbsRwb = JV.JC.argbsRwbScale;
this.argbsAmino = this.argbsNucleic = this.argbsShapely = null;
this.ihalf = Clazz_doubleToInt(JV.JC.argbsRoygbScale.length / 3);
this.ce = this;
} else {
this.ce = ce;
this.vwr = ce.vwr;
this.schemes = ce.schemes;
}}, "JU.ColorEncoder,JV.Viewer");
Clazz_defineMethod(c$, "clearCache", 
function(){
this.schemes.clear();
});
c$.getSchemeIndex = Clazz_defineMethod(c$, "getSchemeIndex", 
function(colorScheme){
for (var i = 0; i < JU.ColorEncoder.colorSchemes.length; i++) if (JU.ColorEncoder.colorSchemes[i].equalsIgnoreCase(colorScheme)) return (i >= 16 ? i - 16 : i < 13 ? i : -i);

return -1;
}, "~S");
c$.fixName = Clazz_defineMethod(c$, "fixName", 
function(name){
if (name.equalsIgnoreCase("byelement")) return "byelement_jmol";
var ipt = JU.ColorEncoder.getSchemeIndex(name);
return (ipt >= 0 ? JU.ColorEncoder.colorSchemes[ipt] : name.indexOf("/") >= 0 ? name : name.toLowerCase());
}, "~S");
Clazz_defineMethod(c$, "makeColorScheme", 
function(name, scale, isOverloaded){
name = JU.ColorEncoder.fixName(name);
if (scale == null) {
this.schemes.remove(name);
var iScheme = this.createColorScheme(name, false, isOverloaded);
if (isOverloaded) switch (iScheme) {
case 2147483647:
return 0;
case 12:
this.paletteFriendly = this.getPaletteAC();
break;
case 10:
this.paletteBW = this.getPaletteBW();
break;
case 11:
this.paletteWB = this.getPaletteWB();
break;
case 0:
case 1:
this.argbsRoygb = JV.JC.argbsRoygbScale;
break;
case 6:
case 7:
this.argbsRwb = JV.JC.argbsRwbScale;
break;
case 2:
this.argbsCpk = J.c.PAL.argbsCpk;
break;
case 3:
JU.ColorEncoder.getRasmolScale();
break;
case 17:
this.getNucleic();
break;
case 5:
this.getAmino();
break;
case 4:
this.getShapely();
break;
}
return iScheme;
}this.schemes.put(name, scale);
this.setThisScheme(name, scale);
var iScheme = this.createColorScheme(name, false, isOverloaded);
if (isOverloaded) switch (iScheme) {
case 10:
this.paletteBW = this.thisScale;
break;
case 11:
this.paletteWB = this.thisScale;
break;
case 0:
case 1:
this.argbsRoygb = this.thisScale;
this.ihalf = Clazz_doubleToInt(this.argbsRoygb.length / 3);
break;
case 6:
case 7:
this.argbsRwb = this.thisScale;
break;
case 2:
this.argbsCpk = this.thisScale;
break;
case 3:
break;
case 5:
this.argbsAmino = this.thisScale;
break;
case 17:
this.argbsNucleic = this.thisScale;
break;
case 4:
this.argbsShapely = this.thisScale;
break;
}
return -1;
}, "~S,~A,~B");
Clazz_defineMethod(c$, "getShapely", 
function(){
return (this.argbsShapely == null ? this.argbsShapely = this.vwr.getJBR().getArgbs(1073742144) : this.argbsShapely);
});
Clazz_defineMethod(c$, "getAmino", 
function(){
return (this.argbsAmino == null ? this.argbsAmino = this.vwr.getJBR().getArgbs(2097154) : this.argbsAmino);
});
Clazz_defineMethod(c$, "getNucleic", 
function(){
return (this.argbsNucleic == null ? this.argbsNucleic = this.vwr.getJBR().getArgbs(2097166) : this.argbsNucleic);
});
Clazz_defineMethod(c$, "createColorScheme", 
function(colorScheme, defaultToRoygb, isOverloaded){
if (colorScheme.equalsIgnoreCase("inherit")) return 15;
var pte = colorScheme.lastIndexOf("=");
var pts = colorScheme.indexOf("/");
var pt = Math.max(pte, colorScheme.indexOf("["));
var name = JU.ColorEncoder.fixName(colorScheme);
var ipt = JU.ColorEncoder.getSchemeIndex(name);
if (ipt == -1 && (pt < 0 || pts > 0)) {
var scale;
var s = colorScheme;
scale = this.schemes.get(name);
if (scale == null) {
try {
var isNot = (s.charAt(1) == '~');
if (isNot) s = s.substring(1);
var b = null;
while (true) {
if (s.indexOf("/") < 0) {
if (s.indexOf(".") < 0) s += ".lut.txt";
var data =  new Array(1);
try {
JU.Logger.info("ColorEncoder opening colorschemes/" + s);
JU.Rdr.readAllAsString(JV.FileManager.getBufferedReaderForResource(this.vwr, JU.C, "JU/", "colorschemes/" + s), -1, false, data, 0);
} catch (e) {
if (Clazz_exceptionOf(e,"java.io.IOException")){
JU.Logger.info("ColorEncoder " + e);
break;
} else {
throw e;
}
}
s = data[0];
} else {
s = JU.PT.rep(s, " ", "%20");
JU.Logger.info("ColorEncoder opening " + s);
var o = this.vwr.fm.getFileAsBytes(s, null);
if ((typeof(o)=='string')) {
JU.Logger.info("ColorEncoder " + o);
break;
}b = o;
JU.Logger.info("ColorEncoder read " + b.length + " bytes");
var i0 = 0;
var n = b.length;
if (n == 800 || n == 802) i0 = 32;
if (n - i0 == 768 || n - i0 == 770) {
scale =  Clazz_newIntArray (256, 0);
n = 256 + i0;
for (var i = 0; i < 256; i++) {
scale[i] = JU.CU.rgb(b[i + i0] & 0xFF, b[i + i0 + 256] & 0xFF, b[i + i0 + 512] & 0xFF);
}
} else {
s =  String.instantialize(b);
}}if (scale == null) {
var lines = JU.PT.split(s.trim(), "\n");
var n = lines.length;
scale =  Clazz_newIntArray (n, 0);
var isInt = (n > 0 && lines[0].indexOf(".") < 0);
for (var i = 0; i < n; i++) {
var tokens = JU.PT.getTokens(lines[i]);
if (tokens.length < 3) {
scale = null;
break;
}var len = tokens.length;
if (isInt) {
scale[i] = JU.CU.rgb(JU.PT.parseInt(tokens[len - 3]), JU.PT.parseInt(tokens[len - 2]), JU.PT.parseInt(tokens[len - 1]));
} else {
scale[i] = JU.CU.colorTriadToFFRGB(JU.PT.parseFloat(tokens[len - 3]), JU.PT.parseFloat(tokens[len - 2]), JU.PT.parseFloat(tokens[len - 1]));
}}
}if (scale != null && isNot) {
for (var i = 0, n = scale.length - 1, n2 = (n + 1) >> 1; i < n2; i++) {
var v = scale[i];
scale[i] = scale[n - i];
scale[n - i] = v;
}
}break;
}
} catch (e) {
if (Clazz_exceptionOf(e, Exception)){
JU.Logger.info("ColorEncoder " + e);
scale = null;
} else {
throw e;
}
}
}if (scale == null) scale =  Clazz_newIntArray(-1, [-1]);
this.schemes.put(colorScheme, scale);
this.setThisScheme(colorScheme, scale);
return -1;
} else if (pt >= 0) {
colorScheme = colorScheme.toLowerCase();
name = JU.PT.replaceAllCharacters(colorScheme.substring(0, pt), " =", "");
if (name.length > 0) isOverloaded = true;
var n = 0;
if (colorScheme.length > pt + 1 && !colorScheme.contains("[")) {
colorScheme = "[" + colorScheme.substring(pt + 1).trim() + "]";
colorScheme = JU.PT.rep(colorScheme.$replace('\n', ' '), "  ", " ");
colorScheme = JU.PT.rep(colorScheme, ", ", ",").$replace(' ', ',');
colorScheme = JU.PT.rep(colorScheme, ",", "][");
}pt = -1;
while ((pt = colorScheme.indexOf("[", pt + 1)) >= 0) n++;

if (n == 0) return this.makeColorScheme(name, null, isOverloaded);
var scale =  Clazz_newIntArray (n, 0);
n = 0;
while ((pt = colorScheme.indexOf("[", pt + 1)) >= 0) {
var pt2 = colorScheme.indexOf("]", pt);
if (pt2 < 0) pt2 = colorScheme.length - 1;
var c = JU.CU.getArgbFromString(colorScheme.substring(pt, pt2 + 1));
if (c == 0) c = JU.CU.getArgbFromString(colorScheme.substring(pt + 1, pt2).trim());
if (c == 0) {
JU.Logger.error("error in color value: " + colorScheme.substring(pt, pt2 + 1));
return 0;
}scale[n++] = c;
}
if (name.equals("user")) {
this.setUserScale(scale);
return -13;
}return this.makeColorScheme(name, scale, isOverloaded);
}var scale = this.schemes.get(name);
if (scale != null) {
this.setThisScheme(name, scale);
return ipt;
}return (ipt != -1 ? ipt : defaultToRoygb ? 0 : 2147483647);
}, "~S,~B,~B");
Clazz_defineMethod(c$, "setUserScale", 
function(scale){
this.ce.userScale = scale;
this.makeColorScheme("user", scale, false);
}, "~A");
Clazz_defineMethod(c$, "getColorSchemeArray", 
function(palette){
var b;
switch (palette) {
case -1:
return this.thisScale;
case 0:
return this.ce.argbsRoygb;
case 1:
return JU.AU.arrayCopyRangeRevI(this.ce.argbsRoygb, 0, -1);
case 8:
return JU.AU.arrayCopyRangeI(this.ce.argbsRoygb, 0, this.ce.ihalf);
case 9:
var a = JU.AU.arrayCopyRangeI(this.ce.argbsRoygb, this.ce.argbsRoygb.length - 2 * this.ce.ihalf, -1);
b =  Clazz_newIntArray (this.ce.ihalf, 0);
for (var i = b.length, j = a.length; --i >= 0 && --j >= 0; ) b[i] = a[j--];

return b;
case 12:
return this.getPaletteAC();
case 10:
return this.getPaletteBW();
case 11:
return this.getPaletteWB();
case 6:
return this.ce.argbsRwb;
case 7:
return JU.AU.arrayCopyRangeRevI(this.ce.argbsRwb, 0, -1);
case 2:
return this.ce.argbsCpk;
case 3:
return JU.ColorEncoder.getRasmolScale();
case 4:
return this.ce.getShapely();
case 17:
return this.ce.getNucleic();
case 5:
return this.ce.getAmino();
case -13:
return this.ce.userScale;
case -14:
return JU.AU.arrayCopyRangeRevI(this.ce.userScale, 0, -1);
default:
return null;
}
}, "~N");
Clazz_defineMethod(c$, "getColorIndexFromPalette", 
function(val, lo, hi, palette, isTranslucent){
var colix = JU.C.getColix(this.getArgbFromPalette(val, lo, hi, palette));
if (isTranslucent) {
var f = (hi - val) / (hi - lo);
if (f > 1) f = 1;
 else if (f < 0.125) f = 0.125;
colix = JU.C.getColixTranslucent3(colix, true, f);
}return colix;
}, "~N,~N,~N,~N,~B");
Clazz_defineMethod(c$, "getPaletteColorCount", 
function(palette){
switch (palette) {
case -1:
return this.thisScale.length;
case 10:
case 11:
return this.getPaletteBW().length;
case 0:
case 1:
return this.ce.argbsRoygb.length;
case 8:
case 9:
return this.ce.ihalf;
case 6:
case 7:
return this.ce.argbsRwb.length;
case -13:
case -14:
return this.ce.userScale.length;
case 2:
return this.ce.argbsCpk.length;
case 3:
return JU.ColorEncoder.getRasmolScale().length;
case 4:
return this.ce.getShapely().length;
case 17:
return this.ce.getNucleic().length;
case 5:
return this.ce.getAmino().length;
case 12:
return this.getPaletteAC().length;
default:
return 0;
}
}, "~N");
Clazz_defineMethod(c$, "getArgbFromPalette", 
function(val, lo, hi, palette){
if (Float.isNaN(val)) return -8355712;
var n = this.getPaletteColorCount(palette);
switch (palette) {
case -1:
if (this.isColorIndex) {
lo = 0;
hi = this.thisScale.length;
}return this.thisScale[JU.ColorEncoder.quantize4(val, lo, hi, n)];
case 10:
return this.getPaletteBW()[JU.ColorEncoder.quantize4(val, lo, hi, n)];
case 11:
return this.getPaletteWB()[JU.ColorEncoder.quantize4(val, lo, hi, n)];
case 0:
return this.ce.argbsRoygb[JU.ColorEncoder.quantize4(val, lo, hi, n)];
case 1:
return this.ce.argbsRoygb[JU.ColorEncoder.quantize4(-val, -hi, -lo, n)];
case 8:
return this.ce.argbsRoygb[JU.ColorEncoder.quantize4(val, lo, hi, n)];
case 9:
return this.ce.argbsRoygb[this.ce.ihalf + JU.ColorEncoder.quantize4(val, lo, hi, n) * 2];
case 6:
return this.ce.argbsRwb[JU.ColorEncoder.quantize4(val, lo, hi, n)];
case 7:
return this.ce.argbsRwb[JU.ColorEncoder.quantize4(-val, -hi, -lo, n)];
case -13:
return (this.ce.userScale.length == 0 ? -8355712 : this.ce.userScale[JU.ColorEncoder.quantize4(val, lo, hi, n)]);
case -14:
return (this.ce.userScale.length == 0 ? -8355712 : this.ce.userScale[JU.ColorEncoder.quantize4(-val, -hi, -lo, n)]);
case 2:
return this.ce.argbsCpk[JU.ColorEncoder.colorIndex(val, n)];
case 3:
return JU.ColorEncoder.getRasmolScale()[JU.ColorEncoder.colorIndex(val, n)];
case 4:
return this.ce.getShapely()[JU.ColorEncoder.colorIndex(val, n)];
case 5:
return this.ce.getAmino()[JU.ColorEncoder.colorIndex(val, n)];
case 17:
return this.ce.getNucleic()[JU.ColorEncoder.colorIndex(val - 24 + 2, n)];
case 12:
return this.getPaletteAC()[JU.ColorEncoder.colorIndexRepeat(val, n)];
default:
return -8355712;
}
}, "~N,~N,~N,~N");
Clazz_defineMethod(c$, "setThisScheme", 
function(name, scale){
this.thisName = name;
this.thisScale = scale;
if (name.equals("user")) this.userScale = scale;
this.isColorIndex = (name.indexOf("byelement") == 0 || name.indexOf("byresidue") == 0);
}, "~S,~A");
Clazz_defineMethod(c$, "getArgb", 
function(val){
return (this.isReversed ? this.getArgbFromPalette(-val, -this.hi, -this.lo, this.currentPalette) : this.getArgbFromPalette(val, this.lo, this.hi, this.currentPalette));
}, "~N");
Clazz_defineMethod(c$, "getArgbMinMax", 
function(val, min, max){
return (this.isReversed ? this.getArgbFromPalette(-val, -max, -min, this.currentPalette) : this.getArgbFromPalette(val, min, max, this.currentPalette));
}, "~N,~N,~N");
Clazz_defineMethod(c$, "getColorIndex", 
function(val){
return (this.isReversed ? this.getColorIndexFromPalette(-val, -this.hi, -this.lo, this.currentPalette, this.isTranslucent) : this.getColorIndexFromPalette(val, this.lo, this.hi, this.currentPalette, this.isTranslucent));
}, "~N");
Clazz_defineMethod(c$, "getColorKey", 
function(){
var info =  new java.util.Hashtable();
var segmentCount = this.getPaletteColorCount(this.currentPalette);
var colors =  new JU.Lst();
var values =  Clazz_newFloatArray (segmentCount + 1, 0);
var quantum = (this.hi - this.lo) / segmentCount;
var f = quantum * (this.isReversed ? -0.5 : 0.5);
for (var i = 0; i < segmentCount; i++) {
values[i] = (this.isReversed ? this.hi - i * quantum : this.lo + i * quantum);
colors.addLast(JU.CU.colorPtFromInt(this.getArgb(values[i] + f), null));
}
values[segmentCount] = (this.isReversed ? this.lo : this.hi);
info.put("values", values);
info.put("colors", colors);
info.put("min", Float.$valueOf(this.lo));
info.put("max", Float.$valueOf(this.hi));
info.put("reversed", Boolean.$valueOf(this.isReversed));
info.put("name", this.getCurrentColorSchemeName());
return info;
});
Clazz_defineMethod(c$, "getColorScheme", 
function(){
return (this.isTranslucent ? "translucent " : "") + (this.currentPalette < 0 ? JU.ColorEncoder.getColorSchemeList(this.getColorSchemeArray(this.currentPalette)) : this.getColorSchemeName(this.currentPalette));
});
Clazz_defineMethod(c$, "setColorScheme", 
function(colorScheme, isTranslucent){
this.isTranslucent = isTranslucent;
if (colorScheme != null) this.currentPalette = this.createColorScheme(colorScheme, true, false);
}, "~S,~B");
Clazz_defineMethod(c$, "setRange", 
function(lo, hi, isReversed){
if (hi == 3.4028235E38) {
lo = 1;
hi = this.getPaletteColorCount(this.currentPalette) + 1;
}this.lo = Math.min(lo, hi);
this.hi = Math.max(lo, hi);
this.isReversed = isReversed;
}, "~N,~N,~B");
Clazz_defineMethod(c$, "getCurrentColorSchemeName", 
function(){
return this.getColorSchemeName(this.currentPalette);
});
Clazz_defineMethod(c$, "getColorSchemeName", 
function(i){
var absi = Math.abs(i);
return (i == -1 ? this.thisName : absi < JU.ColorEncoder.colorSchemes.length && absi >= 0 ? JU.ColorEncoder.colorSchemes[absi] : null);
}, "~N");
c$.getColorSchemeList = Clazz_defineMethod(c$, "getColorSchemeList", 
function(scheme){
if (scheme == null) return "";
var colors = "";
for (var i = 0; i < scheme.length; i++) colors += (i == 0 ? "" : " ") + JU.Escape.escapeColor(scheme[i]);

return colors;
}, "~A");
c$.getRasmolScale = Clazz_defineMethod(c$, "getRasmolScale", 
function(){
if (JU.ColorEncoder.rasmolScale != null) return JU.ColorEncoder.rasmolScale;
JU.ColorEncoder.rasmolScale =  Clazz_newIntArray (J.c.PAL.argbsCpk.length, 0);
var argb = J.c.PAL.argbsCpkRasmol[0] | 0xFF000000;
for (var i = JU.ColorEncoder.rasmolScale.length; --i >= 0; ) JU.ColorEncoder.rasmolScale[i] = argb;

for (var i = J.c.PAL.argbsCpkRasmol.length; --i >= 0; ) {
argb = J.c.PAL.argbsCpkRasmol[i];
JU.ColorEncoder.rasmolScale[argb >> 24] = argb | 0xFF000000;
}
return JU.ColorEncoder.rasmolScale;
});
Clazz_defineMethod(c$, "getPaletteAC", 
function(){
return (this.ce.paletteFriendly == null ? this.ce.paletteFriendly =  Clazz_newIntArray(-1, [0x808080, 0x104BA9, 0xAA00A2, 0xC9F600, 0xFFA200, 0x284A7E, 0x7F207B, 0x9FB82E, 0xBF8B30, 0x052D6E, 0x6E0069, 0x83A000, 0xA66A00, 0x447BD4, 0xD435CD, 0xD8FA3F, 0xFFBA40, 0x6A93D4, 0xD460CF, 0xE1FA71, 0xFFCC73]) : this.ce.paletteFriendly);
});
Clazz_defineMethod(c$, "getPaletteWB", 
function(){
if (this.ce.paletteWB != null) return this.ce.paletteWB;
var b =  Clazz_newIntArray (JV.JC.argbsRoygbScale.length, 0);
for (var i = 0; i < b.length; i++) {
var xff = (1 / b.length * (b.length - i));
b[i] = JU.CU.colorTriadToFFRGB(xff, xff, xff);
}
return this.ce.paletteWB = b;
});
c$.getPaletteAtoB = Clazz_defineMethod(c$, "getPaletteAtoB", 
function(color1, color2, n){
if (n < 2) n = JV.JC.argbsRoygbScale.length;
var b =  Clazz_newIntArray (n, 0);
var rgb1 =  Clazz_newFloatArray (3, 0);
var rgb2 =  Clazz_newFloatArray (3, 0);
JU.CU.toRGB3f(color1, rgb1);
JU.CU.toRGB3f(color2, rgb2);
var dr = (rgb2[0] - rgb1[0]) / (n - 1);
var dg = (rgb2[1] - rgb1[1]) / (n - 1);
var db = (rgb2[2] - rgb1[2]) / (n - 1);
for (var i = 0; i < n; i++) b[i] = JU.CU.colorTriadToFFRGB(rgb1[0] + dr * i, rgb1[1] + dg * i, rgb1[2] + db * i);

return b;
}, "~N,~N,~N");
Clazz_defineMethod(c$, "getPaletteBW", 
function(){
if (this.ce.paletteBW != null) return this.ce.paletteBW;
var b =  Clazz_newIntArray (JV.JC.argbsRoygbScale.length, 0);
for (var i = 0; i < b.length; i++) {
var xff = (1 / b.length * i);
b[i] = JU.CU.colorTriadToFFRGB(xff, xff, xff);
}
return this.ce.paletteBW = b;
});
Clazz_defineMethod(c$, "quantize", 
function(x, isLowEnd){
var n = this.getPaletteColorCount(this.currentPalette);
x = ((Clazz_floatToInt(x * n)) + (isLowEnd ? 0 : 1)) / n;
return (x <= 0 ? this.lo : x >= 1 ? this.hi : this.lo + (this.hi - this.lo) * x);
}, "~N,~B");
c$.quantize4 = Clazz_defineMethod(c$, "quantize4", 
function(val, lo, hi, segmentCount){
var range = hi - lo;
if (range <= 0 || Float.isNaN(val)) return Clazz_doubleToInt(segmentCount / 2);
var t = val - lo;
if (t <= 0) return 0;
var quanta = range / segmentCount;
var q = Clazz_floatToInt(t / quanta + 0.0001);
if (q >= segmentCount) q = segmentCount - 1;
return q;
}, "~N,~N,~N,~N");
c$.colorIndex = Clazz_defineMethod(c$, "colorIndex", 
function(q, segmentCount){
return Clazz_doubleToInt(Math.floor(q <= 0 || q >= segmentCount ? 0 : q));
}, "~N,~N");
c$.colorIndexRepeat = Clazz_defineMethod(c$, "colorIndexRepeat", 
function(q, segmentCount){
var i = Clazz_doubleToInt(Math.floor(q <= 0 ? 0 : q));
return i % segmentCount;
}, "~N,~N");
c$.colorSchemes =  Clazz_newArray(-1, ["roygb", "bgyor", "byelement_jmol", "byelement_rasmol", "byresidue_shapely", "byresidue_amino", "rwb", "bwr", "low", "high", "bw", "wb", "friendly", "user", "resu", "inherit", "rgb", "bgr", "jmol", "rasmol", "byresidue", "byresidue_nucleic"]);
c$.rasmolScale = null;
c$.argbsChainAtom = null;
c$.argbsChainHetero = null;
});
;//5.0.1-v7 Mon Aug 24 10:01:38 CDT 2026
Clazz_declarePackage("JU");
Clazz_load(null, "JU.CommandHistory", ["JU.Lst"], function(){
var c$ = Clazz_decorateAsClass(function(){
this.commandList = null;
this.maxSize = 100;
this.nextCommand = 0;
this.cursorPos = 0;
this.isOn = true;
this.lstStates = null;
Clazz_instantialize(this, arguments);}, JU, "CommandHistory", null);
Clazz_makeConstructor(c$, 
function(){
this.reset(100);
});
Clazz_defineMethod(c$, "clear", 
function(){
this.reset(this.maxSize);
});
Clazz_defineMethod(c$, "reset", 
function(maxSize){
this.maxSize = maxSize;
this.commandList =  new JU.Lst();
this.nextCommand = 0;
this.commandList.addLast("");
this.cursorPos = 0;
}, "~N");
Clazz_defineMethod(c$, "setMaxSize", 
function(maxSize){
if (maxSize == this.maxSize) return;
if (maxSize < 2) maxSize = 2;
while (this.nextCommand > maxSize) {
this.commandList.removeItemAt(0);
this.nextCommand--;
}
if (this.nextCommand > maxSize) this.nextCommand = maxSize - 1;
this.cursorPos = this.nextCommand;
this.maxSize = maxSize;
}, "~N");
Clazz_defineMethod(c$, "getCommandUp", 
function(){
if (this.cursorPos <= 0) return null;
this.cursorPos--;
var str = this.getCommand();
if (str.endsWith("#??")) this.removeCommand(this.cursorPos--);
if (this.cursorPos < 0) this.cursorPos = 0;
return str;
});
Clazz_defineMethod(c$, "getCommandDown", 
function(){
if (this.cursorPos >= this.nextCommand) return null;
this.cursorPos++;
return this.getCommand();
});
Clazz_defineMethod(c$, "getCommand", 
function(){
return this.commandList.get(this.cursorPos);
});
Clazz_defineMethod(c$, "addCommand", 
function(strCommand){
if (!this.isOn && !strCommand.endsWith("#??")) return;
if (strCommand.endsWith("#----")) return;
var i;
while ((i = strCommand.indexOf("\n")) >= 0) {
var str = strCommand.substring(0, i);
if (str.length > 0) this.addCommandLine(str);
strCommand = strCommand.substring(i + 1);
}
if (strCommand.length > 0) this.addCommandLine(strCommand);
}, "~S");
Clazz_defineMethod(c$, "getSetHistory", 
function(n){
this.isOn = (n == -2 ? this.isOn : true);
switch (n) {
case 0:
this.isOn = false;
this.clear();
return "";
case -2147483648:
case -2:
this.clear();
return "";
case -1:
return this.getCommandUp();
case 1:
return this.getCommandDown();
default:
if (n < 0) {
this.setMaxSize(-2 - n);
return "";
}n = Math.max(this.nextCommand - n, 0);
}
var str = "";
for (var i = n; i < this.nextCommand; i++) if (!this.commandList.get(i).toUpperCase().startsWith("WRITE HISTORY")) str += this.commandList.get(i) + "\n";

return str;
}, "~N");
Clazz_defineMethod(c$, "find", 
function(cmd, dir){
var cpos = this.cursorPos;
var c = cmd;
while (c != null) {
c = this.getSetHistory(dir);
if (c == null) break;
if (c.startsWith(cmd)) return c;
}
this.cursorPos = cpos;
return null;
}, "~S,~N");
Clazz_defineMethod(c$, "removeCommand", 
function(){
return this.removeCommand(this.nextCommand - 1);
});
Clazz_defineMethod(c$, "removeCommand", 
function(n){
if (n < 0 || n >= this.nextCommand) return "";
var str = this.commandList.removeItemAt(n);
this.nextCommand--;
return str;
}, "~N");
Clazz_defineMethod(c$, "addCommandLine", 
function(command){
if (command == null || command.length == 0) return;
if (command.endsWith("#--")) return;
if (this.nextCommand > 0 && command.equals(this.commandList.get(this.nextCommand - 1))) {
this.cursorPos = this.nextCommand;
return;
}if (this.nextCommand >= this.maxSize) {
this.commandList.removeItemAt(0);
this.nextCommand = this.maxSize - 1;
}this.commandList.add(this.nextCommand, command);
this.nextCommand++;
this.cursorPos = this.nextCommand;
this.commandList.add(this.nextCommand, "");
}, "~S");
Clazz_defineMethod(c$, "pushState", 
function(stateInfo){
if (this.lstStates == null) this.lstStates =  new JU.Lst();
this.lstStates.addLast(stateInfo);
}, "~S");
Clazz_defineMethod(c$, "popState", 
function(){
if (this.lstStates == null || this.lstStates.size() == 0) return null;
var s = this.lstStates.removeItemAt(this.lstStates.size() - 1);
return s;
});
});
;//5.0.1-v7 Mon Aug 17 10:07:10 MDT 2026
Clazz_declarePackage("JU");
Clazz_load(["JU.LoggerInterface"], "JU.DefaultLogger", ["JU.Logger"], function(){
var c$ = Clazz_declareType(JU, "DefaultLogger", null, JU.LoggerInterface);
Clazz_defineMethod(c$, "log", 
function(out, level, txt, e){
if (out === System.err) System.out.flush();
if ((out != null) && ((txt != null) || (e != null))) {
txt = (txt != null ? txt : "");
txt = (JU.Logger.logLevel() ? "[" + JU.Logger.getLevel(level) + "] " : "") + txt + (e != null ? ": " + e.toString() : "");
out.println(txt);
if (e != null) {
var elements = e.getStackTrace();
if (elements != null) {
for (var i = 0; i < elements.length; i++) {
out.println(elements[i].getClassName() + " - " + elements[i].getLineNumber() + " - " + elements[i].getMethodName());
}
}}}if (out === System.err) System.err.flush();
return txt;
}, "java.io.PrintStream,~N,~S,Throwable");
Clazz_overrideMethod(c$, "debug", 
function(txt){
this.log(System.out, 5, txt, null);
}, "~S");
Clazz_overrideMethod(c$, "info", 
function(txt){
this.log(System.out, 4, txt, null);
}, "~S");
Clazz_overrideMethod(c$, "warn", 
function(txt){
this.log(System.out, 3, txt, null);
}, "~S");
Clazz_overrideMethod(c$, "warnEx", 
function(txt, e){
this.log(System.out, 3, txt, e);
}, "~S,Throwable");
Clazz_overrideMethod(c$, "error", 
function(txt){
this.log(System.err, 2, txt, null);
}, "~S");
Clazz_overrideMethod(c$, "errorEx", 
function(txt, e){
this.log(System.err, 2, txt, e);
}, "~S,Throwable");
Clazz_overrideMethod(c$, "fatal", 
function(txt){
this.log(System.err, 1, txt, null);
}, "~S");
Clazz_overrideMethod(c$, "fatalEx", 
function(txt, e){
this.log(System.err, 1, txt, e);
}, "~S,Throwable");
});
;//5.0.1-v7 Mon Aug 17 10:07:10 MDT 2026
Clazz_declarePackage("JU");
Clazz_load(["JU.BS"], "JU.Elements", ["java.util.Hashtable", "JU.PT", "JU.Logger"], function(){
var c$ = Clazz_declareType(JU, "Elements", null);
c$.getNaturalIsotope = Clazz_defineMethod(c$, "getNaturalIsotope", 
function(elementNumber){
return JU.Elements.isotopeMass[elementNumber & 127];
}, "~N");
c$.getAtomicMass = Clazz_defineMethod(c$, "getAtomicMass", 
function(i){
return (i < 1 || i >= JU.Elements.atomicMass.length ? 0 : JU.Elements.atomicMass[i]);
}, "~N");
c$.elementNumberFromSymbol = Clazz_defineMethod(c$, "elementNumberFromSymbol", 
function(elementSymbol, isSilent){
if (JU.Elements.htElementMap == null) {
var map =  new java.util.Hashtable();
for (var elementNumber = JU.Elements.elementNumberMax; --elementNumber >= 0; ) {
var symbol = JU.Elements.elementSymbols[elementNumber];
var boxed = Integer.$valueOf(elementNumber);
map.put(symbol, boxed);
if (symbol.length == 2) map.put(symbol.toUpperCase(), boxed);
}
for (var i = JU.Elements.altElementMax; --i >= 4; ) {
var symbol = JU.Elements.altElementSymbols[i];
var boxed = Integer.$valueOf(JU.Elements.altElementNumbers[i]);
map.put(symbol, boxed);
if (symbol.length == 2) map.put(symbol.toUpperCase(), boxed);
}
map.put("Z", Integer.$valueOf(0));
JU.Elements.htElementMap = map;
}if (elementSymbol == null) return 0;
var boxedAtomicNumber = JU.Elements.htElementMap.get(elementSymbol);
if (boxedAtomicNumber != null) return boxedAtomicNumber.intValue();
if (JU.PT.isDigit(elementSymbol.charAt(0))) {
var pt = elementSymbol.length - 2;
if (pt >= 0 && JU.PT.isDigit(elementSymbol.charAt(pt))) pt++;
var isotope = (pt > 0 ? JU.PT.parseInt(elementSymbol.substring(0, pt)) : 0);
if (isotope > 0) {
var n = JU.Elements.elementNumberFromSymbol(elementSymbol.substring(pt), true);
if (n > 0) {
isotope = JU.Elements.getAtomicAndIsotopeNumber(n, isotope);
JU.Elements.htElementMap.put(elementSymbol.toUpperCase(), Integer.$valueOf(isotope));
return isotope;
}}}if (!isSilent) JU.Logger.error("'" + elementSymbol + "' is not a recognized symbol");
return 0;
}, "~S,~B");
c$.elementSymbolFromNumber = Clazz_defineMethod(c$, "elementSymbolFromNumber", 
function(elemNo){
var isoNumber = 0;
if (elemNo >= JU.Elements.elementNumberMax) {
for (var j = JU.Elements.altElementMax; --j >= 0; ) if (elemNo == JU.Elements.altElementNumbers[j]) return JU.Elements.altElementSymbols[j];

isoNumber = JU.Elements.getIsotopeNumber(elemNo);
elemNo &= 127;
return "" + isoNumber + JU.Elements.getElementSymbol(elemNo);
}return JU.Elements.getElementSymbol(elemNo);
}, "~N");
c$.getElementSymbol = Clazz_defineMethod(c$, "getElementSymbol", 
function(elemNo){
if (elemNo < 0 || elemNo >= JU.Elements.elementNumberMax) elemNo = 0;
return JU.Elements.elementSymbols[elemNo];
}, "~N");
c$.elementNameFromNumber = Clazz_defineMethod(c$, "elementNameFromNumber", 
function(elementNumber){
if (elementNumber >= JU.Elements.elementNumberMax) {
for (var j = JU.Elements.altElementMax; --j >= 0; ) if (elementNumber == JU.Elements.altElementNumbers[j]) return JU.Elements.altElementNames[j];

elementNumber %= 128;
}if (elementNumber < 0 || elementNumber >= JU.Elements.elementNumberMax) elementNumber = 0;
return JU.Elements.elementNames[elementNumber];
}, "~N");
c$.elementNumberFromName = Clazz_defineMethod(c$, "elementNumberFromName", 
function(name){
for (var i = 1; i < JU.Elements.elementNumberMax; i++) if (JU.Elements.elementNames[i].equalsIgnoreCase(name)) return i;

return -1;
}, "~S");
c$.altElementNameFromIndex = Clazz_defineMethod(c$, "altElementNameFromIndex", 
function(i){
return JU.Elements.altElementNames[i];
}, "~N");
c$.altElementNumberFromIndex = Clazz_defineMethod(c$, "altElementNumberFromIndex", 
function(i){
return JU.Elements.altElementNumbers[i];
}, "~N");
c$.altElementSymbolFromIndex = Clazz_defineMethod(c$, "altElementSymbolFromIndex", 
function(i){
return JU.Elements.altElementSymbols[i];
}, "~N");
c$.altIsotopeSymbolFromIndex = Clazz_defineMethod(c$, "altIsotopeSymbolFromIndex", 
function(i){
var code = JU.Elements.altElementNumbers[i];
return (code >> 7) + JU.Elements.elementSymbolFromNumber(code & 127);
}, "~N");
c$.altIsotopeSymbolFromIndex2 = Clazz_defineMethod(c$, "altIsotopeSymbolFromIndex2", 
function(i){
var code = JU.Elements.altElementNumbers[i];
return JU.Elements.elementSymbolFromNumber(code & 127) + ((code) >> 7);
}, "~N");
c$.getElementNumber = Clazz_defineMethod(c$, "getElementNumber", 
function(atomicAndIsotopeNumber){
return atomicAndIsotopeNumber & 127;
}, "~N");
c$.getIsotopeNumber = Clazz_defineMethod(c$, "getIsotopeNumber", 
function(atomicAndIsotopeNumber){
return (atomicAndIsotopeNumber & 32640) >> 7;
}, "~N");
c$.getAtomicAndIsotopeNumber = Clazz_defineMethod(c$, "getAtomicAndIsotopeNumber", 
function(n, mass){
return ((n < 0 ? 0 : n) + (mass <= 0 ? 0 : mass << 7));
}, "~N,~N");
c$.altElementIndexFromNumber = Clazz_defineMethod(c$, "altElementIndexFromNumber", 
function(atomicAndIsotopeNumber){
for (var i = 0; i < JU.Elements.altElementMax; i++) if (JU.Elements.altElementNumbers[i] == atomicAndIsotopeNumber) return i;

return 0;
}, "~N");
c$.getCommonNMRIsotope = Clazz_defineMethod(c$, "getCommonNMRIsotope", 
function(sym){
if (JU.PT.isDigit(sym.charAt(0))) return sym;
if (sym.equals("D")) return "2H";
var pt = JU.Elements.commonNmrIsotopes.indexOf(sym + ",");
return (pt < 0 ? sym : JU.Elements.commonNmrIsotopes.substring(pt - 2, pt + sym.length).trim());
}, "~S");
c$.getNmrNucleusFromName = Clazz_defineMethod(c$, "getNmrNucleusFromName", 
function(name){
return JU.Elements.getCommonNMRIsotope(JU.Elements.elementSymbolFromNumber(JU.Elements.elementNumberFromName(name)));
}, "~S");
c$.isNaturalIsotope = Clazz_defineMethod(c$, "isNaturalIsotope", 
function(isotopeSymbol){
return ("1H,12C,14N".indexOf(isotopeSymbol + ",") >= 0);
}, "~S");
c$.getBondingRadius = Clazz_defineMethod(c$, "getBondingRadius", 
function(atomicNumberAndIsotope, charge){
var atomicNumber = atomicNumberAndIsotope & 127;
return (charge > 0 && JU.Elements.bsCations.get(atomicNumber) ? JU.Elements.getBondingRadFromTable(atomicNumber, charge, JU.Elements.cationLookupTable) : charge < 0 && JU.Elements.bsAnions.get(atomicNumber) ? JU.Elements.getBondingRadFromTable(atomicNumber, charge, JU.Elements.anionLookupTable) : JU.Elements.defaultBondingMars[(atomicNumber << 1) + JU.Elements.bondingVersion] / 1000);
}, "~N,~N");
c$.getCovalentRadius = Clazz_defineMethod(c$, "getCovalentRadius", 
function(atomicNumberAndIsotope){
return JU.Elements.defaultBondingMars[((atomicNumberAndIsotope & 127) << 1) + JU.Elements.covalentVersion] / 1000;
}, "~N");
c$.getBondingRadFromTable = Clazz_defineMethod(c$, "getBondingRadFromTable", 
function(atomicNumber, charge, table){
var ionic = (atomicNumber << 4) + (charge + 4);
var iVal = 0;
var iMid = 0;
var iMin = 0;
var iMax = Clazz_doubleToInt(table.length / 2);
while (iMin != iMax) {
iMid = Clazz_doubleToInt((iMin + iMax) / 2);
iVal = table[iMid << 1];
if (iVal > ionic) iMax = iMid;
 else if (iVal < ionic) iMin = iMid + 1;
 else return table[(iMid << 1) + 1] / 1000;
}
if (iVal > ionic) iMid--;
iVal = table[iMid << 1];
if (atomicNumber != (iVal >> 4)) iMid++;
return table[(iMid << 1) + 1] / 1000;
}, "~N,~N,~A");
c$.getVanderwaalsMar = Clazz_defineMethod(c$, "getVanderwaalsMar", 
function(atomicAndIsotopeNumber, type){
return JU.Elements.vanderwaalsMars[((atomicAndIsotopeNumber & 127) << 2) + (type.pt % 4)];
}, "~N,J.c.VDW");
c$.getHydrophobicity = Clazz_defineMethod(c$, "getHydrophobicity", 
function(i){
return (i < 1 || i >= JU.Elements.hydrophobicities.length ? 0 : JU.Elements.hydrophobicities[i]);
}, "~N");
c$.getAllredRochowElectroNeg = Clazz_defineMethod(c$, "getAllredRochowElectroNeg", 
function(elemno){
return (elemno > 0 && elemno < JU.Elements.electroNegativities.length ? JU.Elements.electroNegativities[elemno] : 0);
}, "~N");
c$.isElement = Clazz_defineMethod(c$, "isElement", 
function(atomicAndIsotopeNumber, elemNo){
return ((atomicAndIsotopeNumber & 127) == elemNo);
}, "~N,~N");
c$.elementSymbols =  Clazz_newArray(-1, ["Xx", "H", "He", "Li", "Be", "B", "C", "N", "O", "F", "Ne", "Na", "Mg", "Al", "Si", "P", "S", "Cl", "Ar", "K", "Ca", "Sc", "Ti", "V", "Cr", "Mn", "Fe", "Co", "Ni", "Cu", "Zn", "Ga", "Ge", "As", "Se", "Br", "Kr", "Rb", "Sr", "Y", "Zr", "Nb", "Mo", "Tc", "Ru", "Rh", "Pd", "Ag", "Cd", "In", "Sn", "Sb", "Te", "I", "Xe", "Cs", "Ba", "La", "Ce", "Pr", "Nd", "Pm", "Sm", "Eu", "Gd", "Tb", "Dy", "Ho", "Er", "Tm", "Yb", "Lu", "Hf", "Ta", "W", "Re", "Os", "Ir", "Pt", "Au", "Hg", "Tl", "Pb", "Bi", "Po", "At", "Rn", "Fr", "Ra", "Ac", "Th", "Pa", "U", "Np", "Pu", "Am", "Cm", "Bk", "Cf", "Es", "Fm", "Md", "No", "Lr", "Rf", "Db", "Sg", "Bh", "Hs", "Mt"]);
c$.atomicMass =  Clazz_newFloatArray(-1, [0, 1.008, 4.002, 6.9675, 9.012, 10.8135, 12.0106, 14.006, 15.999, 18.998, 20.1797, 22.989, 24.307, 26.981, 28.084, 30.973, 32.059, 35.4515, 39.948, 39.0983, 40.078, 44.955, 47.867, 50.9415, 51.9961, 54.938, 55.845, 58.933, 58.6934, 63.546, 65.38, 69.723, 72.63, 74.921, 78.971, 79.904, 83.798, 85.4678, 87.62, 88.905, 91.224, 92.906, 95.95, 98.91, 101.07, 102.905, 106.42, 107.8682, 112.414, 114.818, 118.71, 121.76, 127.6, 126.904, 131.293, 132.905, 137.327, 138.905, 140.116, 140.907, 144.242, 144.9, 150.36, 151.964, 157.25, 158.925, 162.5, 164.93, 167.259, 168.934, 173.054, 174.9668, 178.49, 180.947, 183.84, 186.207, 190.23, 192.217, 195.084, 196.966, 200.592, 204.3835, 207.2, 208.98, 210, 210, 222, 223, 226.03, 227.03, 232.0377, 231.035, 238.028, 237.05, 239.1, 243.1, 247.1, 247.1, 252.1, 252.1, 257.1, 256.1, 259.1, 260.1, 261, 262, 263, 262, 265, 268]);
c$.isotopeMass =  Clazz_newIntArray(-1, [0, 1, 4, 7, 9, 11, 12, 14, 16, 19, 20, 23, 24, 27, 28, 31, 32, 35, 40, 39, 40, 45, 48, 51, 52, 55, 56, 59, 59, 64, 65, 70, 73, 75, 79, 80, 84, 85, 88, 89, 91, 93, 96, 98, 101, 103, 106, 108, 112, 115, 119, 122, 128, 127, 131, 133, 137, 139, 140, 141, 144, 145, 150, 152, 157, 159, 163, 165, 167, 169, 173, 175, 179, 181, 184, 186, 190, 192, 195, 197, 201, 204, 207, 209, 209, 210, 222, 223, 226, 227, 232, 231, 238, 237, 244, 243, 247, 247, 251, 252, 257, 258, 259, 260, 261, 262, 263, 262, 265, 268]);
c$.elementNumberMax = JU.Elements.elementSymbols.length;
c$.htElementMap = null;
c$.elementNames =  Clazz_newArray(-1, ["unknown", "hydrogen", "helium", "lithium", "beryllium", "boron", "carbon", "nitrogen", "oxygen", "fluorine", "neon", "sodium", "magnesium", "aluminum", "silicon", "phosphorus", "sulfur", "chlorine", "argon", "potassium", "calcium", "scandium", "titanium", "vanadium", "chromium", "manganese", "iron", "cobalt", "nickel", "copper", "zinc", "gallium", "germanium", "arsenic", "selenium", "bromine", "krypton", "rubidium", "strontium", "yttrium", "zirconium", "niobium", "molybdenum", "technetium", "ruthenium", "rhodium", "palladium", "silver", "cadmium", "indium", "tin", "antimony", "tellurium", "iodine", "xenon", "cesium", "barium", "lanthanum", "cerium", "praseodymium", "neodymium", "promethium", "samarium", "europium", "gadolinium", "terbium", "dysprosium", "holmium", "erbium", "thulium", "ytterbium", "lutetium", "hafnium", "tantalum", "tungsten", "rhenium", "osmium", "iridium", "platinum", "gold", "mercury", "thallium", "lead", "bismuth", "polonium", "astatine", "radon", "francium", "radium", "actinium", "thorium", "protactinium", "uranium", "neptunium", "plutonium", "americium", "curium", "berkelium", "californium", "einsteinium", "fermium", "mendelevium", "nobelium", "lawrencium", "rutherfordium", "dubnium", "seaborgium", "bohrium", "hassium", "meitnerium"]);
c$.commonNmrIsotopes = ", 1H, 2H, 6Li, 7Li,10B,13C,15N,17O,19F,";
c$.altElementNumbers =  Clazz_newIntArray(-1, [0, 13, 16, 55, 257, 385, 1414, 1670, 1798, 1927]);
c$.altElementMax = JU.Elements.altElementNumbers.length;
c$.altElementSymbols =  Clazz_newArray(-1, ["Xx", "Al", "S", "Cs", "D", "T", "11C", "13C", "14C", "15N"]);
c$.altElementNames =  Clazz_newArray(-1, ["dummy", "aluminium", "sulphur", "caesium", "deuterium", "tritium", "", "", "", ""]);
c$.vanderwaalsMars =  Clazz_newShortArray(-1, [1000, 1000, 1000, 1000, 1200, 1100, 1100, 1200, 1400, 1400, 2200, 1400, 1820, 1810, 1220, 2200, 1700, 1530, 628, 1900, 2080, 1920, 1548, 1800, 1950, 1700, 1548, 1700, 1850, 1550, 1400, 1600, 1700, 1520, 1348, 1550, 1730, 1470, 1300, 1500, 1540, 1540, 2020, 1540, 2270, 2270, 2200, 2400, 1730, 1730, 1500, 2200, 2050, 1840, 1500, 2100, 2100, 2100, 2200, 2100, 2080, 1800, 1880, 1950, 2000, 1800, 1808, 1800, 1970, 1750, 1748, 1800, 1880, 1880, 2768, 1880, 2750, 2750, 2388, 2800, 1973, 2310, 1948, 2400, 1700, 2300, 1320, 2300, 1700, 2150, 1948, 2150, 1700, 2050, 1060, 2050, 1700, 2050, 1128, 2050, 1700, 2050, 1188, 2050, 1700, 2050, 1948, 2050, 1700, 2000, 1128, 2000, 1630, 2000, 1240, 2000, 1400, 2000, 1148, 2000, 1390, 2100, 1148, 2100, 1870, 1870, 1548, 2100, 1700, 2110, 3996, 2100, 1850, 1850, 828, 2050, 1900, 1900, 900, 1900, 2100, 1830, 1748, 1900, 2020, 2020, 1900, 2020, 1700, 3030, 2648, 2900, 1700, 2490, 2020, 2550, 1700, 2400, 1608, 2400, 1700, 2300, 1420, 2300, 1700, 2150, 1328, 2150, 1700, 2100, 1748, 2100, 1700, 2050, 1800, 2050, 1700, 2050, 1200, 2050, 1700, 2000, 1220, 2000, 1630, 2050, 1440, 2050, 1720, 2100, 1548, 2100, 1580, 2200, 1748, 2200, 1930, 2200, 1448, 2200, 2170, 1930, 1668, 2250, 2200, 2170, 1120, 2200, 2060, 2060, 1260, 2100, 2150, 1980, 1748, 2100, 2160, 2160, 2100, 2160, 1700, 3430, 3008, 3000, 1700, 2680, 2408, 2700, 1700, 2500, 1828, 2500, 1700, 2480, 1860, 2480, 1700, 2470, 1620, 2470, 1700, 2450, 1788, 2450, 1700, 2430, 1760, 2430, 1700, 2420, 1740, 2420, 1700, 2400, 1960, 2400, 1700, 2380, 1688, 2380, 1700, 2370, 1660, 2370, 1700, 2350, 1628, 2350, 1700, 2330, 1608, 2330, 1700, 2320, 1588, 2320, 1700, 2300, 1568, 2300, 1700, 2280, 1540, 2280, 1700, 2270, 1528, 2270, 1700, 2250, 1400, 2250, 1700, 2200, 1220, 2200, 1700, 2100, 1260, 2100, 1700, 2050, 1300, 2050, 1700, 2000, 1580, 2000, 1700, 2000, 1220, 2000, 1720, 2050, 1548, 2050, 1660, 2100, 1448, 2100, 1550, 2050, 1980, 2050, 1960, 1960, 1708, 2200, 2020, 2020, 2160, 2300, 1700, 2070, 1728, 2300, 1700, 1970, 1208, 2000, 1700, 2020, 1120, 2000, 1700, 2200, 2300, 2000, 1700, 3480, 3240, 2000, 1700, 2830, 2568, 2000, 1700, 2000, 2120, 2000, 1700, 2400, 1840, 2400, 1700, 2000, 1600, 2000, 1860, 2300, 1748, 2300, 1700, 2000, 1708, 2000, 1700, 2000, 1668, 2000, 1700, 2000, 1660, 2000, 1700, 2000, 1648, 2000, 1700, 2000, 1640, 2000, 1700, 2000, 1628, 2000, 1700, 2000, 1620, 2000, 1700, 2000, 1608, 2000, 1700, 2000, 1600, 2000, 1700, 2000, 1588, 2000, 1700, 2000, 1580, 2000, 1700, 2000, 1600, 2000, 1700, 2000, 1600, 2000, 1700, 2000, 1600, 2000, 1700, 2000, 1600, 2000, 1700, 2000, 1600, 2000, 1700, 2000, 1600, 2000]);
c$.covalentVersion = 1;
c$.bondingVersion = 0;
c$.defaultBondingMars =  Clazz_newShortArray(-1, [0, 0, 230, 320, 930, 460, 680, 1330, 350, 1020, 830, 850, 680, 750, 680, 710, 680, 630, 640, 640, 1120, 670, 970, 1550, 1100, 1390, 1350, 1260, 1200, 1160, 750, 1110, 1020, 1030, 990, 990, 1570, 960, 1330, 1960, 990, 1710, 1440, 1480, 1470, 1360, 1330, 1340, 1350, 1220, 1350, 1190, 1340, 1160, 1330, 1110, 1500, 1100, 1520, 1120, 1450, 1180, 1220, 1240, 1170, 1210, 1210, 1210, 1220, 1160, 1210, 1140, 1910, 1170, 1470, 2100, 1120, 1850, 1780, 1630, 1560, 1540, 1480, 1470, 1470, 1380, 1350, 1280, 1400, 1250, 1450, 1250, 1500, 1200, 1590, 1280, 1690, 1360, 1630, 1420, 1460, 1400, 1460, 1400, 1470, 1360, 1400, 1330, 1980, 1310, 1670, 2320, 1340, 1960, 1870, 1800, 1830, 1630, 1820, 1760, 1810, 1740, 1800, 1730, 1800, 1720, 1990, 1680, 1790, 1690, 1760, 1680, 1750, 1670, 1740, 1660, 1730, 1650, 1720, 1640, 1940, 1700, 1720, 1620, 1570, 1520, 1430, 1460, 1370, 1370, 1350, 1310, 1370, 1290, 1320, 1220, 1500, 1230, 1500, 1240, 1700, 1330, 1550, 1440, 1540, 1440, 1540, 1510, 1680, 1450, 1700, 1470, 2400, 1420, 2000, 2230, 1900, 2010, 1880, 1860, 1790, 1750, 1610, 1690, 1580, 1700, 1550, 1710, 1530, 1720, 1510, 1660, 1500, 1660, 1500, 1680, 1500, 1680, 1500, 1650, 1500, 1670, 1500, 1730, 1500, 1760, 1500, 1610, 1600, 1570, 1600, 1490, 1600, 1430, 1600, 1410, 1600, 1340, 1600, 1290]);
c$.cationLookupTable =  Clazz_newShortArray(-1, [53, 680, 69, 440, 70, 350, 85, 350, 87, 230, 104, 160, 117, 680, 119, 160, 121, 130, 133, 220, 138, 90, 155, 80, 165, 1120, 181, 970, 197, 820, 198, 660, 215, 510, 229, 650, 232, 420, 247, 440, 249, 350, 262, 2190, 264, 370, 266, 300, 281, 340, 283, 270, 293, 1540, 309, 1330, 325, 1180, 326, 990, 343, 732, 357, 960, 358, 940, 359, 760, 360, 680, 374, 880, 375, 740, 376, 630, 377, 590, 389, 810, 390, 890, 391, 630, 394, 520, 406, 800, 407, 660, 408, 600, 411, 460, 422, 740, 423, 640, 438, 720, 439, 630, 454, 690, 469, 960, 470, 720, 485, 880, 486, 740, 501, 810, 503, 620, 518, 730, 520, 530, 535, 580, 537, 460, 549, 660, 552, 500, 554, 420, 569, 470, 571, 390, 597, 1470, 614, 1120, 631, 893, 645, 1090, 648, 790, 661, 1000, 664, 740, 665, 690, 677, 930, 680, 700, 682, 620, 699, 979, 712, 670, 727, 680, 742, 800, 744, 650, 757, 1260, 758, 890, 773, 1140, 774, 970, 791, 810, 806, 930, 808, 710, 823, 760, 825, 620, 837, 820, 840, 700, 842, 560, 857, 620, 859, 500, 885, 1670, 901, 1530, 902, 1340, 917, 1390, 919, 1016, 933, 1270, 935, 1034, 936, 920, 951, 1013, 952, 900, 967, 995, 983, 979, 999, 964, 1014, 1090, 1015, 950, 1031, 938, 1047, 923, 1048, 840, 1063, 908, 1079, 894, 1095, 881, 1111, 870, 1126, 930, 1127, 858, 1143, 850, 1160, 780, 1177, 680, 1192, 700, 1194, 620, 1208, 720, 1211, 560, 1224, 880, 1226, 690, 1240, 680, 1254, 800, 1256, 650, 1269, 1370, 1271, 850, 1285, 1270, 1286, 1100, 1301, 1470, 1303, 950, 1318, 1200, 1320, 840, 1333, 980, 1335, 960, 1337, 740, 1354, 670, 1371, 620, 1397, 1800, 1414, 1430, 1431, 1180, 1448, 1020, 1463, 1130, 1464, 980, 1465, 890, 1480, 970, 1482, 800, 1495, 1100, 1496, 950, 1499, 710, 1511, 1080, 1512, 930, 1527, 1070, 1528, 920]);
c$.anionLookupTable =  Clazz_newShortArray(-1, [19, 1540, 96, 2600, 113, 1710, 130, 1360, 131, 680, 147, 1330, 241, 2120, 258, 1840, 275, 1810, 512, 2720, 529, 2220, 546, 1980, 563, 1960, 800, 2940, 803, 3700, 817, 2450, 834, 2110, 835, 2500, 851, 2200]);
c$.bsCations =  new JU.BS();
c$.bsAnions =  new JU.BS();
{
for (var i = 0; i < JU.Elements.anionLookupTable.length; i += 2) JU.Elements.bsAnions.set(JU.Elements.anionLookupTable[i] >> 4);

for (var i = 0; i < JU.Elements.cationLookupTable.length; i += 2) JU.Elements.bsCations.set(JU.Elements.cationLookupTable[i] >> 4);

}c$.hydrophobicities =  Clazz_newFloatArray(-1, [0, 0.62, -2.53, -0.78, -0.9, 0.29, -0.85, -0.74, 0.48, -0.4, 1.38, 1.06, -1.5, 0.64, 1.19, 0.12, -0.18, -0.05, 0.81, 0.26, 1.08]);
{
if ((JU.Elements.elementNames.length != JU.Elements.elementNumberMax) || (JU.Elements.vanderwaalsMars.length >> 2 != JU.Elements.elementNumberMax) || (JU.Elements.defaultBondingMars.length >> 1 != JU.Elements.elementNumberMax)) {
JU.Logger.error("ERROR!!! Element table length mismatch:\n elementSymbols.length=" + JU.Elements.elementSymbols.length + "\n elementNames.length=" + JU.Elements.elementNames.length + "\n vanderwaalsMars.length=" + JU.Elements.vanderwaalsMars.length + "\n covalentMars.length=" + JU.Elements.defaultBondingMars.length);
}}c$.electroNegativities =  Clazz_newFloatArray(-1, [0, 2.2, 0, 0.97, 1.47, 2.01, 2.5, 3.07, 3.5, 4.1, 0, 1.01, 1.23, 1.47, 1.74, 2.06, 2.44, 2.83, 0, 0.91, 1.04, 1.2, 1.32, 1.45, 1.56, 1.6, 1.64, 1.7, 1.75, 1.75, 1.66, 1.82, 2.02, 2.2, 2.48, 2.74, 0, 0.89, 0.99, 1.11, 1.22, 1.23, 1.3, 1.36, 1.42, 1.45, 1.35, 1.42, 1.46, 1.49, 1.72, 1.82, 2.01, 2.21]);
});
;//5.0.1-v7 Mon Aug 17 10:07:10 MDT 2026
Clazz_declarePackage("JU");
Clazz_load(null, "JU.Escape", ["JU.AU", "$.BS", "$.Lst", "$.M3", "$.M4", "$.P3", "$.P4", "$.PT", "$.SB", "$.V3", "JS.SV"], function(){
var c$ = Clazz_declareType(JU, "Escape", null);
c$.escapeColor = Clazz_defineMethod(c$, "escapeColor", 
function(argb){
return (argb == 0 ? null : "[x" + JU.Escape.getHexColorFromRGB(argb) + "]");
}, "~N");
c$.getHexColorFromRGB = Clazz_defineMethod(c$, "getHexColorFromRGB", 
function(argb){
if (argb == 0) return null;
var r = "00" + Integer.toHexString((argb >> 16) & 0xFF);
r = r.substring(r.length - 2);
var g = "00" + Integer.toHexString((argb >> 8) & 0xFF);
g = g.substring(g.length - 2);
var b = "00" + Integer.toHexString(argb & 0xFF);
b = b.substring(b.length - 2);
return r + g + b;
}, "~N");
c$.eP = Clazz_defineMethod(c$, "eP", 
function(xyz){
if (xyz == null) return "null";
return "{" + xyz.x + " " + xyz.y + " " + xyz.z + "}";
}, "JU.T3");
c$.matrixToScript = Clazz_defineMethod(c$, "matrixToScript", 
function(m){
return JU.PT.replaceAllCharacters(m.toString(), "\n\r ", "").$replace('\t', ' ');
}, "~O");
c$.eP4 = Clazz_defineMethod(c$, "eP4", 
function(x){
return "{" + x.x + " " + x.y + " " + x.z + " " + x.w + "}";
}, "JU.P4");
c$.drawQuat = Clazz_defineMethod(c$, "drawQuat", 
function(q, prefix, id, ptCenter, scale){
var strV = " VECTOR " + JU.Escape.eP(ptCenter) + " ";
if (scale == 0) scale = 1;
return "draw " + prefix + "x" + id + strV + JU.Escape.eP(q.getVectorScaled(0, scale)) + " color red\n" + "draw " + prefix + "y" + id + strV + JU.Escape.eP(q.getVectorScaled(1, scale)) + " color green\n" + "draw " + prefix + "z" + id + strV + JU.Escape.eP(q.getVectorScaled(2, scale)) + " color blue\n";
}, "JU.Quat,~S,~S,JU.P3,~N");
c$.e = Clazz_defineMethod(c$, "e", 
function(x){
if (x == null) return "null";
if (JU.PT.isNonStringPrimitive(x)) return x.toString();
if ((typeof(x)=='string')) return JU.PT.esc(x);
if (Clazz_instanceOf(x,"JU.Lst")) return JU.Escape.eV(x);
if (Clazz_instanceOf(x,"java.util.Map")) return JU.Escape.escapeMap(x);
if (Clazz_instanceOf(x,"JU.BS")) return JU.Escape.eBS(x);
if (Clazz_instanceOf(x,"JU.P4")) return JU.Escape.eP4(x);
if (Clazz_instanceOf(x,"JU.T3")) return JU.Escape.eP(x);
if (JU.AU.isAP(x)) return JU.Escape.eAP(x);
if (JU.AU.isAS(x)) return JU.Escape.eAS(x, true);
if (Clazz_instanceOf(x,"JU.M34")) return JU.PT.rep(JU.PT.rep(x.toString(), "[\n  ", "["), "] ]", "]]");
if (JU.AU.isAFF(x)) {
var ff = x;
var sb =  new JU.SB().append("[");
var sep = "";
for (var i = 0; i < ff.length; i++) {
sb.append(sep).append(JU.Escape.eAF(ff[i]));
sep = ",";
}
sb.append("]");
return sb.toString();
}if (Clazz_instanceOf(x,"JU.A4")) {
var a = x;
return "{" + a.x + " " + a.y + " " + a.z + " " + (a.angle * 180 / 3.141592653589793) + "}";
}if (Clazz_instanceOf(x,"JU.Quat")) return x.toString();
var s = JU.PT.nonArrayString(x);
return (s == null ? JU.PT.toJSON(null, x) : s);
}, "~O");
c$.eV = Clazz_defineMethod(c$, "eV", 
function(list){
if (list == null) return JU.PT.esc("");
var s =  new JU.SB();
s.append("[");
for (var i = 0; i < list.size(); i++) {
if (i > 0) s.append(", ");
s.append(JU.Escape.escapeNice(list.get(i).asString()));
}
s.append("]");
return s.toString();
}, "JU.Lst");
c$.escapeMap = Clazz_defineMethod(c$, "escapeMap", 
function(ht){
var sb =  new JU.SB();
sb.append("{ ");
var sep = "";
for (var entry, $entry = ht.entrySet().iterator (); $entry.hasNext()&& ((entry = $entry.next ()) || true);) {
var key = entry.getKey();
sb.append(sep).append(JU.PT.esc(key)).appendC(':');
var val = entry.getValue();
if (!(Clazz_instanceOf(val,"JS.SV"))) val = JS.SV.getVariable(val);
sb.append((val).escape());
sep = ",";
}
sb.append(" }");
return sb.toString();
}, "java.util.Map");
c$.escapeFloatA = Clazz_defineMethod(c$, "escapeFloatA", 
function(f, asArray){
if (asArray) return JU.PT.toJSON(null, f);
var sb =  new JU.SB();
for (var i = 0; i < f.length; i++) {
if (i > 0) sb.appendC('\n');
sb.appendF(f[i]);
}
return sb.toString();
}, "~A,~B");
c$.escapeFloatAA = Clazz_defineMethod(c$, "escapeFloatAA", 
function(f, addSemi){
var sb =  new JU.SB();
var eol = (addSemi ? ";\n" : "\n");
for (var i = 0; i < f.length; i++) if (f[i] != null) {
if (i > 0) sb.append(eol);
for (var j = 0; j < f[i].length; j++) sb.appendF(f[i][j]).appendC('\t');

}
return sb.toString();
}, "~A,~B");
c$.escapeFloatAAA = Clazz_defineMethod(c$, "escapeFloatAAA", 
function(f, addSemi){
var sb =  new JU.SB();
var eol = (addSemi ? ";\n" : "\n");
if (f[0] == null || f[0][0] == null) return "0 0 0" + eol;
sb.appendI(f.length).append(" ").appendI(f[0].length).append(" ").appendI(f[0][0].length);
for (var i = 0; i < f.length; i++) if (f[i] != null) {
sb.append(eol);
for (var j = 0; j < f[i].length; j++) if (f[i][j] != null) {
sb.append(eol);
for (var k = 0; k < f[i][j].length; k++) sb.appendF(f[i][j][k]).appendC('\t');

}
}
return sb.toString();
}, "~A,~B");
c$.eAS = Clazz_defineMethod(c$, "eAS", 
function(list, nicely){
if (list == null) return JU.PT.esc("");
var s =  new JU.SB();
s.append("[");
for (var i = 0; i < list.length; i++) {
if (i > 0) s.append(", ");
s.append(nicely ? JU.Escape.escapeNice(list[i]) : JU.PT.esc(list[i]));
}
s.append("]");
return s.toString();
}, "~A,~B");
c$.eAI = Clazz_defineMethod(c$, "eAI", 
function(ilist){
if (ilist == null) return JU.PT.esc("");
var s =  new JU.SB();
s.append("[");
for (var i = 0; i < ilist.length; i++) {
if (i > 0) s.append(", ");
s.appendI(ilist[i]);
}
return s.append("]").toString();
}, "~A");
c$.eAD = Clazz_defineMethod(c$, "eAD", 
function(dlist){
if (dlist == null) return JU.PT.esc("");
var s =  new JU.SB();
s.append("[");
for (var i = 0; i < dlist.length; i++) {
if (i > 0) s.append(", ");
s.appendD(dlist[i]);
}
return s.append("]").toString();
}, "~A");
c$.eAF = Clazz_defineMethod(c$, "eAF", 
function(flist){
if (flist == null) return JU.PT.esc("");
var s =  new JU.SB();
s.append("[");
for (var i = 0; i < flist.length; i++) {
if (i > 0) s.append(", ");
s.appendF(flist[i]);
}
return s.append("]").toString();
}, "~A");
c$.eAP = Clazz_defineMethod(c$, "eAP", 
function(plist){
if (plist == null) return JU.PT.esc("");
var s =  new JU.SB();
s.append("[");
for (var i = 0; i < plist.length; i++) {
if (i > 0) s.append(", ");
s.append(JU.Escape.eP(plist[i]));
}
return s.append("]").toString();
}, "~A");
c$.escapeNice = Clazz_defineMethod(c$, "escapeNice", 
function(s){
if (s == null) return "null";
var f = JU.PT.parseFloatStrict(s);
return (Float.isNaN(f) ? JU.PT.esc(s) : s);
}, "~S");
c$.uABsM = Clazz_defineMethod(c$, "uABsM", 
function(s){
if (s.charAt(0) == '{') return JU.Escape.uP(s);
if ((JU.Escape.isStringArray(s) || s.startsWith("[{") && s.indexOf("[{") == s.lastIndexOf("[{")) && s.indexOf(',') < 0 && s.indexOf('.') < 0 && s.indexOf('-') < 0) return JU.BS.unescape(s);
if (s.startsWith("[[")) return JU.Escape.unescapeMatrix(s);
return s;
}, "~S");
c$.isStringArray = Clazz_defineMethod(c$, "isStringArray", 
function(s){
return s.startsWith("({") && s.lastIndexOf("({") == 0 && s.indexOf("})") == s.length - 2;
}, "~S");
c$.uP = Clazz_defineMethod(c$, "uP", 
function(strPoint){
if (strPoint == null || strPoint.length == 0) return strPoint;
var str = strPoint.$replace('\n', ' ').trim();
if (str.charAt(0) != '{' || str.charAt(str.length - 1) != '}') return strPoint;
var points =  Clazz_newFloatArray (5, 0);
var nPoints = 0;
str = str.substring(1, str.length - 1);
var next =  Clazz_newIntArray (1, 0);
for (; nPoints < 5; nPoints++) {
points[nPoints] = JU.PT.parseFloatNext(str, next);
if (Float.isNaN(points[nPoints])) {
if (next[0] >= str.length || str.charAt(next[0]) != ',') break;
next[0]++;
nPoints--;
}}
if (nPoints == 3) return JU.P3.new3(points[0], points[1], points[2]);
if (nPoints == 4) return JU.P4.new4(points[0], points[1], points[2], points[3]);
return strPoint;
}, "~S");
c$.unescapeMatrix = Clazz_defineMethod(c$, "unescapeMatrix", 
function(strMatrix){
if (strMatrix == null || strMatrix.length == 0) return strMatrix;
var str = strMatrix.$replace('\n', ' ').trim();
if (str.lastIndexOf("[[") != 0 || str.indexOf("]]") != str.length - 2) return strMatrix;
var points =  Clazz_newFloatArray (16, 0);
str = str.substring(2, str.length - 2).$replace('[', ' ').$replace(']', ' ').$replace(',', ' ');
var next =  Clazz_newIntArray (1, 0);
var nPoints = 0;
for (; nPoints < 16; nPoints++) {
points[nPoints] = JU.PT.parseFloatNext(str, next);
if (Float.isNaN(points[nPoints])) {
break;
}}
if (!Float.isNaN(JU.PT.parseFloatNext(str, next))) return strMatrix;
if (nPoints == 9) return JU.M3.newA9(points);
if (nPoints == 16) return JU.M4.newA16(points);
return strMatrix;
}, "~S");
c$.eBS = Clazz_defineMethod(c$, "eBS", 
function(bs){
return JU.BS.escape(bs, '(', ')');
}, "JU.BS");
c$.eBond = Clazz_defineMethod(c$, "eBond", 
function(bs){
return JU.BS.escape(bs, '[', ']');
}, "JU.BS");
c$.toReadable = Clazz_defineMethod(c$, "toReadable", 
function(name, info){
var sb =  new JU.SB();
var sep = "";
if (info == null) return "null";
if (JU.PT.isNonStringPrimitive(info)) return JU.Escape.packageReadable(name, null, info.toString());
if ((typeof(info)=='string')) return JU.Escape.packageReadable(name, null, JU.PT.esc(info));
if (Clazz_instanceOf(info,"JS.SV")) return JU.Escape.packageReadable(name, null, (info).escape());
if (JU.AU.isAS(info)) {
sb.append("[");
var imax = (info).length;
for (var i = 0; i < imax; i++) {
sb.append(sep).append(JU.Escape.toReadable(null, (info)[i]));
sep = ",";
}
sb.append("]");
return JU.Escape.packageReadableSb(name, "String[" + imax + "]", sb);
}if (JU.AU.isAI(info)) {
sb.append("[");
var imax = (info).length;
for (var i = 0; i < imax; i++) {
sb.append(sep).appendI((info)[i]);
sep = ",";
}
sb.append("]");
return JU.Escape.packageReadableSb(name, "int[" + imax + "]", sb);
}if (JU.AU.isAF(info)) {
sb.append("[");
var imax = (info).length;
for (var i = 0; i < imax; i++) {
sb.append(sep).appendF((info)[i]);
sep = ",";
}
sb.append("]");
return JU.Escape.packageReadableSb(name, "float[" + imax + "]", sb);
}if (JU.AU.isAD(info)) {
sb.append("[");
var imax = (info).length;
for (var i = 0; i < imax; i++) {
sb.append(sep).appendD((info)[i]);
sep = ",";
}
sb.append("]");
return JU.Escape.packageReadableSb(name, "double[" + imax + "]", sb);
}if (JU.AU.isAP(info)) {
sb.append("[");
var imax = (info).length;
for (var i = 0; i < imax; i++) {
sb.append(sep).append(JU.Escape.eP((info)[i]));
sep = ",";
}
sb.append("]");
return JU.Escape.packageReadableSb(name, "point3f[" + imax + "]", sb);
}if (JU.AU.isASS(info)) {
sb.append("[");
var imax = (info).length;
for (var i = 0; i < imax; i++) {
sb.append(sep).append(JU.Escape.toReadable(null, (info)[i]));
sep = ",\n";
}
sb.append("]");
return JU.Escape.packageReadableSb(name, "String[" + imax + "][]", sb);
}if (JU.AU.isAII(info)) {
sb.append("[");
var imax = (info).length;
for (var i = 0; i < imax; i++) {
sb.append(sep).append(JU.Escape.toReadable(null, (info)[i]));
sep = ",";
}
sb.append("]");
return JU.Escape.packageReadableSb(name, "int[" + imax + "][]", sb);
}if (JU.AU.isAFF(info)) {
sb.append("[\n");
var imax = (info).length;
for (var i = 0; i < imax; i++) {
sb.append(sep).append(JU.Escape.toReadable(null, (info)[i]));
sep = ",\n";
}
sb.append("]");
return JU.Escape.packageReadableSb(name, "float[][]", sb);
}if (JU.AU.isADD(info)) {
sb.append("[\n");
var imax = (info).length;
for (var i = 0; i < imax; i++) {
sb.append(sep).append(JU.Escape.toReadable(null, (info)[i]));
sep = ",\n";
}
sb.append("]");
return JU.Escape.packageReadableSb(name, "double[][]", sb);
}if (Clazz_instanceOf(info,"JU.Lst")) {
var imax = (info).size();
for (var i = 0; i < imax; i++) {
sb.append(JU.Escape.toReadable(name + "[" + (i + 1) + "]", (info).get(i)));
}
return JU.Escape.packageReadableSb(name, "List[" + imax + "]", sb);
}if (Clazz_instanceOf(info,"JU.M34") || Clazz_instanceOf(info,"JU.T3") || Clazz_instanceOf(info,"JU.P4") || Clazz_instanceOf(info,"JU.A4")) {
sb.append(JU.Escape.e(info));
return JU.Escape.packageReadableSb(name, null, sb);
}if (Clazz_instanceOf(info,"java.util.Map")) {
var e = (info).keySet().iterator();
while (e.hasNext()) {
var key = e.next();
sb.append(JU.Escape.toReadable((name == null ? "" : name + ".") + key, (info).get(key)));
}
return sb.toString();
}return JU.Escape.packageReadable(name, null, JU.PT.toJSON(null, info));
}, "~S,~O");
c$.packageReadableSb = Clazz_defineMethod(c$, "packageReadableSb", 
function(infoName, infoType, sb){
return JU.Escape.packageReadable(infoName, infoType, sb.toString());
}, "~S,~S,JU.SB");
c$.packageReadable = Clazz_defineMethod(c$, "packageReadable", 
function(infoName, infoType, info){
var s = (infoType == null ? "" : infoType + "\t");
if (infoName == null) return s + info;
return "\n" + infoName + "\t" + (infoType == null ? "" : "*" + infoType + "\t") + info;
}, "~S,~S,~S");
c$.escapeModelFileNumber = Clazz_defineMethod(c$, "escapeModelFileNumber", 
function(iv){
return "" + (Clazz_doubleToInt(iv / 1000000)) + "." + (iv % 1000000);
}, "~N");
c$.encapsulateData = Clazz_defineMethod(c$, "encapsulateData", 
function(name, data, depth){
var s;
switch (depth) {
case 1:
s = JU.Escape.escapeFloatA(data, false) + ";\n";
break;
case 2:
s = JU.Escape.escapeFloatAA(data, true) + ";\n";
break;
case 3:
s = JU.Escape.escapeFloatAAA(data, true) + ";\n";
break;
default:
s = data.toString();
break;
}
return "  DATA \"" + name + "\"\n" + s + "    END \"" + name + "\";\n";
}, "~S,~O,~N");
c$.unescapeUnicode = Clazz_defineMethod(c$, "unescapeUnicode", 
function(s){
var ichMax = s.length;
var sb = JU.SB.newN(ichMax);
var ich = 0;
while (ich < ichMax) {
var ch = s.charAt(ich++);
if (ch == '\\' && ich < ichMax) {
ch = s.charAt(ich++);
switch ((ch).charCodeAt(0)) {
case 117:
if (ich < ichMax) {
var unicode = 0;
for (var k = 4; --k >= 0 && ich < ichMax; ) {
var chT = s.charAt(ich);
var hexit = JU.Escape.getHexitValue(chT);
if (hexit < 0) break;
unicode <<= 4;
unicode += hexit;
++ich;
}
ch = String.fromCharCode(unicode);
}}
}sb.appendC(ch);
}
return sb.toString();
}, "~S");
c$.getHexitValue = Clazz_defineMethod(c$, "getHexitValue", 
function(ch){
if (ch.charCodeAt(0) >= 48 && ch.charCodeAt(0) <= 57) return ch.charCodeAt(0) - 48;
 else if (ch.charCodeAt(0) >= 97 && ch.charCodeAt(0) <= 102) return 10 + ch.charCodeAt(0) - 97;
 else if (ch.charCodeAt(0) >= 65 && ch.charCodeAt(0) <= 70) return 10 + ch.charCodeAt(0) - 65;
 else return -1;
}, "~S");
c$.unescapeStringArray = Clazz_defineMethod(c$, "unescapeStringArray", 
function(data){
if (data == null || !data.startsWith("[") || !data.endsWith("]")) return null;
var v =  new JU.Lst();
var next =  Clazz_newIntArray (1, 0);
next[0] = 1;
while (next[0] < data.length) {
var s = JU.PT.getQuotedStringNext(data, next);
if (s == null) return null;
v.addLast(JU.PT.rep(s, "\\\"", "\""));
while (next[0] < data.length && data.charAt(next[0]) != '"') next[0]++;

}
return v.toArray( new Array(v.size()));
}, "~S");
c$.isAV = Clazz_defineMethod(c$, "isAV", 
function(x){
{
return Clazz_instanceOf(x[0], JS.SV);
}}, "~O");
c$.escapeHelical = Clazz_defineMethod(c$, "escapeHelical", 
function(id, tokType, a, b, pts){
switch (tokType) {
case 134217751:
return (pts == null ?  new JU.P3() : pts[0]);
case 1073741854:
case 1665140738:
return (pts == null ?  new JU.V3() : pts[tokType == 1073741854 ? 1 : 2]);
case 134217729:
return Float.$valueOf(pts == null ? NaN : pts[3].x);
case 135176:
return (pts == null ? "" : "draw ID \"" + id + "\" VECTOR " + JU.Escape.eP(pts[0]) + " " + JU.Escape.eP(pts[1]) + " color " + (pts[3].x < 0 ? "{255.0 200.0 0.0}" : "{255.0 0.0 128.0}"));
case 1745489939:
return (pts == null ? "" : "measure " + JU.Escape.eP(a) + JU.Escape.eP(pts[0]) + JU.Escape.eP(pts[4])) + JU.Escape.eP(b);
default:
return (pts == null ?  new Array(0) : pts);
}
}, "~S,~N,JU.P3,JU.P3,~A");
});
;//5.0.1-v7 Mon Aug 17 10:07:10 MDT 2026
Clazz_declarePackage("JU");
Clazz_load(["J.api.JmolGraphicsInterface", "JU.Normix"], "JU.GData", ["JU.AU", "$.P3", "$.V3", "JU.C", "$.Font", "$.Shader"], function(){
var c$ = Clazz_decorateAsClass(function(){
this.apiPlatform = null;
this.translucentCoverOnly = false;
this.currentlyRendering = false;
this.antialiasEnabled = false;
this.windowWidth = 0;
this.windowHeight = 0;
this.displayMinX = 0;
this.displayMaxX = 0;
this.displayMinY = 0;
this.displayMaxY = 0;
this.displayMinX2 = 0;
this.displayMaxX2 = 0;
this.displayMinY2 = 0;
this.displayMaxY2 = 0;
this.antialiasThisFrame = false;
this.inGreyscaleMode = false;
this.changeableColixMap = null;
this.backgroundImage = null;
this.newWindowWidth = 0;
this.newWindowHeight = 0;
this.newAntialiasing = false;
this.bgcolor = 0;
this.contrastColix = 0;
this.xLast = 0;
this.yLast = 0;
this.slab = 0;
this.depth = 0;
this.width = 0;
this.height = 0;
this.ambientOcclusion = 0;
this.colixCurrent = 0;
this.argbCurrent = 0;
this.ht3 = 0;
this.isPass2 = false;
this.textY = 0;
this.bufferSize = 0;
this.shader = null;
this.vwr = null;
this.graphicsForMetrics = null;
this.currentFont = null;
this.argbNoisyUp = 0;
this.argbNoisyDn = 0;
this.transformedVectors = null;
Clazz_instantialize(this, arguments);}, JU, "GData", null, J.api.JmolGraphicsInterface);
Clazz_prepareFields (c$, function(){
this.changeableColixMap =  Clazz_newShortArray (16, 0);
this.transformedVectors =  new Array(JU.GData.normixCount);
});
Clazz_makeConstructor(c$, 
function(){
this.shader =  new JU.Shader();
});
Clazz_defineMethod(c$, "initialize", 
function(vwr, apiPlatform){
this.vwr = vwr;
this.apiPlatform = apiPlatform;
}, "JV.Viewer,J.api.GenericPlatform");
Clazz_defineMethod(c$, "setDepth", 
function(depthValue){
this.depth = depthValue < 0 ? 0 : depthValue;
}, "~N");
Clazz_overrideMethod(c$, "setSlab", 
function(slabValue){
this.slab = Math.max(0, slabValue);
}, "~N");
Clazz_overrideMethod(c$, "setSlabAndZShade", 
function(slab, depth, zSlab, zDepth, zPower){
this.setSlab(slab);
this.setDepth(depth);
}, "~N,~N,~N,~N,~N");
Clazz_defineMethod(c$, "setAmbientOcclusion", 
function(value){
this.ambientOcclusion = value;
}, "~N");
Clazz_overrideMethod(c$, "isAntialiased", 
function(){
return this.antialiasThisFrame;
});
Clazz_defineMethod(c$, "getChangeableColix", 
function(id, argb){
if (id >= this.changeableColixMap.length) this.changeableColixMap = JU.AU.arrayCopyShort(this.changeableColixMap, id + 16);
if (this.changeableColixMap[id] == 0) this.changeableColixMap[id] = JU.C.getColix(argb);
return (id | -32768);
}, "~N,~N");
Clazz_defineMethod(c$, "changeColixArgb", 
function(id, argb){
if (id < this.changeableColixMap.length && this.changeableColixMap[id] != 0) this.changeableColixMap[id] = JU.C.getColix(argb);
}, "~N,~N");
Clazz_defineMethod(c$, "getColorArgbOrGray", 
function(colix){
if (colix == 3) return JU.C.getArgb(this.contrastColix);
if (colix < 0) colix = this.changeableColixMap[colix & 2047];
return (this.inGreyscaleMode ? JU.C.getArgbGreyscale(colix) : JU.C.getArgb(colix));
}, "~N");
Clazz_defineMethod(c$, "fixChangeableColix", 
function(colix){
return (colix >= 0 ? colix : (this.changeableColixMap[colix & 2047] | colix & 30720));
}, "~N");
Clazz_defineMethod(c$, "getShades", 
function(colix){
if (colix < 0) colix = this.changeableColixMap[colix & 2047];
return (this.inGreyscaleMode ? this.shader.getShadesG(colix) : this.shader.getShades(colix));
}, "~N");
Clazz_defineMethod(c$, "setGreyscaleMode", 
function(greyscaleMode){
this.inGreyscaleMode = greyscaleMode;
}, "~B");
Clazz_defineMethod(c$, "getSpecularPower", 
function(){
return this.shader.specularPower;
});
Clazz_defineMethod(c$, "setSpecularPower", 
function(val){
if (val < 0) {
this.setSpecularExponent(-val);
return;
}if (this.shader.specularPower == val) return;
this.shader.specularPower = val;
this.shader.intenseFraction = val / 100;
this.shader.flushCaches();
}, "~N");
Clazz_defineMethod(c$, "getSpecularPercent", 
function(){
return this.shader.specularPercent;
});
Clazz_defineMethod(c$, "setSpecularPercent", 
function(val){
if (this.shader.specularPercent == val) return;
this.shader.specularPercent = val;
this.shader.specularFactor = val / 100;
this.shader.flushCaches();
}, "~N");
Clazz_defineMethod(c$, "getSpecularExponent", 
function(){
return this.shader.specularExponent;
});
Clazz_defineMethod(c$, "setSpecularExponent", 
function(val){
if (this.shader.specularExponent == val) return;
this.shader.specularExponent = val;
this.shader.phongExponent = Clazz_doubleToInt(Math.pow(2, val));
this.shader.usePhongExponent = false;
this.shader.flushCaches();
}, "~N");
Clazz_defineMethod(c$, "getPhongExponent", 
function(){
return this.shader.phongExponent;
});
Clazz_defineMethod(c$, "setPhongExponent", 
function(val){
if (this.shader.phongExponent == val && this.shader.usePhongExponent) return;
this.shader.phongExponent = val;
var x = (Math.log(val) / Math.log(2));
this.shader.usePhongExponent = (x != Clazz_floatToInt(x));
if (!this.shader.usePhongExponent) this.shader.specularExponent = Clazz_floatToInt(x);
this.shader.flushCaches();
}, "~N");
Clazz_defineMethod(c$, "getDiffusePercent", 
function(){
return this.shader.diffusePercent;
});
Clazz_defineMethod(c$, "setDiffusePercent", 
function(val){
if (this.shader.diffusePercent == val) return;
this.shader.diffusePercent = val;
this.shader.diffuseFactor = val / 100;
this.shader.flushCaches();
}, "~N");
Clazz_defineMethod(c$, "getAmbientPercent", 
function(){
return this.shader.ambientPercent;
});
Clazz_defineMethod(c$, "setAmbientPercent", 
function(val){
if (this.shader.ambientPercent == val) return;
this.shader.ambientPercent = val;
this.shader.ambientFraction = val / 100;
this.shader.flushCaches();
}, "~N");
Clazz_defineMethod(c$, "getSpecular", 
function(){
return this.shader.specularOn;
});
Clazz_defineMethod(c$, "setSpecular", 
function(val){
if (this.shader.specularOn == val) return;
this.shader.specularOn = val;
this.shader.flushCaches();
}, "~B");
Clazz_defineMethod(c$, "setCel", 
function(val){
this.shader.setCel(val, this.shader.celPower, this.bgcolor);
}, "~B");
Clazz_defineMethod(c$, "getCel", 
function(){
return this.shader.celOn;
});
Clazz_defineMethod(c$, "getCelPower", 
function(){
return this.shader.celPower;
});
Clazz_defineMethod(c$, "setCelPower", 
function(celPower){
this.shader.setCel(this.shader.celOn || this.shader.celPower == 0, celPower, this.bgcolor);
}, "~N");
Clazz_defineMethod(c$, "getLightSource", 
function(){
return this.shader.lightSource;
});
Clazz_defineMethod(c$, "isClipped3", 
function(x, y, z){
return (x < 0 || x >= this.width || y < 0 || y >= this.height || z < this.slab || z > this.depth);
}, "~N,~N,~N");
Clazz_defineMethod(c$, "isClipped", 
function(x, y){
return (x < 0 || x >= this.width || y < 0 || y >= this.height);
}, "~N,~N");
Clazz_overrideMethod(c$, "isInDisplayRange", 
function(x, y){
return (x >= this.displayMinX && x < this.displayMaxX && y >= this.displayMinY && y < this.displayMaxY);
}, "~N,~N");
Clazz_overrideMethod(c$, "isClippedXY", 
function(diameter, x, y){
var r = (diameter + 1) >> 1;
return (x < -r || x >= this.width + r || y < -r || y >= this.height + r);
}, "~N,~N,~N");
Clazz_defineMethod(c$, "isClippedZ", 
function(z){
return (z != -2147483648 && (z < this.slab || z > this.depth));
}, "~N");
Clazz_defineMethod(c$, "clipCode3", 
function(x, y, z){
var code = 0;
if (x < 0) code |= (x < this.displayMinX2 ? -1 : 8);
 else if (x >= this.width) code |= (x > this.displayMaxX2 ? -1 : 4);
if (y < 0) code |= (y < this.displayMinY2 ? -1 : 2);
 else if (y >= this.height) code |= (y > this.displayMaxY2 ? -1 : 1);
if (z < this.slab) code |= 32;
 else if (z > this.depth) code |= 16;
return code;
}, "~N,~N,~N");
Clazz_defineMethod(c$, "clipCode", 
function(z){
var code = 0;
if (z < this.slab) code |= 32;
 else if (z > this.depth) code |= 16;
return code;
}, "~N");
Clazz_defineMethod(c$, "getFont3D", 
function(fontSize){
return JU.Font.createFont3D(0, 0, fontSize, fontSize, 0, this.apiPlatform, this.graphicsForMetrics);
}, "~N");
Clazz_defineMethod(c$, "getFont3DFS", 
function(fontFace, fontSize){
return JU.Font.createFont3D(JU.Font.getFontFaceID(fontFace), 0, fontSize, fontSize, 0, this.apiPlatform, this.graphicsForMetrics);
}, "~S,~N");
Clazz_defineMethod(c$, "getFontFidFS", 
function(fontFace, fontSize){
return this.getFont3DFSS(fontFace, "Bold", fontSize).fid;
}, "~S,~N");
Clazz_defineMethod(c$, "getFont3DFSS", 
function(fontFace, fontStyle, fontSize){
var iStyle = JU.Font.getFontStyleID(fontStyle);
if (iStyle < 0) iStyle = 0;
return JU.Font.createFont3D(JU.Font.getFontFaceID(fontFace), iStyle, fontSize, fontSize, 0, this.apiPlatform, this.graphicsForMetrics);
}, "~S,~S,~N");
Clazz_defineMethod(c$, "getFont3DScaled", 
function(font, scale){
var newScale = font.fontSizeNominal * scale;
return (newScale == font.fontSize ? font : JU.Font.createFont3D(font.idFontFace, font.idFontStyle, newScale, font.fontSizeNominal, font.fontSizeAngstroms, this.apiPlatform, this.graphicsForMetrics));
}, "JU.Font,~N");
Clazz_defineMethod(c$, "getFontFidI", 
function(fontSize){
return this.getFont3D(fontSize).fid;
}, "~N");
Clazz_defineMethod(c$, "getFont3DCurrent", 
function(){
return this.currentFont;
});
Clazz_defineMethod(c$, "setFont", 
function(font3d){
}, "JU.Font");
Clazz_defineMethod(c$, "setFontBold", 
function(fontFace, fontSize){
this.setFont(this.getFont3DFSS(fontFace, "Bold", fontSize));
}, "~S,~N");
Clazz_defineMethod(c$, "setBackgroundTransparent", 
function(TF){
}, "~B");
Clazz_defineMethod(c$, "setBackgroundArgb", 
function(argb){
this.bgcolor = argb;
this.setCel(this.shader.celOn);
}, "~N");
Clazz_defineMethod(c$, "setBackgroundImage", 
function(image){
this.backgroundImage = image;
}, "~O");
Clazz_defineMethod(c$, "setWindowParameters", 
function(width, height, antialias){
this.setWinParams(width, height, antialias);
}, "~N,~N,~B");
Clazz_defineMethod(c$, "setWinParams", 
function(width, height, antialias){
this.newWindowWidth = width;
this.newWindowHeight = height;
this.newAntialiasing = antialias;
}, "~N,~N,~B");
Clazz_defineMethod(c$, "setNewWindowParametersForExport", 
function(){
this.windowWidth = this.newWindowWidth;
this.windowHeight = this.newWindowHeight;
this.setWidthHeight(false);
});
Clazz_defineMethod(c$, "setWidthHeight", 
function(isAntialiased){
this.width = this.windowWidth;
this.height = this.windowHeight;
if (isAntialiased) {
this.width <<= 1;
this.height <<= 1;
}this.xLast = this.width - 1;
this.yLast = this.height - 1;
this.displayMinX = -(this.width >> 1);
this.displayMaxX = this.width - this.displayMinX;
this.displayMinY = -(this.height >> 1);
this.displayMaxY = this.height - this.displayMinY;
this.displayMinX2 = this.displayMinX << 2;
this.displayMaxX2 = this.displayMaxX << 2;
this.displayMinY2 = this.displayMinY << 2;
this.displayMaxY2 = this.displayMaxY << 2;
this.ht3 = this.height * 3;
this.bufferSize = this.width * this.height;
}, "~B");
Clazz_defineMethod(c$, "beginRendering", 
function(stereoRotationMatrix, translucentMode, isImageWrite, renderLow){
}, "JU.M3,~B,~B,~B");
Clazz_defineMethod(c$, "endRendering", 
function(){
});
Clazz_defineMethod(c$, "snapshotAnaglyphChannelBytes", 
function(){
});
Clazz_defineMethod(c$, "getScreenImage", 
function(isImageWrite){
return null;
}, "~B");
Clazz_defineMethod(c$, "releaseScreenImage", 
function(){
});
Clazz_defineMethod(c$, "applyAnaglygh", 
function(stereoMode, stereoColors){
}, "J.c.STER,~A");
Clazz_defineMethod(c$, "setPass2", 
function(antialias){
return false;
}, "~B");
Clazz_defineMethod(c$, "destroy", 
function(){
});
Clazz_defineMethod(c$, "clearFontCache", 
function(){
});
Clazz_defineMethod(c$, "drawQuadrilateralBits", 
function(jmolRenderer, colix, screenA, screenB, screenC, screenD){
jmolRenderer.drawLineBits(colix, colix, screenA, screenB);
jmolRenderer.drawLineBits(colix, colix, screenB, screenC);
jmolRenderer.drawLineBits(colix, colix, screenC, screenD);
jmolRenderer.drawLineBits(colix, colix, screenD, screenA);
}, "J.api.JmolRendererInterface,~N,JU.P3,JU.P3,JU.P3,JU.P3");
Clazz_defineMethod(c$, "drawTriangleBits", 
function(renderer, screenA, colixA, screenB, colixB, screenC, colixC, check){
if ((check & 1) == 1) renderer.drawLineBits(colixA, colixB, screenA, screenB);
if ((check & 2) == 2) renderer.drawLineBits(colixB, colixC, screenB, screenC);
if ((check & 4) == 4) renderer.drawLineBits(colixC, colixA, screenC, screenA);
}, "J.api.JmolRendererInterface,JU.P3,~N,JU.P3,~N,JU.P3,~N,~N");
Clazz_defineMethod(c$, "plotImage", 
function(x, y, z, image, jmolRenderer, bgcolix, width, height){
}, "~N,~N,~N,~O,J.api.JmolRendererInterface,~N,~N,~N");
Clazz_defineMethod(c$, "plotText", 
function(x, y, z, colorArgbOrGray, bgColor, text, font3d, jmolRenderer){
}, "~N,~N,~N,~N,~N,~S,JU.Font,J.api.JmolRendererInterface");
Clazz_defineMethod(c$, "renderBackground", 
function(jmolRenderer){
}, "J.api.JmolRendererInterface");
Clazz_defineMethod(c$, "setColor", 
function(argb){
this.argbCurrent = this.argbNoisyUp = this.argbNoisyDn = argb;
}, "~N");
Clazz_defineMethod(c$, "setC", 
function(colix){
return true;
}, "~N");
Clazz_defineMethod(c$, "isDirectedTowardsCamera", 
function(normix){
return (normix < 0) || (this.transformedVectors[normix].z > 0);
}, "~N");
c$.roundInt = Clazz_defineMethod(c$, "roundInt", 
function(a){
{
return a;
}}, "~N");
Clazz_defineMethod(c$, "clear", 
function(){
});
Clazz_overrideMethod(c$, "renderAllStrings", 
function(jmolRenderer){
}, "~O");
Clazz_defineMethod(c$, "addRenderer", 
function(tok){
}, "~N");
c$.getHermiteList = Clazz_defineMethod(c$, "getHermiteList", 
function(tension, p0, p1, p2, p3, p4, list, index0, n, isPt){
var nPoints = n + 1;
var fnPoints = n - 1;
var x1 = p1.x;
var y1 = p1.y;
var z1 = p1.z;
var x2 = p2.x;
var y2 = p2.y;
var z2 = p2.z;
var xT1 = ((x2 - p0.x) * tension) / 8;
var yT1 = ((y2 - p0.y) * tension) / 8;
var zT1 = ((z2 - p0.z) * tension) / 8;
var xT2 = ((p3.x - x1) * tension) / 8;
var yT2 = ((p3.y - y1) * tension) / 8;
var zT2 = ((p3.z - z1) * tension) / 8;
var xT3 = ((p4.x - x2) * tension) / 8;
var yT3 = ((p4.y - y2) * tension) / 8;
var zT3 = ((p4.z - z2) * tension) / 8;
list[index0] = p1;
for (var i = 0; i < nPoints; i++) {
var s = i / fnPoints;
if (i == nPoints - 1) {
x1 = x2;
y1 = y2;
z1 = z2;
x2 = p3.x;
y2 = p3.y;
z2 = p3.z;
xT1 = xT2;
yT1 = yT2;
zT1 = zT2;
xT2 = xT3;
yT2 = yT3;
zT2 = zT3;
s -= 1;
}var s2 = s * s;
var s3 = s2 * s;
var h1 = 2 * s3 - 3 * s2 + 1;
var h2 = -2 * s3 + 3 * s2;
var h3 = s3 - 2 * s2 + s;
var h4 = s3 - s2;
var x = (h1 * x1 + h2 * x2 + h3 * xT1 + h4 * xT2);
var y = (h1 * y1 + h2 * y2 + h3 * yT1 + h4 * yT2);
var z = (h1 * z1 + h2 * z2 + h3 * zT1 + h4 * zT2);
list[index0 + i] = (isPt ? JU.P3.new3(x, y, z) : JU.V3.new3(x, y, z));
}
}, "~N,JU.T3,JU.T3,JU.T3,JU.T3,JU.T3,~A,~N,~N,~B");
Clazz_defineMethod(c$, "setTextPosition", 
function(y){
this.textY = y;
}, "~N");
Clazz_defineMethod(c$, "getTextPosition", 
function(){
return this.textY;
});
Clazz_defineMethod(c$, "getTransformedVertexVectors", 
function(){
return this.transformedVectors;
});
Clazz_overrideMethod(c$, "drawLinePixels", 
function(sA, sB, z, zslab){
return;
}, "JU.P3i,JU.P3i,~N,~N");
c$.getSlabObjectType = Clazz_defineMethod(c$, "getSlabObjectType", 
function(tok, data, isCap, colorData){
return  Clazz_newArray(-1, [Integer.$valueOf(tok), data, Boolean.$valueOf(isCap), colorData]);
}, "~N,~O,~B,~O");
c$.getSlabWithinRange = Clazz_defineMethod(c$, "getSlabWithinRange", 
function(min, max){
return  Clazz_newArray(-1, [Integer.$valueOf(1073742114),  Clazz_newArray(-1, [Float.$valueOf(min), Float.$valueOf(max)]), Boolean.FALSE, null]);
}, "~N,~N");
c$.normixCount = JU.Normix.getNormixCount();
});
;//5.0.1-v7 Mon Aug 24 10:01:38 CDT 2026
Clazz_declarePackage("JU");
Clazz_load(["javajs.api.JSInterface", "J.api.JmolAppletInterface", "$.JmolStatusListener"], "JU.GenericApplet", ["java.net.URL", "java.util.Hashtable", "JU.Lst", "$.PT", "$.SB", "J.awtjs2d.Platform", "J.c.CBK", "J.i18n.GT", "JU.Logger", "$.Parser", "JV.JC", "$.Viewer"], function(){
var c$ = Clazz_decorateAsClass(function(){
this.codeBase = null;
this.documentBase = null;
this.isSigned = false;
this.language = null;
this.doTranslate = true;
this.haveDocumentAccess = false;
this.isStereoSlave = false;
this.mayScript = false;
this.htmlName = null;
this.fullName = null;
this.statusForm = null;
this.statusText = null;
this.statusTextarea = null;
this.gRight = null;
this.viewer = null;
this.b$ = null;
this.vwrOptions = null;
this.haveNotifiedError = false;
this.appletObject = null;
this.loading = false;
this.syncId = null;
this.outputBuffer = null;
this.htParams = null;
Clazz_instantialize(this, arguments);}, JU, "GenericApplet", null, [javajs.api.JSInterface, J.api.JmolAppletInterface, J.api.JmolStatusListener]);
Clazz_defineMethod(c$, "setStereoGraphics", 
function(isStereo){
{
if (isStereo)
return vwr.apiPlatform.context;
}return null;
}, "~B");
Clazz_overrideMethod(c$, "processMouseEvent", 
function(id, x, y, modifiers, time){
return this.viewer.processMouseEvent(id, x, y, modifiers, time);
}, "~N,~N,~N,~N,~N");
Clazz_overrideMethod(c$, "processKeyEvent", 
function(event){
this.viewer.processKeyEvent(event);
}, "~O");
Clazz_overrideMethod(c$, "setDisplay", 
function(canvas){
this.viewer.setDisplay(canvas);
}, "~O");
Clazz_overrideMethod(c$, "setStatusDragDropped", 
function(mode, x, y, fileName, retType){
return this.viewer.setStatusDragDropped(mode, x, y, fileName, retType);
}, "~N,~N,~N,~S,~A");
Clazz_overrideMethod(c$, "startHoverWatcher", 
function(enable){
this.viewer.startHoverWatcher(enable);
}, "~B");
Clazz_overrideMethod(c$, "update", 
function(){
this.viewer.updateJS();
});
Clazz_overrideMethod(c$, "openFileAsyncSpecial", 
function(fileName, flags){
this.viewer.openFileAsyncSpecial(fileName, flags);
}, "~S,~N");
Clazz_overrideMethod(c$, "openFileAsyncSpecialType", 
function(fileName, flags, type){
this.viewer.openFileAsyncSpecialType(fileName, flags, type);
}, "~S,~N,~S");
Clazz_overrideMethod(c$, "processTwoPointGesture", 
function(touches){
this.viewer.processTwoPointGesture(touches);
}, "~A");
Clazz_overrideMethod(c$, "setScreenDimension", 
function(width, height){
this.viewer.setScreenDimension(width, height);
}, "~N,~N");
Clazz_defineMethod(c$, "resizeDisplay", 
function(width, height){
var jmol = J.awtjs2d.Platform.Jmol();
jmol.resizeApplet(this.viewer.html5Applet,  Clazz_newIntArray(-1, [width, height]));
}, "~N,~N");
Clazz_defineMethod(c$, "init", 
function(applet){
this.b$ =  new java.util.Hashtable();
if (JU.GenericApplet.htRegistry == null) JU.GenericApplet.htRegistry =  new java.util.Hashtable();
this.appletObject = applet;
this.htmlName = JU.PT.split("" + this.getJmolParameter("name"), "_object")[0];
this.syncId = this.getJmolParameter("syncId");
this.fullName = this.htmlName + "__" + this.syncId + "__";
System.out.println("Jmol JavaScript applet " + this.fullName + " initializing");
var iLevel = ((this.getValue("logLevel", (this.getBooleanValue("debug", false) ? "5" : "4"))).charAt(0)).charCodeAt(0) - 48;
if (iLevel != 4) System.out.println("setting logLevel=" + iLevel + " -- To change, use script \"set logLevel [0-5]\"");
JU.Logger.setLogLevel(iLevel);
J.i18n.GT.ignoreApplicationBundle();
this.initOptions();
JU.GenericApplet.checkIn(this.fullName, this.appletObject);
this.initApplication();
}, "~O");
Clazz_defineMethod(c$, "initApplication", 
function(){
this.vwrOptions.put("applet", Boolean.TRUE);
if (this.getJmolParameter("statusListener") == null) this.vwrOptions.put("statusListener", this);
this.language = this.getJmolParameter("language");
if (this.language != null) this.vwrOptions.put("language", this.language);
this.viewer =  new JV.Viewer(this.vwrOptions);
this.viewer.pushHoldRepaint();
var emulate = this.getValueLowerCase("emulate", "jmol");
this.setStringProperty("defaults", emulate.equals("chime") ? "RasMol" : "Jmol");
this.setStringProperty("backgroundColor", this.getValue("bgcolor", this.getValue("boxbgcolor", "black")));
this.viewer.setBooleanProperty("frank", true);
this.loading = true;
for (var item, $item = 0, $$item = J.c.CBK.values(); $item < $$item.length && ((item = $$item[$item]) || true); $item++) {
var name = item.name();
var o = this.getValue(name + "Callback", null);
if (o != null) {
if ((typeof(o)=='string')) {
this.setStringProperty(name + "Callback", o);
} else {
var def = null;
{
def = "Info." + o.name;
}this.setStringProperty(name + "Callback", def);
this.setCallback(name, o);
}}}
this.loading = false;
if (this.language != null) System.out.print("requested language=" + this.language + "; ");
this.doTranslate = (!"none".equals(this.language) && this.getBooleanValue("doTranslate", true));
this.language = J.i18n.GT.getLanguage();
System.out.println("language=" + this.language);
if (this.b$.get(J.c.CBK.SCRIPT) == null && this.b$.get(J.c.CBK.ERROR) == null) if (this.b$.get(J.c.CBK.MESSAGE) != null || this.statusForm != null || this.statusText != null) {
if (this.doTranslate && (this.getValue("doTranslate", null) == null)) {
this.doTranslate = false;
JU.Logger.warn("Note -- Presence of message callback disables disable translation; to enable message translation use jmolSetTranslation(true) prior to jmolApplet()");
}if (this.doTranslate) JU.Logger.warn("Note -- Automatic language translation may affect parsing of message callbacks messages; use scriptCallback or errorCallback to process errors");
}if (!this.doTranslate) {
J.i18n.GT.setDoTranslate(false);
JU.Logger.warn("Note -- language translation disabled");
}if (!this.getBooleanValue("popupMenu", true)) this.viewer.getProperty("DATA_API", "disablePopupMenu", null);
var menuFile = this.getJmolParameter("menuFile");
if (menuFile != null) this.viewer.setMenu(menuFile, true);
var script = this.getValue("script", "");
var loadParam = this.getValue("loadInline", null);
if (loadParam == null) {
if ((loadParam = this.getValue("load", null)) != null) script = "load \"" + loadParam + "\";" + script;
loadParam = null;
}this.viewer.popHoldRepaint("applet init");
if (loadParam != null && this.viewer.loadInline(loadParam) != null) script = "";
if (script.length > 0) this.scriptProcessor(script, null, 1);
this.viewer.notifyStatusReady(true);
});
Clazz_overrideMethod(c$, "destroy", 
function(){
this.gRight = null;
this.viewer.notifyStatusReady(false);
this.viewer = null;
JU.GenericApplet.checkOut(this.fullName);
});
Clazz_defineMethod(c$, "getBooleanValue", 
function(propertyName, defaultValue){
var value = this.getValue(propertyName, defaultValue ? "true" : "");
return (value.equalsIgnoreCase("true") || value.equalsIgnoreCase("on") || value.equalsIgnoreCase("yes"));
}, "~S,~B");
Clazz_defineMethod(c$, "getValue", 
function(propertyName, defaultValue){
var s = this.getJmolParameter(propertyName);
System.out.println("Jmol getValue " + propertyName + " " + s);
return (s == null ? defaultValue : s);
}, "~S,~S");
Clazz_defineMethod(c$, "getValueLowerCase", 
function(paramName, defaultValue){
var value = this.getValue(paramName, defaultValue);
if (value != null) {
value = value.trim().toLowerCase();
if (value.length == 0) value = null;
}return value;
}, "~S,~S");
Clazz_defineMethod(c$, "setStringProperty", 
function(name, value){
if (value == null) return;
JU.Logger.info(name + " = \"" + value + "\"");
this.viewer.setStringProperty(name, value);
}, "~S,~S");
Clazz_defineMethod(c$, "scriptProcessor", 
function(script, statusParams, processType){
if (script == null || script.length == 0) return "";
switch (processType) {
case 0:
var err = this.viewer.scriptCheck(script);
return ((typeof(err)=='string') ? err : "");
case 1:
if (statusParams != null) return this.viewer.scriptWaitStatus(script, statusParams).toString();
return this.viewer.scriptWait(script);
case 2:
default:
return this.viewer.script(script);
}
}, "~S,~S,~N");
Clazz_overrideMethod(c$, "register", 
function(id, jsi){
JU.GenericApplet.checkIn(id, jsi);
}, "~S,J.api.JmolSyncInterface");
Clazz_defineMethod(c$, "syncScript", 
function(script){
this.viewer.syncScript(script, "~", 0);
}, "~S");
Clazz_overrideMethod(c$, "handleEvent", 
function(e){
if (this.viewer == null) return false;
return this.viewer.processMouseEvent(e.id, e.x, e.y, e.modifiers, e.when);
}, "java.awt.Event");
Clazz_overrideMethod(c$, "getAppletInfo", 
function(){
return J.i18n.GT.o(J.i18n.GT.$("Jmol Applet version {0} {1}.\n\nAn OpenScience project.\n\nSee http://www.jmol.org for more information"),  Clazz_newArray(-1, [JV.JC.version, JV.JC.date])) + "\nhtmlName = " + JU.PT.esc(this.htmlName) + "\nsyncId = " + JU.PT.esc(this.syncId) + "\ndocumentBase = " + JU.PT.esc(this.documentBase) + "\ncodeBase = " + JU.PT.esc(this.codeBase);
});
Clazz_overrideMethod(c$, "script", 
function(script){
this.scriptNoWait(script);
}, "~S");
Clazz_overrideMethod(c$, "scriptCheck", 
function(script){
if (script == null || script.length == 0) return "";
return this.scriptProcessor(script, null, 0);
}, "~S");
Clazz_overrideMethod(c$, "scriptNoWait", 
function(script){
if (script == null || script.length == 0) return "";
return this.scriptProcessor(script, null, 2);
}, "~S");
Clazz_defineMethod(c$, "scriptWait", 
function(script){
return this.scriptWait(script, null);
}, "~S");
Clazz_defineMethod(c$, "scriptWait", 
function(script, statusParams){
if (script == null || script.length == 0) return "";
this.outputBuffer = null;
return this.scriptProcessor(script, statusParams, 1);
}, "~S,~S");
Clazz_overrideMethod(c$, "scriptWaitOutput", 
function(script){
if (script == null || script.length == 0) return "";
this.outputBuffer =  new JU.SB();
this.viewer.scriptWaitStatus(script, "");
var str = (this.outputBuffer == null ? "" : this.outputBuffer.toString());
this.outputBuffer = null;
return str;
}, "~S");
Clazz_overrideMethod(c$, "getModelIndexFromId", 
function(id){
return this.viewer.getModelIndexFromId(id);
}, "~S");
Clazz_defineMethod(c$, "getProperty", 
function(infoType){
return this.viewer.getProperty(null, infoType, "");
}, "~S");
Clazz_defineMethod(c$, "getProperty", 
function(infoType, paramInfo){
{
paramInfo || (paramInfo = "");
}return this.viewer.getProperty(null, infoType, paramInfo);
}, "~S,~S");
Clazz_defineMethod(c$, "getPropertyAsString", 
function(infoType){
return this.viewer.getProperty("readable", infoType, "").toString();
}, "~S");
Clazz_defineMethod(c$, "getPropertyAsString", 
function(infoType, paramInfo){
{
paramInfo || (paramInfo = "");
}return this.viewer.getProperty("readable", infoType, paramInfo).toString();
}, "~S,~S");
Clazz_defineMethod(c$, "getPropertyAsJSON", 
function(infoType){
return this.viewer.getProperty("JSON", infoType, "").toString();
}, "~S");
Clazz_defineMethod(c$, "getPropertyAsJSON", 
function(infoType, paramInfo){
{
paramInfo || (paramInfo = "");
}return this.viewer.getProperty("JSON", infoType, paramInfo).toString();
}, "~S,~S");
Clazz_overrideMethod(c$, "loadInlineString", 
function(strModel, script, isAppend){
var errMsg = this.viewer.loadInlineAppend(strModel, isAppend);
if (errMsg == null) this.script(script);
return errMsg;
}, "~S,~S,~B");
Clazz_overrideMethod(c$, "loadInlineArray", 
function(strModels, script, isAppend){
if (strModels == null || strModels.length == 0) return null;
var errMsg = this.viewer.loadInline(strModels, isAppend);
if (errMsg == null) this.script(script);
return errMsg;
}, "~A,~S,~B");
Clazz_overrideMethod(c$, "loadDOMNode", 
function(DOMNode){
return this.viewer.openDOM(DOMNode);
}, "~O");
Clazz_defineMethod(c$, "loadInline", 
function(strModel){
return this.loadInlineString(strModel, "", false);
}, "~S");
Clazz_defineMethod(c$, "loadInline", 
function(strModel, script){
return this.loadInlineString(strModel, script, false);
}, "~S,~S");
Clazz_defineMethod(c$, "loadInline", 
function(strModels){
return this.loadInlineArray(strModels, "", false);
}, "~A");
Clazz_defineMethod(c$, "loadInline", 
function(strModels, script){
return this.loadInlineArray(strModels, script, false);
}, "~A,~S");
Clazz_defineMethod(c$, "output", 
function(s){
if (this.outputBuffer != null && s != null) this.outputBuffer.append(s).appendC('\n');
}, "~S");
Clazz_overrideMethod(c$, "setCallback", 
function(name, callbackObject){
this.viewer.sm.setCallbackFunction(name, callbackObject);
}, "~S,~O");
Clazz_overrideMethod(c$, "setCallbackFunction", 
function(callbackName, callbackObject){
if (callbackName.equalsIgnoreCase("language")) {
this.consoleMessage("");
this.consoleMessage(null);
return;
}var callback = J.c.CBK.getCallback(callbackName);
if (callback != null && (this.loading || callback !== J.c.CBK.EVAL)) {
if (callbackObject == null) this.b$.remove(callback);
 else this.b$.put(callback, callbackObject);
return;
}this.consoleMessage("Available callbacks include: " + J.c.CBK.getNameList().$replace(';', ' ').trim());
}, "~S,~S");
Clazz_defineMethod(c$, "consoleMessage", 
function(message){
this.notifyCallback(J.c.CBK.ECHO,  Clazz_newArray(-1, ["", message]));
}, "~S");
Clazz_overrideMethod(c$, "notifyEnabled", 
function(type){
switch (type) {
case J.c.CBK.SYNC:
if (!JU.GenericApplet.isJS) return false;
case J.c.CBK.ANIMFRAME:
case J.c.CBK.DRAGDROP:
case J.c.CBK.ECHO:
case J.c.CBK.ERROR:
case J.c.CBK.EVAL:
case J.c.CBK.IMAGE:
case J.c.CBK.LOADSTRUCT:
case J.c.CBK.MEASURE:
case J.c.CBK.MESSAGE:
case J.c.CBK.PICK:
case J.c.CBK.SCRIPT:
return true;
case J.c.CBK.AUDIO:
case J.c.CBK.APPLETREADY:
case J.c.CBK.ATOMMOVED:
case J.c.CBK.CALCULATION:
case J.c.CBK.CLICK:
case J.c.CBK.HOVER:
case J.c.CBK.MINIMIZATION:
case J.c.CBK.MODELKIT:
case J.c.CBK.RESIZE:
case J.c.CBK.SELECT:
case J.c.CBK.SERVICE:
case J.c.CBK.STRUCTUREMODIFIED:
break;
}
return (this.b$.get(type) != null);
}, "J.c.CBK");
Clazz_defineMethod(c$, "notifyCallback", 
function(type, data){
var callback = (type == null ? null : this.b$.get(type));
var doCallback = (type == null || callback != null && (data == null || data[0] == null));
var toConsole = false;
if (data != null) data[0] = this.htmlName;
var strInfo = (data == null || data[1] == null ? null : data[1].toString());
if (type != null) switch (type) {
case J.c.CBK.APPLETREADY:
data[3] = this.appletObject;
break;
case J.c.CBK.AUDIO:
case J.c.CBK.CALCULATION:
case J.c.CBK.ERROR:
case J.c.CBK.EVAL:
case J.c.CBK.HOVER:
case J.c.CBK.IMAGE:
case J.c.CBK.MINIMIZATION:
case J.c.CBK.SERVICE:
case J.c.CBK.RESIZE:
case J.c.CBK.DRAGDROP:
case J.c.CBK.ATOMMOVED:
case J.c.CBK.SELECT:
case J.c.CBK.MODELKIT:
case J.c.CBK.STRUCTUREMODIFIED:
break;
case J.c.CBK.CLICK:
if ("alert".equals(callback)) strInfo = "x=" + data[1] + " y=" + data[2] + " action=" + data[3] + " clickCount=" + data[4];
break;
case J.c.CBK.ANIMFRAME:
var iData = data[1];
var frameNo = iData[0];
var fileNo = iData[1];
var modelNo = iData[2];
var firstNo = iData[3];
var lastNo = iData[4];
var isAnimationRunning = (frameNo <= -2);
var animationDirection = (firstNo < 0 ? -1 : 1);
var currentDirection = (lastNo < 0 ? -1 : 1);
if (doCallback) {
data =  Clazz_newArray(-1, [this.htmlName, Integer.$valueOf(Math.max(frameNo, -2 - frameNo)), Integer.$valueOf(fileNo), Integer.$valueOf(modelNo), Integer.$valueOf(Math.abs(firstNo)), Integer.$valueOf(Math.abs(lastNo)), Integer.$valueOf(isAnimationRunning ? 1 : 0), Integer.$valueOf(animationDirection), Integer.$valueOf(currentDirection), data[2], data[3]]);
}break;
case J.c.CBK.ECHO:
var isPrivate = (data.length == 2);
var isScriptQueued = (isPrivate || (data[2]).intValue() == 1);
if (!doCallback) {
if (isScriptQueued) toConsole = true;
doCallback = (!isPrivate && (callback = this.b$.get((type = J.c.CBK.MESSAGE))) != null);
}if (!toConsole) this.output(strInfo);
break;
case J.c.CBK.LOADSTRUCT:
var errorMsg = data[4];
if (errorMsg != null) {
errorMsg = (errorMsg.indexOf("NOTE:") >= 0 ? "" : J.i18n.GT.$("File Error:")) + errorMsg;
this.doShowStatus(errorMsg);
this.notifyCallback(J.c.CBK.MESSAGE,  Clazz_newArray(-1, ["", errorMsg]));
return;
}break;
case J.c.CBK.MEASURE:
if (!doCallback) doCallback = ((callback = this.b$.get((type = J.c.CBK.MESSAGE))) != null);
var status = data[3];
if (status.indexOf("Picked") >= 0 || status.indexOf("Sequence") >= 0) {
this.doShowStatus(strInfo);
toConsole = true;
} else if (status.indexOf("Completed") >= 0) {
strInfo = status + ": " + strInfo;
toConsole = true;
}break;
case J.c.CBK.MESSAGE:
toConsole = !doCallback;
doCallback = new Boolean (doCallback & (strInfo != null)).valueOf();
if (!toConsole) this.output(strInfo);
break;
case J.c.CBK.PICK:
this.doShowStatus(strInfo);
toConsole = true;
break;
case J.c.CBK.SCRIPT:
var msWalltime = (data[3]).intValue();
if (msWalltime > 0) {
} else if (!doCallback) {
doCallback = ((callback = this.b$.get((type = J.c.CBK.MESSAGE))) != null);
}this.output(strInfo);
this.doShowStatus(strInfo);
break;
case J.c.CBK.SYNC:
this.sendScript(strInfo, data[2], true, doCallback);
return;
}
if (toConsole) {
var appConsole = this.viewer.getProperty("DATA_API", "getAppConsole", null);
if (appConsole != null) {
appConsole.notifyCallback(type, data);
this.output(strInfo);
}}if (!doCallback || !this.mayScript) return;
try {
this.doSendCallback(type, callback, data, strInfo);
} catch (e) {
if (Clazz_exceptionOf(e, Exception)){
if (!this.haveNotifiedError) if (JU.Logger.debugging) {
JU.Logger.debug(type.name() + "Callback call error to " + callback + ": " + e);
}this.haveNotifiedError = true;
} else {
throw e;
}
}
}, "J.c.CBK,~A");
Clazz_defineMethod(c$, "sendScript", 
function(script, appletName, isSync, doCallback){
if (!JU.GenericApplet.isJS) return "";
if (doCallback) {
script = this.notifySync(script, appletName);
if (script == null || script.length == 0 || script.equals("0")) return "";
}var apps =  new JU.Lst();
JU.GenericApplet.findApplets(appletName, this.syncId, this.fullName, apps);
var nApplets = apps.size();
if (nApplets == 0) {
if (!doCallback && !appletName.equals("*")) JU.Logger.error(this.fullName + " couldn't find applet " + appletName);
return "";
}var sb = (isSync ? null :  new JU.SB());
var getGraphics = (isSync && script.equals("GET_GRAPHICS"));
var setNoGraphics = (isSync && script.equals("SET_GRAPHICS_OFF"));
if (getGraphics) this.viewer.setStereo(false, (this.gRight = null));
for (var i = 0; i < nApplets; i++) {
var theApplet = apps.get(i);
var app = JU.GenericApplet.htRegistry.get(theApplet);
var isScriptable = true;
if (JU.Logger.debugging) JU.Logger.debug(this.fullName + " sending to " + theApplet + ": " + script);
try {
if (isScriptable && (getGraphics || setNoGraphics)) {
this.viewer.setStereo(this.isStereoSlave = getGraphics, this.gRight = (app).setStereoGraphics(getGraphics));
return "";
}if (isSync) app.syncScript(script);
 else if (isScriptable) sb.append((app).scriptWait(script, "output")).append("\n");
} catch (e) {
if (Clazz_exceptionOf(e, Exception)){
var msg = this.htmlName + " couldn't send to " + theApplet + ": " + script + ": " + e;
JU.Logger.error(msg);
if (!isSync) sb.append(msg);
} else {
throw e;
}
}
}
return (isSync ? "" : sb.toString());
}, "~S,~S,~B,~B");
Clazz_defineMethod(c$, "notifySync", 
function(info, appletName){
var syncCallback = this.b$.get(J.c.CBK.SYNC);
if (!this.mayScript || syncCallback == null) return info;
try {
return this.doSendCallback(J.c.CBK.SYNC, syncCallback,  Clazz_newArray(-1, [this.fullName, info, appletName]), null);
} catch (e) {
if (Clazz_exceptionOf(e, Exception)){
if (!this.haveNotifiedError) if (JU.Logger.debugging) {
JU.Logger.debug("syncCallback call error to " + syncCallback + ": " + e);
}this.haveNotifiedError = true;
} else {
throw e;
}
}
return info;
}, "~S,~S");
Clazz_overrideMethod(c$, "eval", 
function(strEval){
var pt = strEval.indexOf("\1");
if (pt >= 0) return this.sendScript(strEval.substring(pt + 1), strEval.substring(0, pt), false, false);
if (!this.haveDocumentAccess) return "NO EVAL ALLOWED";
if (this.b$.get(J.c.CBK.EVAL) != null) {
this.notifyCallback(J.c.CBK.EVAL,  Clazz_newArray(-1, [null, strEval]));
return "";
}return this.doEval(strEval);
}, "~S");
Clazz_overrideMethod(c$, "createImage", 
function(fileName, type, text_or_bytes, quality){
return null;
}, "~S,~S,~O,~N");
Clazz_overrideMethod(c$, "getRegistryInfo", 
function(){
JU.GenericApplet.checkIn(null, null);
return JU.GenericApplet.htRegistry;
});
Clazz_overrideMethod(c$, "showUrl", 
function(urlString){
if (JU.Logger.debugging) JU.Logger.debug("showUrl(" + urlString + ")");
if (urlString != null && urlString.length > 0) try {
this.doShowDocument( new java.net.URL(Clazz_castNullAs("java.net.URL"), urlString, null));
} catch (mue) {
if (Clazz_exceptionOf(mue,"java.net.MalformedURLException")){
this.consoleMessage("Malformed URL:" + urlString);
} else {
throw mue;
}
}
}, "~S");
Clazz_overrideMethod(c$, "resizeInnerPanel", 
function(data){
var dims =  Clazz_newFloatArray (2, 0);
JU.Parser.parseStringInfestedFloatArray(data, null, dims);
this.resizeDisplay(Clazz_floatToInt(dims[0]), Clazz_floatToInt(dims[1]));
return  Clazz_newIntArray(-1, [Clazz_floatToInt(dims[0]), Clazz_floatToInt(dims[1])]);
}, "~S");
c$.checkIn = Clazz_defineMethod(c$, "checkIn", 
function(name, applet){
if (name != null) {
JU.Logger.info("AppletRegistry.checkIn(" + name + ")");
JU.GenericApplet.htRegistry.put(name, applet);
}if (JU.Logger.debugging) {
for (var entry, $entry = JU.GenericApplet.htRegistry.entrySet().iterator (); $entry.hasNext()&& ((entry = $entry.next ()) || true);) {
var theApplet = entry.getKey();
JU.Logger.debug(theApplet + " " + entry.getValue());
}
}}, "~S,~O");
c$.checkOut = Clazz_defineMethod(c$, "checkOut", 
function(name){
JU.GenericApplet.htRegistry.remove(name);
}, "~S");
c$.findApplets = Clazz_defineMethod(c$, "findApplets", 
function(appletName, mySyncId, excludeName, apps){
if (appletName != null && appletName.indexOf(",") >= 0) {
var names = JU.PT.split(appletName, ",");
for (var i = 0; i < names.length; i++) JU.GenericApplet.findApplets(names[i], mySyncId, excludeName, apps);

return;
}var ext = "__" + mySyncId + "__";
if (appletName == null || appletName.equals("*") || appletName.equals(">")) {
for (var appletName2, $appletName2 = JU.GenericApplet.htRegistry.keySet().iterator (); $appletName2.hasNext()&& ((appletName2 = $appletName2.next ()) || true);) {
if (!appletName2.equals(excludeName) && appletName2.indexOf(ext) > 0) {
apps.addLast(appletName2);
}}
return;
}if (excludeName.indexOf("_object") >= 0 && appletName.indexOf("_object") < 0) appletName += "_object";
if (appletName.indexOf("__") < 0) appletName += ext;
if (!JU.GenericApplet.htRegistry.containsKey(appletName)) appletName = "jmolApplet" + appletName;
if (!appletName.equals(excludeName) && JU.GenericApplet.htRegistry.containsKey(appletName)) {
apps.addLast(appletName);
}}, "~S,~S,~S,JU.Lst");
Clazz_overrideMethod(c$, "notifyAudioEnded", 
function(htParams){
var params = htParams;
params.put("jsEvent", "TRUE");
this.viewer.sm.notifyAudioStatus(params);
params.remove("jsEvent");
}, "~O");
Clazz_defineMethod(c$, "setJSOptions", 
function(vwrOptions){
this.htParams =  new java.util.Hashtable();
if (vwrOptions == null) vwrOptions =  new java.util.Hashtable();
this.vwrOptions = vwrOptions;
for (var entry, $entry = vwrOptions.entrySet().iterator (); $entry.hasNext()&& ((entry = $entry.next ()) || true);) this.htParams.put(entry.getKey().toLowerCase(), entry.getValue());

this.documentBase = "" + vwrOptions.get("documentBase");
this.codeBase = "" + vwrOptions.get("codePath");
}, "java.util.Map");
Clazz_defineMethod(c$, "initOptions", 
function(){
this.vwrOptions.remove("debug");
this.vwrOptions.put("fullName", this.fullName);
this.haveDocumentAccess = "true".equalsIgnoreCase("" + this.getValue("allowjavascript", "true"));
this.mayScript = true;
});
Clazz_defineMethod(c$, "getJmolParameter", 
function(paramName){
var o = this.htParams.get(paramName.toLowerCase());
return (o == null ? null : "" + o);
}, "~S");
Clazz_overrideMethod(c$, "functionXY", 
function(functionName, nX, nY){
var fxy =  Clazz_newFloatArray (Math.abs(nX), Math.abs(nY), 0);
if (!this.mayScript || !this.haveDocumentAccess || nX == 0 || nY == 0) return fxy;
try {
if (nX > 0 && nY > 0) {
for (var i = 0; i < nX; i++) for (var j = 0; j < nY; j++) {
{
fxy[i][j] = window.eval(functionName)(this.htmlName, i, j);
}}

} else if (nY > 0) {
var data;
{
data = window.eval(functionName)(this.htmlName, nX, nY);
}nX = Math.abs(nX);
var fdata =  Clazz_newFloatArray (nX * nY, 0);
JU.Parser.parseStringInfestedFloatArray(data, null, fdata);
for (var i = 0, ipt = 0; i < nX; i++) {
for (var j = 0; j < nY; j++, ipt++) {
fxy[i][j] = fdata[ipt];
}
}
} else {
{
data = window.eval(functionName)(this.htmlName, nX, nY, fxy);
}}} catch (e) {
if (Clazz_exceptionOf(e, Exception)){
JU.Logger.error("Exception " + e + " with nX, nY: " + nX + " " + nY);
} else {
throw e;
}
}
return fxy;
}, "~S,~N,~N");
Clazz_overrideMethod(c$, "functionXYZ", 
function(functionName, nX, nY, nZ){
var fxyz =  Clazz_newFloatArray (Math.abs(nX), Math.abs(nY), Math.abs(nZ), 0);
if (!this.mayScript || !this.haveDocumentAccess || nX == 0 || nY == 0 || nZ == 0) return fxyz;
try {
{
window.eval(functionName)(this.htmlName, nX, nY, nZ, fxyz);
}} catch (e) {
if (Clazz_exceptionOf(e, Exception)){
JU.Logger.error("Exception " + e + " for " + functionName + " with nX, nY, nZ: " + nX + " " + nY + " " + nZ);
} else {
throw e;
}
}
return fxyz;
}, "~S,~N,~N,~N");
Clazz_defineMethod(c$, "doShowDocument", 
function(url){
var surl = JU.PT.split(url.toString(), "?POST?");
if (surl.length == 1) {
{
window.open(surl[0]);
}return;
}var f = "<form id=f method=POST action='" + surl[0] + "'>";
f += "<input type='hidden' name='name' value='nmr-1h-prediction' id='name'>";
f += "<input type='submit' value='working...'>";
var fields = surl[1].$plit("&");
for (var i = 0; i < fields.length; i++) {
var field = fields[i];
var pt = field.indexOf("=");
var name = field.substring(0, pt);
var value = field.substring(pt);
if (value.indexOf("\n") >= 0) {
f += "<textarea style='display:none' name=" + name + ">" + value + "</textarea>";
} else {
f += "<input type=hidden name=" + name + " value=\"" + value + "\">";
}}
f += "</form>";
{
var w=window.open("");w.document.write(f);w.document.getElementById("f").submit();
}}, "java.net.URL");
Clazz_defineMethod(c$, "doSendCallback", 
function(type, callback, data, strInfo){
var isString = ((typeof(callback)=='string'));
if (callback == null || isString && (callback).length == 0) {
} else {
if (isString && "alert".equals(callback)) {
{
alert(strInfo);
}return "";
}var tokens = (isString ? JU.PT.split((callback), ".") : null);
try {
{
var o;
if (isString) {
o = window[tokens[0]];
for (var i = 1; i < tokens.length; i++)
o = o[tokens[i]];
} else {
o = callback;
}
for (var i = 0; i < data.length; i++) {
data[i] && data[i].booleanValue && (data[i] = data[i].booleanValue());
data[i] instanceof Number && (data[i] = +data[i]);
}
return o.apply(this,data)
}} catch (e) {
System.out.println("callback " + type + " failed " + e);
}
}return "";
}, "J.c.CBK,~O,~A,~S");
Clazz_defineMethod(c$, "doEval", 
function(strEval){
try {
{
return window.eval(strEval);
}} catch (e) {
JU.Logger.error("# error evaluating " + strEval + ":" + e.toString());
}
return "";
}, "~S");
Clazz_defineMethod(c$, "doShowStatus", 
function(message){
try {
System.out.println(message);
} catch (e) {
if (Clazz_exceptionOf(e, Exception)){
} else {
throw e;
}
}
}, "~S");
Clazz_defineMethod(c$, "getGLmolView", 
function(){
return this.viewer.getGLmolView();
});
Clazz_defineMethod(c$, "openFile", 
function(fileName){
return this.viewer.openFile(fileName);
}, "~S");
Clazz_overrideMethod(c$, "cacheFileByName", 
function(fileName, isAdd){
return this.viewer.cacheFileByName(fileName, isAdd);
}, "~S,~B");
Clazz_overrideMethod(c$, "cachePut", 
function(key, data){
this.viewer.cachePut(key, data);
}, "~S,~O");
Clazz_overrideMethod(c$, "getFullName", 
function(){
return this.fullName;
});
Clazz_overrideMethod(c$, "processPluginRequest", 
function(name, action, value){
return null;
}, "~S,~S,~O");
c$.htRegistry = null;
c$.isJS = false;
});
;//5.0.1-v7 Mon Aug 24 10:01:38 CDT 2026
Clazz_declarePackage("JU");
Clazz_load(["JU.AU"], "JU.Geodesic", ["java.util.Hashtable", "JU.V3"], function(){
var c$ = Clazz_declareType(JU, "Geodesic", null);
c$.getNeighborVertexesArrays = Clazz_defineMethod(c$, "getNeighborVertexesArrays", 
function(){
if (JU.Geodesic.vertexCounts == null) JU.Geodesic.createGeodesic(3);
return JU.Geodesic.neighborVertexesArrays;
});
c$.getVertexCount = Clazz_defineMethod(c$, "getVertexCount", 
function(level){
if (JU.Geodesic.vertexCounts == null) JU.Geodesic.createGeodesic(3);
return JU.Geodesic.vertexCounts[level];
}, "~N");
c$.getVertexVectors = Clazz_defineMethod(c$, "getVertexVectors", 
function(){
if (JU.Geodesic.vertexCounts == null) JU.Geodesic.createGeodesic(3);
return JU.Geodesic.vertexVectors;
});
c$.getVertexVector = Clazz_defineMethod(c$, "getVertexVector", 
function(i){
return JU.Geodesic.vertexVectors[i];
}, "~N");
c$.getFaceVertexes = Clazz_defineMethod(c$, "getFaceVertexes", 
function(level){
return JU.Geodesic.faceVertexesArrays[level];
}, "~N");
c$.createGeodesic = Clazz_defineMethod(c$, "createGeodesic", 
function(lvl){
if (lvl <= JU.Geodesic.currentLevel) return;
JU.Geodesic.currentLevel = lvl;
var v =  Clazz_newShortArray (lvl + 1, 0);
JU.Geodesic.neighborVertexesArrays = JU.AU.newShort2(lvl + 1);
JU.Geodesic.faceVertexesArrays = JU.AU.newShort2(lvl + 1);
JU.Geodesic.vertexVectors =  new Array(12);
JU.Geodesic.vertexVectors[0] = JU.V3.new3(0, 0, JU.Geodesic.halfRoot5);
for (var i = 0; i < 5; ++i) {
JU.Geodesic.vertexVectors[i + 1] = JU.V3.new3(Math.cos(i * 1.2566370614359172), Math.sin(i * 1.2566370614359172), 0.5);
JU.Geodesic.vertexVectors[i + 6] = JU.V3.new3(Math.cos(i * 1.2566370614359172 + 0.6283185307179586), Math.sin(i * 1.2566370614359172 + 0.6283185307179586), -0.5);
}
JU.Geodesic.vertexVectors[11] = JU.V3.new3(0, 0, -JU.Geodesic.halfRoot5);
for (var i = 12; --i >= 0; ) JU.Geodesic.vertexVectors[i].normalize();

JU.Geodesic.faceVertexesArrays[0] = JU.Geodesic.faceVertexesIcosahedron;
JU.Geodesic.neighborVertexesArrays[0] = JU.Geodesic.neighborVertexesIcosahedron;
v[0] = 12;
for (var i = 0; i < lvl; ++i) JU.Geodesic.quadruple(i, v);

JU.Geodesic.vertexCounts = v;
}, "~N");
c$.quadruple = Clazz_defineMethod(c$, "quadruple", 
function(level, counts){
JU.Geodesic.htVertex =  new java.util.Hashtable();
var oldVertexCount = JU.Geodesic.vertexVectors.length;
var oldFaceVertexes = JU.Geodesic.faceVertexesArrays[level];
var oldFaceVertexesLength = oldFaceVertexes.length;
var oldFaceCount = Clazz_doubleToInt(oldFaceVertexesLength / 3);
var oldEdgesCount = oldVertexCount + oldFaceCount - 2;
var newVertexCount = oldVertexCount + oldEdgesCount;
var newFaceCount = 4 * oldFaceCount;
JU.Geodesic.vertexVectors = JU.AU.arrayCopyObject(JU.Geodesic.vertexVectors, newVertexCount);
var newFacesVertexes =  Clazz_newShortArray (3 * newFaceCount, 0);
JU.Geodesic.faceVertexesArrays[level + 1] = newFacesVertexes;
var neighborVertexes =  Clazz_newShortArray (6 * newVertexCount, 0);
JU.Geodesic.neighborVertexesArrays[level + 1] = neighborVertexes;
for (var i = neighborVertexes.length; --i >= 0; ) neighborVertexes[i] = -1;

counts[level + 1] = newVertexCount;
JU.Geodesic.vertexNext = oldVertexCount;
var iFaceNew = 0;
for (var i = 0; i < oldFaceVertexesLength; ) {
var iA = oldFaceVertexes[i++];
var iB = oldFaceVertexes[i++];
var iC = oldFaceVertexes[i++];
var iAB = JU.Geodesic.getVertex(iA, iB);
var iBC = JU.Geodesic.getVertex(iB, iC);
var iCA = JU.Geodesic.getVertex(iC, iA);
newFacesVertexes[iFaceNew++] = iA;
newFacesVertexes[iFaceNew++] = iAB;
newFacesVertexes[iFaceNew++] = iCA;
newFacesVertexes[iFaceNew++] = iB;
newFacesVertexes[iFaceNew++] = iBC;
newFacesVertexes[iFaceNew++] = iAB;
newFacesVertexes[iFaceNew++] = iC;
newFacesVertexes[iFaceNew++] = iCA;
newFacesVertexes[iFaceNew++] = iBC;
newFacesVertexes[iFaceNew++] = iCA;
newFacesVertexes[iFaceNew++] = iAB;
newFacesVertexes[iFaceNew++] = iBC;
JU.Geodesic.addNeighboringVertexes(neighborVertexes, iAB, iA);
JU.Geodesic.addNeighboringVertexes(neighborVertexes, iAB, iCA);
JU.Geodesic.addNeighboringVertexes(neighborVertexes, iAB, iBC);
JU.Geodesic.addNeighboringVertexes(neighborVertexes, iAB, iB);
JU.Geodesic.addNeighboringVertexes(neighborVertexes, iBC, iB);
JU.Geodesic.addNeighboringVertexes(neighborVertexes, iBC, iCA);
JU.Geodesic.addNeighboringVertexes(neighborVertexes, iBC, iC);
JU.Geodesic.addNeighboringVertexes(neighborVertexes, iCA, iC);
JU.Geodesic.addNeighboringVertexes(neighborVertexes, iCA, iA);
}
if (true) {
var vertexCount = JU.Geodesic.vertexVectors.length;
if (iFaceNew != newFacesVertexes.length) throw  new NullPointerException();
if (JU.Geodesic.vertexNext != newVertexCount) throw  new NullPointerException();
for (var i = 0; i < 12; ++i) {
for (var j = 0; j < 5; ++j) {
var neighbor = neighborVertexes[i * 6 + j];
if (neighbor < 0) throw  new NullPointerException();
if (neighbor >= vertexCount) throw  new NullPointerException();
if (neighborVertexes[i * 6 + 5] != -1) throw  new NullPointerException();
}
}
for (var i = 72; i < neighborVertexes.length; ++i) {
var neighbor = neighborVertexes[i];
if (neighbor < 0) throw  new NullPointerException();
if (neighbor >= vertexCount) throw  new NullPointerException();
}
for (var i = 0; i < newVertexCount; ++i) {
var neighborCount = 0;
for (var j = neighborVertexes.length; --j >= 0; ) if (neighborVertexes[j] == i) ++neighborCount;

if ((i < 12 && neighborCount != 5) || (i >= 12 && neighborCount != 6)) throw  new NullPointerException();
var faceCount = 0;
for (var j = newFacesVertexes.length; --j >= 0; ) if (newFacesVertexes[j] == i) ++faceCount;

if ((i < 12 && faceCount != 5) || (i >= 12 && faceCount != 6)) throw  new NullPointerException();
}
}JU.Geodesic.htVertex = null;
}, "~N,~A");
c$.addNeighboringVertexes = Clazz_defineMethod(c$, "addNeighboringVertexes", 
function(neighborVertexes, v1, v2){
for (var i = v1 * 6, iMax = i + 6; i < iMax; ++i) {
if (neighborVertexes[i] == v2) return;
if (neighborVertexes[i] < 0) {
neighborVertexes[i] = v2;
for (var j = v2 * 6, jMax = j + 6; j < jMax; ++j) {
if (neighborVertexes[j] == v1) return;
if (neighborVertexes[j] < 0) {
neighborVertexes[j] = v1;
return;
}}
}}
throw  new NullPointerException();
}, "~A,~N,~N");
c$.getVertex = Clazz_defineMethod(c$, "getVertex", 
function(v1, v2){
if (v1 > v2) {
var t = v1;
v1 = v2;
v2 = t;
}var hashKey = Integer.$valueOf((v1 << 16) + v2);
var iv = JU.Geodesic.htVertex.get(hashKey);
if (iv != null) {
return iv.shortValue();
}var newVertexVector = JU.Geodesic.vertexVectors[JU.Geodesic.vertexNext] =  new JU.V3();
newVertexVector.add2(JU.Geodesic.vertexVectors[v1], JU.Geodesic.vertexVectors[v2]);
newVertexVector.normalize();
JU.Geodesic.htVertex.put(hashKey, Short.$valueOf(JU.Geodesic.vertexNext));
return JU.Geodesic.vertexNext++;
}, "~N,~N");
c$.halfRoot5 = 0.5 * Math.sqrt(5);
c$.faceVertexesIcosahedron =  Clazz_newShortArray(-1, [0, 1, 2, 0, 2, 3, 0, 3, 4, 0, 4, 5, 0, 5, 1, 1, 6, 2, 2, 7, 3, 3, 8, 4, 4, 9, 5, 5, 10, 1, 6, 1, 10, 7, 2, 6, 8, 3, 7, 9, 4, 8, 10, 5, 9, 11, 6, 10, 11, 7, 6, 11, 8, 7, 11, 9, 8, 11, 10, 9]);
c$.neighborVertexesIcosahedron =  Clazz_newShortArray(-1, [1, 2, 3, 4, 5, -1, 0, 5, 10, 6, 2, -1, 0, 1, 6, 7, 3, -1, 0, 2, 7, 8, 4, -1, 0, 3, 8, 9, 5, -1, 0, 4, 9, 10, 1, -1, 1, 10, 11, 7, 2, -1, 2, 6, 11, 8, 3, -1, 3, 7, 11, 9, 4, -1, 4, 8, 11, 10, 5, -1, 5, 9, 11, 6, 1, -1, 6, 7, 8, 9, 10, -1]);
c$.vertexCounts = null;
c$.vertexVectors = null;
c$.faceVertexesArrays = null;
c$.neighborVertexesArrays = null;
c$.currentLevel = 0;
c$.vertexNext = 0;
c$.htVertex = null;
});
;//5.0.1-v7 Mon Aug 17 10:07:10 MDT 2026
Clazz_declarePackage("JU");
(function(){
var c$ = Clazz_decorateAsClass(function(){
this.entryCount = 0;
this.entries = null;
Clazz_instantialize(this, arguments);}, JU, "Int2IntHash", null);
Clazz_makeConstructor(c$, 
function(initialCapacity){
this.entries =  new Array(initialCapacity);
}, "~N");
Clazz_defineMethod(c$, "get", 
function(key){
var entries = this.entries;
var hash = (key & 0x7FFFFFFF) % entries.length;
for (var e = entries[hash]; e != null; e = e.next) if (e.key == key) return e.value;

return -2147483648;
}, "~N");
Clazz_defineMethod(c$, "put", 
function(key, value){
var entries = this.entries;
var n = entries.length;
var hash = (key & 0x7FFFFFFF) % n;
for (var e = entries[hash]; e != null; e = e.next) if (e.key == key) {
e.value = value;
return;
}
if (this.entryCount > n) {
var oldSize = n;
n += n + 1;
var newEntries =  new Array(n);
for (var i = oldSize; --i >= 0; ) {
for (var e = entries[i]; e != null; ) {
var t = e;
e = e.next;
hash = (t.key & 0x7FFFFFFF) % n;
t.next = newEntries[hash];
newEntries[hash] = t;
}
}
entries = this.entries = newEntries;
hash = (key & 0x7FFFFFFF) % n;
}entries[hash] =  new JU.Int2IntHashEntry(key, value, entries[hash]);
++this.entryCount;
}, "~N,~N");
var c$ = Clazz_decorateAsClass(function(){
this.key = 0;
this.value = 0;
this.next = null;
Clazz_instantialize(this, arguments);}, JU, "Int2IntHashEntry", null);
Clazz_makeConstructor(c$, 
function(key, value, next){
this.key = key;
this.value = value;
this.next = next;
}, "~N,~N,JU.Int2IntHashEntry");
})();
;//5.0.1-v7 Mon Aug 17 10:07:10 MDT 2026
Clazz_declarePackage("JU");
Clazz_load(null, "JU.JSJSONParser", ["java.util.Hashtable", "JU.JSONException", "$.Lst", "$.SB"], function(){
var c$ = Clazz_decorateAsClass(function(){
this.str = null;
this.index = 0;
this.len = 0;
this.asHashTable = false;
Clazz_instantialize(this, arguments);}, JU, "JSJSONParser", null);
/*LV!1824 unnec constructor*/Clazz_defineMethod(c$, "parseMap", 
function(str, asHashTable){
this.index = 0;
this.asHashTable = asHashTable;
this.str = str;
this.len = str.length;
if (this.getChar() != '{') return null;
this.returnChar();
return this.getValue(false);
}, "~S,~B");
Clazz_defineMethod(c$, "parse", 
function(str, asHashTable){
this.index = 0;
this.asHashTable = asHashTable;
this.str = str;
this.len = str.length;
return this.getValue(false);
}, "~S,~B");
Clazz_defineMethod(c$, "next", 
function(){
return (this.index < this.len ? this.str.charAt(this.index++) : '\0');
});
Clazz_defineMethod(c$, "returnChar", 
function(){
this.index--;
});
Clazz_defineMethod(c$, "getChar", 
function(){
for (; ; ) {
var c = this.next();
if (c.charCodeAt(0) == 0 || c > ' ') {
return c;
}}
});
Clazz_defineMethod(c$, "getValue", 
function(isKey){
var i = this.index;
var c = this.getChar();
switch ((c).charCodeAt(0)) {
case 0:
return null;
case 34:
case 39:
return this.getString(c);
case 123:
if (!isKey) return this.getObject();
c = String.fromCharCode( 0);
break;
case 91:
if (!isKey) return this.getArray();
c = String.fromCharCode( 0);
break;
default:
this.returnChar();
while (c >= ' ' && "[,]{:}'\"".indexOf(c) < 0) c = this.next();

this.returnChar();
if (isKey && c != ':') c = String.fromCharCode( 0);
break;
}
if (isKey && c.charCodeAt(0) == 0) throw  new JU.JSONException("invalid key");
var string = this.str.substring(i, this.index).trim();
if (!isKey) {
if (string.equals("true")) {
return Boolean.TRUE;
}if (string.equals("false")) {
return Boolean.FALSE;
}if (string.equals("null")) {
return (this.asHashTable ? string : null);
}}c = string.charAt(0);
if (c >= '0' && c <= '9' || c == '-') try {
if (string.indexOf('.') < 0 && string.indexOf('e') < 0 && string.indexOf('E') < 0) return  new Integer(string);
var d = Float.$valueOf(string);
if (!d.isInfinite() && !d.isNaN()) return d;
} catch (e) {
if (Clazz_exceptionOf(e, Exception)){
} else {
throw e;
}
}
System.out.println("JSON parser cannot parse " + string);
throw  new JU.JSONException("invalid value");
}, "~B");
Clazz_defineMethod(c$, "getString", 
function(quote){
var c;
var sb = null;
var i0 = this.index;
for (; ; ) {
var i1 = this.index;
switch ((c = this.next()).charCodeAt(0)) {
case 0:
case 10:
case 13:
throw this.syntaxError("Unterminated string");
case 92:
switch ((c = this.next()).charCodeAt(0)) {
case 34:
case 39:
case 92:
case 47:
break;
case 98:
c = '\b';
break;
case 116:
c = '\t';
break;
case 110:
c = '\n';
break;
case 102:
c = '\f';
break;
case 114:
c = '\r';
break;
case 117:
var i = this.index;
this.index += 4;
try {
c = String.fromCharCode(Integer.parseInt(this.str.substring(i, this.index), 16));
} catch (e) {
if (Clazz_exceptionOf(e, Exception)){
throw this.syntaxError("Substring bounds error");
} else {
throw e;
}
}
break;
default:
throw this.syntaxError("Illegal escape.");
}
break;
default:
if (c == quote) return (sb == null ? this.str.substring(i0, i1) : sb.toString());
break;
}
if (this.index > i1 + 1) {
if (sb == null) {
sb =  new JU.SB();
sb.append(this.str.substring(i0, i1));
}}if (sb != null) sb.appendC(c);
}
}, "~S");
Clazz_defineMethod(c$, "getObject", 
function(){
var map = (this.asHashTable ?  new java.util.Hashtable() :  new java.util.HashMap());
var key = null;
switch ((this.getChar()).charCodeAt(0)) {
case 125:
return map;
case 0:
throw  new JU.JSONException("invalid object");
}
this.returnChar();
var isKey = false;
for (; ; ) {
if ((isKey = !isKey) == true) key = this.getValue(true).toString();
 else map.put(key, this.getValue(false));
switch ((this.getChar()).charCodeAt(0)) {
case 125:
return map;
case 58:
if (isKey) continue;
isKey = true;
case 44:
if (!isKey) continue;
default:
throw this.syntaxError("Expected ',' or ':' or '}'");
}
}
});
Clazz_defineMethod(c$, "getArray", 
function(){
var l =  new JU.Lst();
switch ((this.getChar()).charCodeAt(0)) {
case 93:
return l;
case 0:
throw  new JU.JSONException("invalid array");
}
this.returnChar();
var isNull = false;
for (; ; ) {
if (isNull) {
l.addLast(null);
isNull = false;
} else {
l.addLast(this.getValue(false));
}switch ((this.getChar()).charCodeAt(0)) {
case 44:
switch ((this.getChar()).charCodeAt(0)) {
case 93:
return l;
case 44:
isNull = true;
default:
this.returnChar();
}
continue;
case 93:
return l;
default:
throw this.syntaxError("Expected ',' or ']'");
}
}
});
Clazz_defineMethod(c$, "syntaxError", 
function(message){
return  new JU.JSONException(message + " for " + this.str.substring(0, Math.min(this.index, this.len)));
}, "~S");
});
;//5.0.1-v7 Mon Aug 17 10:07:10 MDT 2026
Clazz_declarePackage("JU");
Clazz_load(["java.lang.RuntimeException"], "JU.JSONException", null, function(){
var c$ = Clazz_declareType(JU, "JSONException", RuntimeException);
});
;//5.0.1-v7 Mon Aug 17 10:07:10 MDT 2026
Clazz_declarePackage("JU");
Clazz_load(["java.util.Hashtable", "JU.DefaultLogger"], "JU.Logger", null, function(){
var c$ = Clazz_declareType(JU, "Logger", null);
c$.getProperty = Clazz_defineMethod(c$, "getProperty", 
function(level, defaultValue){
try {
var property = System.getProperty("jmol.logger." + level, null);
if (property != null) {
return (property.equalsIgnoreCase("true"));
}} catch (e) {
if (Clazz_exceptionOf(e, Exception)){
} else {
throw e;
}
}
return defaultValue;
}, "~S,~B");
c$.setLogger = Clazz_defineMethod(c$, "setLogger", 
function(logger){
JU.Logger._logger = logger;
JU.Logger.debugging = JU.Logger.isActiveLevel(5) || JU.Logger.isActiveLevel(6);
JU.Logger.debuggingHigh = (JU.Logger.debugging && JU.Logger._activeLevels[6]);
}, "JU.LoggerInterface");
c$.isActiveLevel = Clazz_defineMethod(c$, "isActiveLevel", 
function(level){
return JU.Logger._logger != null && level >= 0 && level < 7 && JU.Logger._activeLevels[level];
}, "~N");
c$.setActiveLevel = Clazz_defineMethod(c$, "setActiveLevel", 
function(level, active){
if (level < 0) level = 0;
if (level >= 7) level = 6;
JU.Logger._activeLevels[level] = active;
JU.Logger.debugging = JU.Logger.isActiveLevel(5) || JU.Logger.isActiveLevel(6);
JU.Logger.debuggingHigh = (JU.Logger.debugging && JU.Logger._activeLevels[6]);
}, "~N,~B");
c$.setLogLevel = Clazz_defineMethod(c$, "setLogLevel", 
function(level){
for (var i = 7; --i >= 0; ) JU.Logger.setActiveLevel(i, i <= level);

}, "~N");
c$.getLevel = Clazz_defineMethod(c$, "getLevel", 
function(level){
switch (level) {
case 6:
return "DEBUGHIGH";
case 5:
return "DEBUG";
case 4:
return "INFO";
case 3:
return "WARN";
case 2:
return "ERROR";
case 1:
return "FATAL";
}
return "????";
}, "~N");
c$.logLevel = Clazz_defineMethod(c$, "logLevel", 
function(){
return JU.Logger._logLevel;
});
c$.doLogLevel = Clazz_defineMethod(c$, "doLogLevel", 
function(log){
JU.Logger._logLevel = log;
}, "~B");
c$.debug = Clazz_defineMethod(c$, "debug", 
function(txt){
if (!JU.Logger.debugging) return;
try {
JU.Logger._logger.debug(txt);
} catch (t) {
}
}, "~S");
c$.info = Clazz_defineMethod(c$, "info", 
function(txt){
try {
if (JU.Logger.isActiveLevel(4)) {
JU.Logger._logger.info(txt);
}} catch (t) {
}
}, "~S");
c$.warn = Clazz_defineMethod(c$, "warn", 
function(txt){
try {
if (JU.Logger.isActiveLevel(3)) {
JU.Logger._logger.warn(txt);
}} catch (t) {
}
}, "~S");
c$.warnEx = Clazz_defineMethod(c$, "warnEx", 
function(txt, e){
try {
if (JU.Logger.isActiveLevel(3)) {
JU.Logger._logger.warnEx(txt, e);
}} catch (t) {
}
}, "~S,Throwable");
c$.error = Clazz_defineMethod(c$, "error", 
function(txt){
try {
if (JU.Logger.isActiveLevel(2)) {
JU.Logger._logger.error(txt);
}} catch (t) {
}
}, "~S");
c$.errorEx = Clazz_defineMethod(c$, "errorEx", 
function(txt, e){
try {
if (JU.Logger.isActiveLevel(2)) {
JU.Logger._logger.errorEx(txt, e);
}} catch (t) {
}
}, "~S,Throwable");
c$.getLogLevel = Clazz_defineMethod(c$, "getLogLevel", 
function(){
for (var i = 7; --i >= 0; ) if (JU.Logger.isActiveLevel(i)) return i;

return 0;
});
c$.fatal = Clazz_defineMethod(c$, "fatal", 
function(txt){
try {
if (JU.Logger.isActiveLevel(1)) {
JU.Logger._logger.fatal(txt);
}} catch (t) {
}
}, "~S");
c$.fatalEx = Clazz_defineMethod(c$, "fatalEx", 
function(txt, e){
try {
if (JU.Logger.isActiveLevel(1)) {
JU.Logger._logger.fatalEx(txt, e);
}} catch (t) {
}
}, "~S,Throwable");
c$.startTimer = Clazz_defineMethod(c$, "startTimer", 
function(msg){
if (msg != null) JU.Logger.htTiming.put(msg, Long.$valueOf(System.currentTimeMillis()));
}, "~S");
c$.getTimerMsg = Clazz_defineMethod(c$, "getTimerMsg", 
function(msg, time){
if (time == 0) time = JU.Logger.getTimeFrom(msg);
return "Time for " + msg + ": " + (time) + " ms";
}, "~S,~N");
c$.getTimeFrom = Clazz_defineMethod(c$, "getTimeFrom", 
function(msg){
var t;
return (msg == null || (t = JU.Logger.htTiming.get(msg)) == null ? -1 : System.currentTimeMillis() - t.longValue());
}, "~S");
c$.checkTimer = Clazz_defineMethod(c$, "checkTimer", 
function(msg, andReset){
var time = JU.Logger.getTimeFrom(msg);
if (time >= 0 && !msg.startsWith("(")) JU.Logger.info(JU.Logger.getTimerMsg(msg, time));
if (andReset) JU.Logger.startTimer(msg);
return time;
}, "~S,~B");
c$.checkMemory = Clazz_defineMethod(c$, "checkMemory", 
function(){
var bTotal = 0;
var bFree = 0;
var bMax = 0;
{
}JU.Logger.info("Memory: Total-Free=" + (bTotal - bFree) + "; Total=" + bTotal + "; Free=" + bFree + "; Max=" + bMax);
});
c$._logger =  new JU.DefaultLogger();
c$._activeLevels =  Clazz_newBooleanArray(7, false);
c$._logLevel = false;
c$.debugging = false;
c$.debuggingHigh = false;
{
JU.Logger._activeLevels[6] = JU.Logger.getProperty("debugHigh", false);
JU.Logger._activeLevels[5] = JU.Logger.getProperty("debug", false);
JU.Logger._activeLevels[4] = JU.Logger.getProperty("info", true);
JU.Logger._activeLevels[3] = JU.Logger.getProperty("warn", true);
JU.Logger._activeLevels[2] = JU.Logger.getProperty("error", true);
JU.Logger._activeLevels[1] = JU.Logger.getProperty("fatal", true);
JU.Logger._logLevel = JU.Logger.getProperty("logLevel", false);
JU.Logger.debugging = (JU.Logger._logger != null && (JU.Logger._activeLevels[5] || JU.Logger._activeLevels[6]));
JU.Logger.debuggingHigh = (JU.Logger.debugging && JU.Logger._activeLevels[6]);
}c$.htTiming =  new java.util.Hashtable();
});
;//5.0.1-v7 Mon Aug 17 10:07:10 MDT 2026
Clazz_declarePackage("JU");
Clazz_declareInterface(JU, "LoggerInterface");
;//5.0.1-v7 Mon Aug 17 10:07:10 MDT 2026
Clazz_declarePackage("JU");
Clazz_declareInterface(JU, "SimpleNode");
;//5.0.1-v7 Mon Aug 17 10:07:10 MDT 2026
Clazz_declarePackage("JU");
Clazz_declareInterface(JU, "SimpleEdge");
;//5.0.1-v7 Mon Aug 17 10:07:10 MDT 2026
Clazz_declarePackage("JU");
Clazz_declareInterface(JU, "Node", JU.SimpleNode);
;//5.0.1-v7 Mon Aug 17 10:07:10 MDT 2026
Clazz_declarePackage("JU");
Clazz_load(["java.lang.Enum", "JU.SimpleEdge"], "JU.Edge", ["JU.PT"], function(){
var c$ = Clazz_decorateAsClass(function(){
this.index = -1;
this.order = 0;
Clazz_instantialize(this, arguments);}, JU, "Edge", null, JU.SimpleEdge);
Clazz_defineMethod(c$, "isPartial", 
function(){
return !this.isPymolMultiple() && ((this.order & 224) != 0 && !this.isStereo() && !this.isPymolMultiple());
});
Clazz_defineMethod(c$, "isPymolMultiple", 
function(){
return ((this.order & 98304) == 98304);
});
Clazz_defineMethod(c$, "isStereo", 
function(){
return ((this.order & 1024) != 0);
});
c$.getArgbHbondType = Clazz_defineMethod(c$, "getArgbHbondType", 
function(order){
var argbIndex = ((order & 30720) >> 11);
return JU.Edge.argbsHbondType[argbIndex];
}, "~N");
c$.getBondOrderNumberFromOrder = Clazz_defineMethod(c$, "getBondOrderNumberFromOrder", 
function(order){
order &= 131071;
switch (order) {
case 131071:
case 65535:
return "0";
case 1025:
case 1041:
return "1";
case 32768:
break;
default:
if ((order & 98304) != 0) order = order & 3;
break;
}
if (JU.Edge.isOrderH(order) || JU.Edge.isAtropism(order) || (order & 256) != 0) return "1";
if ((order & 224) != 0) return (order >> 5) + "." + (order & 0x1F);
return JU.Edge.EnumBondOrder.getNumberFromCode(order);
}, "~N");
c$.getCmlBondOrder = Clazz_defineMethod(c$, "getCmlBondOrder", 
function(order){
var sname = JU.Edge.getBondOrderNameFromOrder(order);
switch ((sname.charAt(0)).charCodeAt(0)) {
case 115:
case 100:
case 116:
return "" + sname.toUpperCase().charAt(0);
case 97:
if (sname.indexOf("Double") >= 0) return "D";
 else if (sname.indexOf("Single") >= 0) return "S";
return "aromatic";
case 112:
if (sname.indexOf(" ") >= 0) return sname.substring(sname.indexOf(" ") + 1);
return "partial12";
}
return null;
}, "~N");
c$.getBondOrderNameFromOrder = Clazz_defineMethod(c$, "getBondOrderNameFromOrder", 
function(order){
order &= 131071;
switch (order) {
case 65535:
case 131071:
return "";
case 1025:
return "near";
case 1041:
return "far";
case 32768:
return JU.Edge.EnumBondOrder.STRUT.$$name;
case 1:
return JU.Edge.EnumBondOrder.SINGLE.$$name;
case 2:
return JU.Edge.EnumBondOrder.DOUBLE.$$name;
default:
if ((order & 98304) != 0) order &= 3;
break;
}
if ((order & 224) != 0) return "partial " + JU.Edge.getBondOrderNumberFromOrder(order);
if (JU.Edge.isOrderH(order)) return JU.Edge.EnumBondOrder.H_REGULAR.$$name;
if ((order & 65537) == 65537) {
var code = JU.Edge.getAtropismCode(order);
return "atropisomer_" + (Clazz_doubleToInt(code / 4)) + (code % 4);
}if ((order & 256) != 0) return JU.Edge.EnumBondOrder.SINGLE.$$name;
return JU.Edge.EnumBondOrder.getNameFromCode(order);
}, "~N");
c$.getAtropismOrder = Clazz_defineMethod(c$, "getAtropismOrder", 
function(nn, mm){
return JU.Edge.getAtropismOrder12(((nn) << 2) + mm);
}, "~N,~N");
c$.getAtropismOrder12 = Clazz_defineMethod(c$, "getAtropismOrder12", 
function(nnmm){
return ((nnmm << 11) | 65537);
}, "~N");
c$.getAtropismCode = Clazz_defineMethod(c$, "getAtropismCode", 
function(order){
return (order >> (11)) & 0xF;
}, "~N");
c$.getAtropismNode = Clazz_defineMethod(c$, "getAtropismNode", 
function(order, a1, isFirst){
var i1 = (order >> (11 + (isFirst ? 0 : 2))) & 3;
return a1.getEdges()[i1 - 1].getOtherNode(a1);
}, "~N,JU.Node,~B");
c$.isAtropism = Clazz_defineMethod(c$, "isAtropism", 
function(order){
return (order & 65537) == 65537;
}, "~N");
c$.isOrderH = Clazz_defineMethod(c$, "isOrderH", 
function(order){
return (order & 30720) != 0 && (order & 65537) == 0;
}, "~N");
c$.getPartialBondDotted = Clazz_defineMethod(c$, "getPartialBondDotted", 
function(order){
return (order & 0x1F);
}, "~N");
c$.getPartialBondOrder = Clazz_defineMethod(c$, "getPartialBondOrder", 
function(order){
return ((order & 1024) != 0 ? 1 : (order & 131071) >> 5);
}, "~N");
c$.getCovalentBondOrder = Clazz_defineMethod(c$, "getCovalentBondOrder", 
function(order){
if ((order & 1024) != 0) return 1;
if ((order & 1023) == 0) return 0;
order &= 131071;
if ((order & 224) != 0) return JU.Edge.getPartialBondOrder(order);
if ((order & 256) != 0) order &= -257;
if ((order & 0xF8) != 0) order = 1;
return order & 7;
}, "~N");
c$.getBondOrderFromFloat = Clazz_defineMethod(c$, "getBondOrderFromFloat", 
function(fOrder){
switch (Clazz_floatToInt(fOrder * 10)) {
case 10:
return 1;
case 5:
case -10:
return 33;
case 15:
return 515;
case -15:
return 66;
case 20:
return 2;
case 25:
return 97;
case -25:
return 100;
case 30:
return 3;
case 40:
return 4;
case 50:
return 5;
case 60:
return 6;
}
return 131071;
}, "~N");
c$.getBondOrderFromString = Clazz_defineMethod(c$, "getBondOrderFromString", 
function(s){
if (s.indexOf(' ') < 0) {
if (s.indexOf(".") >= 0) {
s = "partial " + s;
} else {
if (JU.PT.isOneOf(s, ";1;2;3;4;5;6;")) {
return (s.charAt(0)).charCodeAt(0) - 48;
}var order = JU.Edge.EnumBondOrder.getCodeFromName(s);
if (order != 131071 || !s.toLowerCase().startsWith("atropisomer_") || s.length != 14) return order;
try {
order = JU.Edge.getAtropismOrder(Integer.parseInt(s.substring(12, 13)), Integer.parseInt(s.substring(13, 14)));
} catch (e) {
if (Clazz_exceptionOf(e,"NumberFormatException")){
} else {
throw e;
}
}
return order;
}}if (s.toLowerCase().indexOf("partial ") != 0) return 131071;
s = s.substring(8).trim();
return JU.Edge.getPartialBondOrderFromFloatEncodedInt(JU.Edge.getFloatEncodedInt(s));
}, "~S");
c$.getPartialBondOrderFromFloatEncodedInt = Clazz_defineMethod(c$, "getPartialBondOrderFromFloatEncodedInt", 
function(bondOrderInteger){
return (((Clazz_doubleToInt(bondOrderInteger / 1000000)) % 7) << 5) + ((bondOrderInteger % 1000000) & 0x1F);
}, "~N");
c$.getFloatEncodedInt = Clazz_defineMethod(c$, "getFloatEncodedInt", 
function(strDecimal){
var pt = strDecimal.indexOf(".");
if (pt < 1 || strDecimal.charAt(0) == '-' || strDecimal.endsWith(".") || strDecimal.contains(".0")) return 2147483647;
var i = 0;
var j = 0;
if (pt > 0) {
try {
i = Integer.parseInt(strDecimal.substring(0, pt));
if (i < 0) i = -i;
} catch (e) {
if (Clazz_exceptionOf(e,"NumberFormatException")){
i = -1;
} else {
throw e;
}
}
}var n = strDecimal.length;
if (pt < n - 1) try {
var pt1 = pt + Math.min(6, n - pt);
j = Integer.parseInt(strDecimal.substring(pt + 1, pt1));
} catch (e) {
if (Clazz_exceptionOf(e,"NumberFormatException")){
} else {
throw e;
}
}
i = i * 1000000 + j;
return (i < 0 || i > 2147483647 ? 2147483647 : i);
}, "~S");
Clazz_overrideMethod(c$, "getBondType", 
function(){
return this.order & 131071;
});
Clazz_defineMethod(c$, "setCIPChirality", 
function(c){
}, "~N");
Clazz_defineMethod(c$, "getCIPChirality", 
function(doCalculate){
return "";
}, "~B");
/*if2*/;(function(){
var c$ = Clazz_decorateAsClass(function(){
this.code = 0;
this.number = null;
this.$$name = null;
Clazz_instantialize(this, arguments);}, JU.Edge, "EnumBondOrder", Enum);
Clazz_makeConstructor(c$, 
function(code, number, name){
this.code = code;
this.number = number;
this.$$name = name;
}, "~N,~S,~S");
c$.getCodeFromName = Clazz_defineMethod(c$, "getCodeFromName", 
function(name){
for (var item, $item = 0, $$item = JU.Edge.EnumBondOrder.values(); $item < $$item.length && ((item = $$item[$item]) || true); $item++) if (item.$$name.equalsIgnoreCase(name)) return item.code;

return 131071;
}, "~S");
c$.getNameFromCode = Clazz_defineMethod(c$, "getNameFromCode", 
function(code){
for (var item, $item = 0, $$item = JU.Edge.EnumBondOrder.values(); $item < $$item.length && ((item = $$item[$item]) || true); $item++) if (item.code == code) return item.$$name;

return "?";
}, "~N");
c$.getNumberFromCode = Clazz_defineMethod(c$, "getNumberFromCode", 
function(code){
for (var item, $item = 0, $$item = JU.Edge.EnumBondOrder.values(); $item < $$item.length && ((item = $$item[$item]) || true); $item++) if (item.code == code) return item.number;

return "?";
}, "~N");
Clazz_defineEnumConstant(c$, "SINGLE", 0, [1, "1", "single"]);
Clazz_defineEnumConstant(c$, "DOUBLE", 1, [2, "2", "double"]);
Clazz_defineEnumConstant(c$, "TRIPLE", 2, [3, "3", "triple"]);
Clazz_defineEnumConstant(c$, "QUADRUPLE", 3, [4, "4", "quadruple"]);
Clazz_defineEnumConstant(c$, "QUINTUPLE", 4, [5, "5", "quintuple"]);
Clazz_defineEnumConstant(c$, "sextuple", 5, [6, "6", "sextuple"]);
Clazz_defineEnumConstant(c$, "AROMATIC", 6, [515, "1.5", "aromatic"]);
Clazz_defineEnumConstant(c$, "STRUT", 7, [32768, "1", "struts"]);
Clazz_defineEnumConstant(c$, "H_REGULAR", 8, [2048, "1", "hbond"]);
Clazz_defineEnumConstant(c$, "PARTIAL01", 9, [33, "0.5", "partial"]);
Clazz_defineEnumConstant(c$, "PARTIAL12", 10, [66, "1.5", "partialDouble"]);
Clazz_defineEnumConstant(c$, "PARTIAL23", 11, [97, "2.5", "partialTriple"]);
Clazz_defineEnumConstant(c$, "PARTIAL32", 12, [100, "2.5", "partialTriple2"]);
Clazz_defineEnumConstant(c$, "AROMATIC_SINGLE", 13, [513, "1", "aromaticSingle"]);
Clazz_defineEnumConstant(c$, "AROMATIC_DOUBLE", 14, [514, "2", "aromaticDouble"]);
Clazz_defineEnumConstant(c$, "ATROPISOMER", 15, [65537, "1", "atropisomer"]);
Clazz_defineEnumConstant(c$, "UNSPECIFIED", 16, [17, "1", "unspecified"]);
/*eoif2*/})();
c$.argbsHbondType =  Clazz_newIntArray(-1, [0xFFFF69B4, 0xFFFFFF00, 0xFFFFFF00, 0xFFFFFFFF, 0xFFFF00FF, 0xFFFF0000, 0xFFFFA500, 0xFF00FFFF, 0xFF00FF00, 0xFFFF8080]);
});
;//5.0.1-v7 Mon Aug 17 10:07:10 MDT 2026
Clazz_declarePackage("JU");
Clazz_load(["JU.Elements"], "JU.JmolMolecule", ["java.util.Hashtable", "JU.AU", "$.BS", "$.PT"], function(){
var c$ = Clazz_decorateAsClass(function(){
this.nodes = null;
this.moleculeIndex = 0;
this.modelIndex = 0;
this.indexInModel = 0;
this.firstAtomIndex = 0;
this.ac = 0;
this.nElements = 0;
this.elementCounts = null;
this.altElementCounts = null;
this.elementNumberMax = 0;
this.altElementMax = 0;
this.mf = null;
this.atomList = null;
this.atNos = null;
Clazz_instantialize(this, arguments);}, JU, "JmolMolecule", null);
Clazz_prepareFields (c$, function(){
this.elementCounts =  Clazz_newIntArray (JU.Elements.elementNumberMax, 0);
this.altElementCounts =  Clazz_newIntArray (JU.Elements.altElementMax, 0);
});
Clazz_makeConstructor(c$, 
function(){
});
c$.getMolecules = Clazz_defineMethod(c$, "getMolecules", 
function(atoms, bsModelAtoms, biobranches, bsExclude){
var bsToTest = null;
var bsBranch =  new JU.BS();
var thisModelIndex = -1;
var indexInModel = 0;
var moleculeCount = 0;
var molecules =  new Array(4);
if (bsExclude == null) bsExclude =  new JU.BS();
for (var i = 0; i < atoms.length; i++) if (!bsExclude.get(i) && !bsBranch.get(i)) {
var a = atoms[i];
if (a == null || a.isDeleted()) {
bsExclude.set(i);
continue;
}var modelIndex = a.getModelIndex();
if (modelIndex != thisModelIndex) {
thisModelIndex = modelIndex;
indexInModel = 0;
bsToTest = bsModelAtoms[modelIndex];
}bsBranch = JU.JmolMolecule.getBranchBitSet(atoms, i, bsToTest, biobranches, -1, true, true);
if (bsBranch.nextSetBit(0) >= 0) {
molecules = JU.JmolMolecule.addMolecule(molecules, moleculeCount++, atoms, i, bsBranch, modelIndex, indexInModel++, bsExclude);
}}
return JU.JmolMolecule.allocateArray(molecules, moleculeCount);
}, "~A,~A,JU.Lst,JU.BS");
c$.getBranchBitSet = Clazz_defineMethod(c$, "getBranchBitSet", 
function(atoms, atomIndex, bsToTest, biobranches, atomIndexNot, allowCyclic, allowBioResidue){
var bs = JU.BS.newN(atoms.length);
if (atomIndex < 0) return bs;
if (atomIndexNot >= 0) bsToTest.clear(atomIndexNot);
return (JU.JmolMolecule.getCovalentlyConnectedBitSet(atoms, atoms[atomIndex], bsToTest, allowCyclic, allowBioResidue, biobranches, bs, null, null) ? bs :  new JU.BS());
}, "~A,~N,JU.BS,JU.Lst,~N,~B,~B");
c$.addMolecule = Clazz_defineMethod(c$, "addMolecule", 
function(molecules, iMolecule, atoms, iAtom, bsBranch, modelIndex, indexInModel, bsExclude){
bsExclude.or(bsBranch);
if (iMolecule == molecules.length) molecules = JU.JmolMolecule.allocateArray(molecules, iMolecule * 2 + 1);
molecules[iMolecule] = JU.JmolMolecule.initialize(atoms, iMolecule, iAtom, bsBranch, modelIndex, indexInModel);
return molecules;
}, "~A,~N,~A,~N,JU.BS,~N,~N,JU.BS");
c$.getMolecularFormulaAtoms = Clazz_defineMethod(c$, "getMolecularFormulaAtoms", 
function(atoms, bsSelected, wts, isEmpirical){
var m =  new JU.JmolMolecule();
m.nodes = atoms;
m.atomList = bsSelected;
return m.getMolecularFormula(false, wts, isEmpirical);
}, "~A,JU.BS,~A,~B");
Clazz_defineMethod(c$, "getMolecularFormula", 
function(includeMissingHydrogens, wts, isEmpirical){
this.getMFArray(includeMissingHydrogens, wts, isEmpirical);
if (this.elementCounts[0] < 0) return "?";
var mf = "";
var sep = "";
var nX;
for (var i = 1; i <= this.elementNumberMax; i++) {
nX = this.elementCounts[i];
if (nX != 0) {
mf += sep + JU.Elements.elementSymbolFromNumber(i) + " " + nX;
sep = " ";
}}
return mf;
}, "~B,~A,~B");
Clazz_defineMethod(c$, "getMFArray", 
function(includeMissingHydrogens, wts, isEmpirical){
if (this.atomList == null) {
this.atomList =  new JU.BS();
this.atomList.setBits(0, this.atNos == null ? this.nodes.length : this.atNos.length);
}this.elementCounts =  Clazz_newIntArray (JU.Elements.elementNumberMax, 0);
this.altElementCounts =  Clazz_newIntArray (JU.Elements.altElementMax, 0);
this.ac = this.atomList.cardinality();
this.nElements = 0;
for (var p = 0, i = this.atomList.nextSetBit(0); i >= 0; i = this.atomList.nextSetBit(i + 1), p++) {
var n;
var node = null;
if (this.atNos == null) {
node = this.nodes[i];
if (node == null) continue;
n = node.getAtomicAndIsotopeNumber();
} else {
n = this.atNos[i];
}var f = (wts == null ? 1 : Clazz_floatToInt(8 * wts[p]));
if (n < JU.Elements.elementNumberMax) {
if (this.elementCounts[n] == 0) this.nElements++;
this.elementCounts[n] += f;
this.elementNumberMax = Math.max(this.elementNumberMax, n);
} else {
n = JU.Elements.altElementIndexFromNumber(n);
if (this.altElementCounts[n] == 0) this.nElements++;
this.altElementCounts[n] += f;
this.altElementMax = Math.max(this.altElementMax, n);
}if (includeMissingHydrogens) {
var nH = Math.max(0, node.getImplicitHydrogenCount()) + Math.max(node.getExplicitHydrogenCount(), 0);
if (nH > 0) {
if (this.elementCounts[1] == 0) this.nElements++;
this.elementCounts[1] += nH * f;
this.elementNumberMax = Math.max(this.elementNumberMax, 1);
}}}
if (wts != null) for (var i = 1; i <= this.elementNumberMax; i++) {
var c = Clazz_doubleToInt(this.elementCounts[i] / 8);
if (c * 8 != this.elementCounts[i]) {
this.elementCounts[0] = -1;
return this.elementCounts;
}this.elementCounts[i] = c;
}
if (isEmpirical) {
var min = 2;
var ok = true;
while (ok) {
min = 100000;
var c;
for (var i = 1; i <= this.elementNumberMax; i++) if ((c = this.elementCounts[i]) > 0 && c < min) min = c;

if (min == 1) break;
var j = min;
for (; j > 1; j--) {
ok = true;
for (var i = 1; i <= this.elementNumberMax && ok; i++) if (Clazz_doubleToInt((c = this.elementCounts[i]) / j) * j != c) ok = false;

if (ok) {
for (var i = 1; i <= this.elementNumberMax; i++) this.elementCounts[i] /= j;

break;
}}
}
}return this.elementCounts;
}, "~B,~A,~B");
c$.initialize = Clazz_defineMethod(c$, "initialize", 
function(nodes, moleculeIndex, firstAtomIndex, atomList, modelIndex, indexInModel){
var jm =  new JU.JmolMolecule();
jm.nodes = nodes;
jm.firstAtomIndex = firstAtomIndex;
jm.atomList = atomList;
jm.ac = atomList.cardinality();
jm.moleculeIndex = moleculeIndex;
jm.modelIndex = modelIndex;
jm.indexInModel = indexInModel;
return jm;
}, "~A,~N,~N,JU.BS,~N,~N");
c$.getCovalentlyConnectedBitSet = Clazz_defineMethod(c$, "getCovalentlyConnectedBitSet", 
function(atoms, atom, bsToTest, allowCyclic, allowBioResidue, biobranches, bsResult, origAtom, prevAtom){
var atomIndex = atom.getIndex();
if (!bsToTest.get(atomIndex)) return allowCyclic;
if (!allowBioResidue && atom.getBioStructureTypeName().length > 0) return allowCyclic;
bsToTest.clear(atomIndex);
if (biobranches != null && !bsResult.get(atomIndex)) {
for (var i = biobranches.size(); --i >= 0; ) {
var b = biobranches.get(i);
if (b.get(atomIndex)) {
bsResult.or(b);
bsToTest.andNot(b);
for (var j = b.nextSetBit(0); j >= 0; j = b.nextSetBit(j + 1)) {
var atom1 = atoms[j];
if (atom1 == null) continue;
bsToTest.set(j);
JU.JmolMolecule.getCovalentlyConnectedBitSet(atoms, atom1, bsToTest, allowCyclic, allowBioResidue, biobranches, bsResult, origAtom, atom);
bsToTest.clear(j);
}
break;
}}
}bsResult.set(atomIndex);
var bonds = atom.getEdges();
if (bonds == null) return true;
for (var i = bonds.length; --i >= 0; ) {
var bond = bonds[i];
if (bond != null && bond.isCovalent()) {
var n = bond.getOtherNode(atom);
if (n === prevAtom) continue;
if (n === origAtom) return false;
if (!JU.JmolMolecule.getCovalentlyConnectedBitSet(atoms, n, bsToTest, allowCyclic, allowBioResidue, biobranches, bsResult, origAtom, atom)) return false;
}}
return true;
}, "~A,JU.Node,JU.BS,~B,~B,JU.Lst,JU.BS,JU.Node,JU.Node");
c$.allocateArray = Clazz_defineMethod(c$, "allocateArray", 
function(molecules, len){
return (len == molecules.length ? molecules : JU.AU.arrayCopyObject(molecules, len));
}, "~A,~N");
c$.getBitSetForMF = Clazz_defineMethod(c$, "getBitSetForMF", 
function(at, bsAtoms, mf){
var map =  new java.util.Hashtable();
var ch;
var isDigit;
mf = JU.PT.rep(JU.PT.clean(mf + "Z"), " ", "");
for (var i = 0, pt = 0, pt0 = 0, n = mf.length; i < n; i++) {
if ((isDigit = Character.isDigit((ch = mf.charAt(i)))) || i > 0 && Character.isUpperCase(ch)) {
pt0 = i;
var s = mf.substring(pt, pt0).trim();
if (isDigit) while (i < n && Character.isDigit(mf.charAt(i))) i++;

pt = i;
map.put(s,  Clazz_newIntArray(-1, [isDigit ? JU.PT.parseInt(mf.substring(pt0, pt)) : 1]));
}}
var bs =  new JU.BS();
for (var i = bsAtoms.nextSetBit(0); i >= 0; i = bsAtoms.nextSetBit(i + 1)) {
var a = at[i].getElementSymbol();
var c = map.get(a);
if (c == null || c[0]-- < 1) continue;
bs.set(i);
}
for (var e, $e = map.values().iterator (); $e.hasNext()&& ((e = $e.next ()) || true);) if (e[0] > 0) return  new JU.BS();

return bs;
}, "~A,JU.BS,~S");
c$.getBranchesForInversion = Clazz_defineMethod(c$, "getBranchesForInversion", 
function(at, atomIndex, bsToTest){
var bs =  new JU.BS();
var a = at[atomIndex];
var bonds = a.getEdges();
for (var i = a.getBondCount(); --i >= 0; ) {
if (bonds[i].getBondType() == 1) bs.set(bonds[i].getOtherNode(a).getIndex());
}
if (bs.cardinality() < 2) {
bs.clearAll();
} else {
for (var i = bs.nextSetBit(0); i >= 0; i = bs.nextSetBit(i + 1)) {
if (at[i].getCovalentBondCount() == 1) continue;
var bs0 = JU.BS.copy(bsToTest);
bs0.clear(atomIndex);
var bs1 = JU.BS.newN(at.length);
if (!JU.JmolMolecule.getCovalentlyConnectedBitSet(at, at[i], bs0, true, true, null, bs1, at[atomIndex], at[atomIndex])) {
bs.clear(i);
}}
}return bs;
}, "~A,~N,JU.BS");
});
;//5.0.1-v7 Mon Aug 17 10:07:10 MDT 2026
Clazz_declarePackage("JU");
Clazz_load(["java.util.Hashtable", "JU.DefaultLogger"], "JU.Logger", null, function(){
var c$ = Clazz_declareType(JU, "Logger", null);
c$.getProperty = Clazz_defineMethod(c$, "getProperty", 
function(level, defaultValue){
try {
var property = System.getProperty("jmol.logger." + level, null);
if (property != null) {
return (property.equalsIgnoreCase("true"));
}} catch (e) {
if (Clazz_exceptionOf(e, Exception)){
} else {
throw e;
}
}
return defaultValue;
}, "~S,~B");
c$.setLogger = Clazz_defineMethod(c$, "setLogger", 
function(logger){
JU.Logger._logger = logger;
JU.Logger.debugging = JU.Logger.isActiveLevel(5) || JU.Logger.isActiveLevel(6);
JU.Logger.debuggingHigh = (JU.Logger.debugging && JU.Logger._activeLevels[6]);
}, "JU.LoggerInterface");
c$.isActiveLevel = Clazz_defineMethod(c$, "isActiveLevel", 
function(level){
return JU.Logger._logger != null && level >= 0 && level < 7 && JU.Logger._activeLevels[level];
}, "~N");
c$.setActiveLevel = Clazz_defineMethod(c$, "setActiveLevel", 
function(level, active){
if (level < 0) level = 0;
if (level >= 7) level = 6;
JU.Logger._activeLevels[level] = active;
JU.Logger.debugging = JU.Logger.isActiveLevel(5) || JU.Logger.isActiveLevel(6);
JU.Logger.debuggingHigh = (JU.Logger.debugging && JU.Logger._activeLevels[6]);
}, "~N,~B");
c$.setLogLevel = Clazz_defineMethod(c$, "setLogLevel", 
function(level){
for (var i = 7; --i >= 0; ) JU.Logger.setActiveLevel(i, i <= level);

}, "~N");
c$.getLevel = Clazz_defineMethod(c$, "getLevel", 
function(level){
switch (level) {
case 6:
return "DEBUGHIGH";
case 5:
return "DEBUG";
case 4:
return "INFO";
case 3:
return "WARN";
case 2:
return "ERROR";
case 1:
return "FATAL";
}
return "????";
}, "~N");
c$.logLevel = Clazz_defineMethod(c$, "logLevel", 
function(){
return JU.Logger._logLevel;
});
c$.doLogLevel = Clazz_defineMethod(c$, "doLogLevel", 
function(log){
JU.Logger._logLevel = log;
}, "~B");
c$.debug = Clazz_defineMethod(c$, "debug", 
function(txt){
if (!JU.Logger.debugging) return;
try {
JU.Logger._logger.debug(txt);
} catch (t) {
}
}, "~S");
c$.info = Clazz_defineMethod(c$, "info", 
function(txt){
try {
if (JU.Logger.isActiveLevel(4)) {
JU.Logger._logger.info(txt);
}} catch (t) {
}
}, "~S");
c$.warn = Clazz_defineMethod(c$, "warn", 
function(txt){
try {
if (JU.Logger.isActiveLevel(3)) {
JU.Logger._logger.warn(txt);
}} catch (t) {
}
}, "~S");
c$.warnEx = Clazz_defineMethod(c$, "warnEx", 
function(txt, e){
try {
if (JU.Logger.isActiveLevel(3)) {
JU.Logger._logger.warnEx(txt, e);
}} catch (t) {
}
}, "~S,Throwable");
c$.error = Clazz_defineMethod(c$, "error", 
function(txt){
try {
if (JU.Logger.isActiveLevel(2)) {
JU.Logger._logger.error(txt);
}} catch (t) {
}
}, "~S");
c$.errorEx = Clazz_defineMethod(c$, "errorEx", 
function(txt, e){
try {
if (JU.Logger.isActiveLevel(2)) {
JU.Logger._logger.errorEx(txt, e);
}} catch (t) {
}
}, "~S,Throwable");
c$.getLogLevel = Clazz_defineMethod(c$, "getLogLevel", 
function(){
for (var i = 7; --i >= 0; ) if (JU.Logger.isActiveLevel(i)) return i;

return 0;
});
c$.fatal = Clazz_defineMethod(c$, "fatal", 
function(txt){
try {
if (JU.Logger.isActiveLevel(1)) {
JU.Logger._logger.fatal(txt);
}} catch (t) {
}
}, "~S");
c$.fatalEx = Clazz_defineMethod(c$, "fatalEx", 
function(txt, e){
try {
if (JU.Logger.isActiveLevel(1)) {
JU.Logger._logger.fatalEx(txt, e);
}} catch (t) {
}
}, "~S,Throwable");
c$.startTimer = Clazz_defineMethod(c$, "startTimer", 
function(msg){
if (msg != null) JU.Logger.htTiming.put(msg, Long.$valueOf(System.currentTimeMillis()));
}, "~S");
c$.getTimerMsg = Clazz_defineMethod(c$, "getTimerMsg", 
function(msg, time){
if (time == 0) time = JU.Logger.getTimeFrom(msg);
return "Time for " + msg + ": " + (time) + " ms";
}, "~S,~N");
c$.getTimeFrom = Clazz_defineMethod(c$, "getTimeFrom", 
function(msg){
var t;
return (msg == null || (t = JU.Logger.htTiming.get(msg)) == null ? -1 : System.currentTimeMillis() - t.longValue());
}, "~S");
c$.checkTimer = Clazz_defineMethod(c$, "checkTimer", 
function(msg, andReset){
var time = JU.Logger.getTimeFrom(msg);
if (time >= 0 && !msg.startsWith("(")) JU.Logger.info(JU.Logger.getTimerMsg(msg, time));
if (andReset) JU.Logger.startTimer(msg);
return time;
}, "~S,~B");
c$.checkMemory = Clazz_defineMethod(c$, "checkMemory", 
function(){
var bTotal = 0;
var bFree = 0;
var bMax = 0;
{
}JU.Logger.info("Memory: Total-Free=" + (bTotal - bFree) + "; Total=" + bTotal + "; Free=" + bFree + "; Max=" + bMax);
});
c$._logger =  new JU.DefaultLogger();
c$._activeLevels =  Clazz_newBooleanArray(7, false);
c$._logLevel = false;
c$.debugging = false;
c$.debuggingHigh = false;
{
JU.Logger._activeLevels[6] = JU.Logger.getProperty("debugHigh", false);
JU.Logger._activeLevels[5] = JU.Logger.getProperty("debug", false);
JU.Logger._activeLevels[4] = JU.Logger.getProperty("info", true);
JU.Logger._activeLevels[3] = JU.Logger.getProperty("warn", true);
JU.Logger._activeLevels[2] = JU.Logger.getProperty("error", true);
JU.Logger._activeLevels[1] = JU.Logger.getProperty("fatal", true);
JU.Logger._logLevel = JU.Logger.getProperty("logLevel", false);
JU.Logger.debugging = (JU.Logger._logger != null && (JU.Logger._activeLevels[5] || JU.Logger._activeLevels[6]));
JU.Logger.debuggingHigh = (JU.Logger.debugging && JU.Logger._activeLevels[6]);
}c$.htTiming =  new java.util.Hashtable();
});
;//5.0.1-v7 Mon Aug 17 10:07:10 MDT 2026
Clazz_declarePackage("JU");
Clazz_declareInterface(JU, "LoggerInterface");
;//5.0.1-v7 Mon Aug 17 10:07:10 MDT 2026
Clazz_declarePackage("JU");
Clazz_load(["JU.V3"], "JU.Measure", ["javajs.api.Interface", "JU.Lst", "$.M3", "$.P3", "$.P4", "$.Quat"], function(){
var c$ = Clazz_declareType(JU, "Measure", null);
c$.computeAngle = Clazz_defineMethod(c$, "computeAngle", 
function(pointA, pointB, pointC, vectorBA, vectorBC, asDegrees){
vectorBA.sub2(pointA, pointB);
vectorBC.sub2(pointC, pointB);
var angle = vectorBA.angle(vectorBC);
return (asDegrees ? angle / 0.017453292 : angle);
}, "JU.T3,JU.T3,JU.T3,JU.V3,JU.V3,~B");
c$.computeAngleABC = Clazz_defineMethod(c$, "computeAngleABC", 
function(pointA, pointB, pointC, asDegrees){
var vectorBA =  new JU.V3();
var vectorBC =  new JU.V3();
return JU.Measure.computeAngle(pointA, pointB, pointC, vectorBA, vectorBC, asDegrees);
}, "JU.T3,JU.T3,JU.T3,~B");
c$.computeTorsion = Clazz_defineMethod(c$, "computeTorsion", 
function(p1, p2, p3, p4, asDegrees){
if (p1.distanceSquared(p2) < 1e-10) return 0;
var ijx = p1.x - p2.x;
var ijy = p1.y - p2.y;
var ijz = p1.z - p2.z;
var kjx = p3.x - p2.x;
var kjy = p3.y - p2.y;
var kjz = p3.z - p2.z;
var klx = p3.x - p4.x;
var kly = p3.y - p4.y;
var klz = p3.z - p4.z;
var ax = ijy * kjz - ijz * kjy;
var ay = ijz * kjx - ijx * kjz;
var az = ijx * kjy - ijy * kjx;
var cx = kjy * klz - kjz * kly;
var cy = kjz * klx - kjx * klz;
var cz = kjx * kly - kjy * klx;
var ai2 = 1 / (ax * ax + ay * ay + az * az);
var ci2 = 1 / (cx * cx + cy * cy + cz * cz);
var ai = Math.sqrt(ai2);
var ci = Math.sqrt(ci2);
var denom = ai * ci;
var cross = ax * cx + ay * cy + az * cz;
var cosang = cross * denom;
if (cosang > 1) {
cosang = 1;
}if (cosang < -1) {
cosang = -1;
}var torsion = Math.acos(cosang);
var dot = ijx * cx + ijy * cy + ijz * cz;
var absDot = Math.abs(dot);
torsion = (dot / absDot > 0) ? torsion : -torsion;
return (asDegrees ? torsion / 0.017453292 : torsion);
}, "JU.T3,JU.T3,JU.T3,JU.T3,~B");
c$.getPlaneThroughPoints = Clazz_defineMethod(c$, "getPlaneThroughPoints", 
function(pointA, pointB, pointC, vNorm, vAB, plane){
if (vNorm == null) vNorm =  new JU.V3();
if (vAB == null) vAB =  new JU.V3();
var w = JU.Measure.getNormalThroughPoints(pointA, pointB, pointC, vNorm, vAB);
plane.set4(vNorm.x, vNorm.y, vNorm.z, w);
return plane;
}, "JU.T3,JU.T3,JU.T3,JU.V3,JU.V3,JU.P4");
c$.getPlaneThroughPoint = Clazz_defineMethod(c$, "getPlaneThroughPoint", 
function(pt, normal, plane){
plane.set4(normal.x, normal.y, normal.z, -normal.dot(pt));
}, "JU.T3,JU.V3,JU.P4");
c$.distanceToPlane = Clazz_defineMethod(c$, "distanceToPlane", 
function(plane, pt){
return (plane == null ? NaN : (plane.dot(pt) + plane.w) / Math.sqrt(plane.dot(plane)));
}, "JU.P4,JU.T3");
c$.directedDistanceToPlane = Clazz_defineMethod(c$, "directedDistanceToPlane", 
function(pt, plane, ptref){
var f = plane.dot(pt) + plane.w;
var f1 = plane.dot(ptref) + plane.w;
return Math.signum(f1) * f / Math.sqrt(plane.dot(plane));
}, "JU.P3,JU.P4,JU.P3");
c$.distanceToPlaneD = Clazz_defineMethod(c$, "distanceToPlaneD", 
function(plane, d, pt){
return (plane == null ? NaN : (plane.dot(pt) + plane.w) / d);
}, "JU.P4,~N,JU.P3");
c$.distanceToPlaneV = Clazz_defineMethod(c$, "distanceToPlaneV", 
function(norm, w, pt){
return (norm == null ? NaN : (norm.dot(pt) + w) / Math.sqrt(norm.dot(norm)));
}, "JU.V3,~N,JU.P3");
c$.calcNormalizedNormal = Clazz_defineMethod(c$, "calcNormalizedNormal", 
function(pointA, pointB, pointC, vNormNorm, vAB){
vAB.sub2(pointB, pointA);
vNormNorm.sub2(pointC, pointA);
vNormNorm.cross(vAB, vNormNorm);
vNormNorm.normalize();
}, "JU.T3,JU.T3,JU.T3,JU.T3,JU.T3");
c$.getDirectedNormalThroughPoints = Clazz_defineMethod(c$, "getDirectedNormalThroughPoints", 
function(pointA, pointB, pointC, ptRef, vNorm, vAB){
var nd = JU.Measure.getNormalThroughPoints(pointA, pointB, pointC, vNorm, vAB);
if (ptRef != null) {
var pt0 = JU.P3.newP(pointA);
pt0.add(vNorm);
var d = pt0.distance(ptRef);
pt0.sub2(pointA, vNorm);
if (d > pt0.distance(ptRef)) {
vNorm.scale(-1);
nd = -nd;
}}return nd;
}, "JU.T3,JU.T3,JU.T3,JU.T3,JU.V3,JU.V3");
c$.getNormalThroughPoints = Clazz_defineMethod(c$, "getNormalThroughPoints", 
function(pointA, pointB, pointC, vNorm, vTemp){
JU.Measure.calcNormalizedNormal(pointA, pointB, pointC, vNorm, vTemp);
vTemp.setT(pointA);
return -vTemp.dot(vNorm);
}, "JU.T3,JU.T3,JU.T3,JU.T3,JU.T3");
c$.getPlaneProjection = Clazz_defineMethod(c$, "getPlaneProjection", 
function(pt, plane, retPtProj, retNorm){
var dist = JU.Measure.distanceToPlane(plane, pt);
retNorm.set(plane.x, plane.y, plane.z);
retNorm.normalize();
if (dist > 0) retNorm.scale(-1);
retPtProj.scaleAdd2(Math.abs(dist), retNorm, pt);
return dist;
}, "JU.T3,JU.P4,JU.T3,JU.V3");
c$.getNormalFromCenter = Clazz_defineMethod(c$, "getNormalFromCenter", 
function(ptCenter, ptA, ptB, ptC, isOutward, normal, vTemp){
var d = JU.Measure.getNormalThroughPoints(ptA, ptB, ptC, normal, vTemp);
var isReversed = (JU.Measure.distanceToPlaneV(normal, d, ptCenter) > 0);
if (isReversed == isOutward) normal.scale(-1.0);
return !isReversed;
}, "JU.P3,JU.P3,JU.P3,JU.P3,~B,JU.V3,JU.V3");
c$.getNormalToLine = Clazz_defineMethod(c$, "getNormalToLine", 
function(pointA, pointB, vNormNorm){
vNormNorm.sub2(pointA, pointB);
vNormNorm.cross(vNormNorm, JU.Measure.axisY);
vNormNorm.normalize();
if (Float.isNaN(vNormNorm.x)) vNormNorm.set(1, 0, 0);
}, "JU.P3,JU.P3,JU.V3");
c$.getBisectingPlane = Clazz_defineMethod(c$, "getBisectingPlane", 
function(pointA, vAB, ptTemp, vTemp, plane){
ptTemp.scaleAdd2(0.5, vAB, pointA);
vTemp.setT(vAB);
vTemp.normalize();
JU.Measure.getPlaneThroughPoint(ptTemp, vTemp, plane);
}, "JU.P3,JU.V3,JU.T3,JU.V3,JU.P4");
c$.projectOntoAxis = Clazz_defineMethod(c$, "projectOntoAxis", 
function(pt, ptA, axisUnitVector, vectorProjection){
vectorProjection.sub2(pt, ptA);
var projectedLength = vectorProjection.dot(axisUnitVector);
pt.scaleAdd2(projectedLength, axisUnitVector, ptA);
vectorProjection.sub2(pt, ptA);
return projectedLength;
}, "JU.P3,JU.P3,JU.V3,JU.V3");
c$.calcBestAxisThroughPoints = Clazz_defineMethod(c$, "calcBestAxisThroughPoints", 
function(points, nPoints, axisA, axisUnitVector, vectorProjection, nTriesMax){
axisA.setT(points[0]);
axisUnitVector.sub2(points[nPoints - 1], axisA);
axisUnitVector.normalize();
JU.Measure.calcAveragePointN(points, nPoints, axisA);
var nTries = 0;
while (nTries++ < nTriesMax && JU.Measure.findAxis(points, nPoints, axisA, axisUnitVector, vectorProjection) > 0.001) {
}
var tempA = JU.P3.newP(points[0]);
JU.Measure.projectOntoAxis(tempA, axisA, axisUnitVector, vectorProjection);
axisA.setT(tempA);
}, "~A,~N,JU.P3,JU.V3,JU.V3,~N");
c$.findAxis = Clazz_defineMethod(c$, "findAxis", 
function(points, nPoints, axisA, axisUnitVector, vectorProjection){
var sumXiYi =  new JU.V3();
var vTemp =  new JU.V3();
var pt =  new JU.P3();
var ptProj =  new JU.P3();
var a = JU.V3.newV(axisUnitVector);
var sum_Xi2 = 0;
for (var i = nPoints; --i >= 0; ) {
pt.setT(points[i]);
ptProj.setT(pt);
JU.Measure.projectOntoAxis(ptProj, axisA, axisUnitVector, vectorProjection);
vTemp.sub2(pt, ptProj);
vTemp.cross(vectorProjection, vTemp);
sumXiYi.add(vTemp);
sum_Xi2 += vectorProjection.lengthSquared();
}
var m = JU.V3.newV(sumXiYi);
m.scale(1 / sum_Xi2);
vTemp.cross(m, axisUnitVector);
axisUnitVector.add(vTemp);
axisUnitVector.normalize();
vTemp.sub2(axisUnitVector, a);
return vTemp.length();
}, "~A,~N,JU.P3,JU.V3,JU.V3");
c$.calcAveragePoint = Clazz_defineMethod(c$, "calcAveragePoint", 
function(pointA, pointB, pointC){
pointC.set((pointA.x + pointB.x) / 2, (pointA.y + pointB.y) / 2, (pointA.z + pointB.z) / 2);
}, "JU.P3,JU.P3,JU.P3");
c$.calcAveragePointN = Clazz_defineMethod(c$, "calcAveragePointN", 
function(points, nPoints, averagePoint){
averagePoint.setT(points[0]);
for (var i = 1; i < nPoints; i++) averagePoint.add(points[i]);

averagePoint.scale(1 / nPoints);
}, "~A,~N,JU.P3");
c$.transformPoints = Clazz_defineMethod(c$, "transformPoints", 
function(vPts, m4, center){
var v =  new JU.Lst();
for (var i = 0; i < vPts.size(); i++) {
var pt = JU.P3.newP(vPts.get(i));
pt.sub(center);
m4.rotTrans(pt);
pt.add(center);
v.addLast(pt);
}
return v;
}, "JU.Lst,JU.M4,JU.P3");
c$.isInTetrahedron = Clazz_defineMethod(c$, "isInTetrahedron", 
function(pt, ptA, ptB, ptC, ptD, plane, vTemp, vTemp2, fullyEnclosed){
var b = (JU.Measure.distanceToPlane(JU.Measure.getPlaneThroughPoints(ptC, ptD, ptA, vTemp, vTemp2, plane), pt) >= 0);
if (b != (JU.Measure.distanceToPlane(JU.Measure.getPlaneThroughPoints(ptA, ptD, ptB, vTemp, vTemp2, plane), pt) >= 0)) return false;
if (b != (JU.Measure.distanceToPlane(JU.Measure.getPlaneThroughPoints(ptB, ptD, ptC, vTemp, vTemp2, plane), pt) >= 0)) return false;
var d = JU.Measure.distanceToPlane(JU.Measure.getPlaneThroughPoints(ptA, ptB, ptC, vTemp, vTemp2, plane), pt);
if (fullyEnclosed) return (b == (d >= 0));
var d1 = JU.Measure.distanceToPlane(plane, ptD);
return d1 * d <= 0 || Math.abs(d1) > Math.abs(d);
}, "JU.P3,JU.P3,JU.P3,JU.P3,JU.P3,JU.P4,JU.V3,JU.V3,~B");
c$.getIntersectionPP = Clazz_defineMethod(c$, "getIntersectionPP", 
function(plane1, plane2){
var a1 = plane1.x;
var b1 = plane1.y;
var c1 = plane1.z;
var d1 = plane1.w;
var a2 = plane2.x;
var b2 = plane2.y;
var c2 = plane2.z;
var d2 = plane2.w;
var norm1 = JU.V3.new3(a1, b1, c1);
var norm2 = JU.V3.new3(a2, b2, c2);
var nxn =  new JU.V3();
nxn.cross(norm1, norm2);
var ax = Math.abs(nxn.x);
var ay = Math.abs(nxn.y);
var az = Math.abs(nxn.z);
var x;
var y;
var z;
var diff;
var type = (ax > ay ? (ax > az ? 1 : 3) : ay > az ? 2 : 3);
switch (type) {
case 1:
x = 0;
diff = (b1 * c2 - b2 * c1);
if (Math.abs(diff) < 0.01) return null;
y = (c1 * d2 - c2 * d1) / diff;
z = (b2 * d1 - d2 * b1) / diff;
break;
case 2:
diff = (a1 * c2 - a2 * c1);
if (Math.abs(diff) < 0.01) return null;
x = (c1 * d2 - c2 * d1) / diff;
y = 0;
z = (a2 * d1 - d2 * a1) / diff;
break;
case 3:
default:
diff = (a1 * b2 - a2 * b1);
if (Math.abs(diff) < 0.01) return null;
x = (b1 * d2 - b2 * d1) / diff;
y = (a2 * d1 - d2 * a1) / diff;
z = 0;
}
var list =  new JU.Lst();
list.addLast(JU.P3.new3(x, y, z));
nxn.normalize();
list.addLast(nxn);
return list;
}, "JU.P4,JU.P4");
c$.getIntersection = Clazz_defineMethod(c$, "getIntersection", 
function(pt1, v, plane, ptRet, tempNorm, vTemp){
JU.Measure.getPlaneProjection(pt1, plane, ptRet, tempNorm);
tempNorm.set(plane.x, plane.y, plane.z);
tempNorm.normalize();
if (v == null) v = JU.V3.newV(tempNorm);
var l_dot_n = v.dot(tempNorm);
if (Math.abs(l_dot_n) < 0.01) return null;
vTemp.sub2(ptRet, pt1);
ptRet.scaleAdd2(vTemp.dot(tempNorm) / l_dot_n, v, pt1);
return ptRet;
}, "JU.P3,JU.V3,JU.P4,JU.P3,JU.V3,JU.V3");
c$.calculateQuaternionRotation = Clazz_defineMethod(c$, "calculateQuaternionRotation", 
function(centerAndPoints, retStddev){
retStddev[1] = NaN;
var q =  new JU.Quat();
var ptsA = centerAndPoints[0];
var ptsB = centerAndPoints[1];
var nPts = ptsA.length - 1;
if (nPts < 2 || ptsA.length != ptsB.length) return q;
var Sxx = 0;
var Sxy = 0;
var Sxz = 0;
var Syx = 0;
var Syy = 0;
var Syz = 0;
var Szx = 0;
var Szy = 0;
var Szz = 0;
var ptA =  new JU.P3();
var ptB =  new JU.P3();
var ptA0 = ptsA[0];
var ptB0 = ptsB[0];
for (var i = nPts + 1; --i >= 1; ) {
ptA.sub2(ptsA[i], ptA0);
ptB.sub2(ptsB[i], ptB0);
Sxx += ptA.x * ptB.x;
Sxy += ptA.x * ptB.y;
Sxz += ptA.x * ptB.z;
Syx += ptA.y * ptB.x;
Syy += ptA.y * ptB.y;
Syz += ptA.y * ptB.z;
Szx += ptA.z * ptB.x;
Szy += ptA.z * ptB.y;
Szz += ptA.z * ptB.z;
}
retStddev[0] = JU.Measure.getRmsd(centerAndPoints, q);
var N =  Clazz_newDoubleArray (4, 4, 0);
N[0][0] = Sxx + Syy + Szz;
N[0][1] = N[1][0] = Syz - Szy;
N[0][2] = N[2][0] = Szx - Sxz;
N[0][3] = N[3][0] = Sxy - Syx;
N[1][1] = Sxx - Syy - Szz;
N[1][2] = N[2][1] = Sxy + Syx;
N[1][3] = N[3][1] = Szx + Sxz;
N[2][2] = -Sxx + Syy - Szz;
N[2][3] = N[3][2] = Syz + Szy;
N[3][3] = -Sxx - Syy + Szz;
var v = (javajs.api.Interface.getInterface("JU.Eigen")).setM(N).getEigenvectorsFloatTransposed()[3];
q = JU.Quat.newP4(JU.P4.new4(v[1], v[2], v[3], v[0]));
retStddev[1] = JU.Measure.getRmsd(centerAndPoints, q);
return q;
}, "~A,~A");
c$.getTransformMatrix4 = Clazz_defineMethod(c$, "getTransformMatrix4", 
function(ptsA, ptsB, m, centerA){
var cptsA = JU.Measure.getCenterAndPoints(ptsA);
var cptsB = JU.Measure.getCenterAndPoints(ptsB);
var retStddev =  Clazz_newFloatArray (2, 0);
var q = JU.Measure.calculateQuaternionRotation( Clazz_newArray(-1, [cptsA, cptsB]), retStddev);
var r = q.getMatrix();
if (centerA == null) r.rotate(cptsA[0]);
 else centerA.setT(cptsA[0]);
var t = JU.V3.newVsub(cptsB[0], cptsA[0]);
m.setMV(r, t);
return retStddev[1];
}, "JU.Lst,JU.Lst,JU.M4,JU.P3");
c$.getCenterAndPoints = Clazz_defineMethod(c$, "getCenterAndPoints", 
function(vPts){
var n = vPts.size();
var pts =  new Array(n + 1);
pts[0] =  new JU.P3();
if (n > 0) {
for (var i = 0; i < n; i++) {
pts[0].add(pts[i + 1] = vPts.get(i));
}
pts[0].scale(1 / n);
}return pts;
}, "JU.Lst");
c$.getRmsd = Clazz_defineMethod(c$, "getRmsd", 
function(centerAndPoints, q){
var sum2 = 0;
var ptsA = centerAndPoints[0];
var ptsB = centerAndPoints[1];
var cA = ptsA[0];
var cB = ptsB[0];
var n = ptsA.length - 1;
var ptAnew =  new JU.P3();
for (var i = n + 1; --i >= 1; ) {
ptAnew.sub2(ptsA[i], cA);
q.transform2(ptAnew, ptAnew).add(cB);
sum2 += ptAnew.distanceSquared(ptsB[i]);
}
return Math.sqrt(sum2 / n);
}, "~A,JU.Quat");
c$.getBestLineThroughPoints = Clazz_defineMethod(c$, "getBestLineThroughPoints", 
function(points, nPoints){
if (nPoints <= 0) nPoints = points.length;
if (nPoints <= 2) {
return points;
}var ptA =  new JU.P3();
var unitVector =  new JU.V3();
var vTemp =  new JU.V3();
JU.Measure.calcBestAxisThroughPoints(points, nPoints, ptA, unitVector, vTemp, 8);
return JU.Measure.getProjectedLineSegment(points, nPoints, ptA, unitVector, vTemp);
}, "~A,~N");
c$.getProjectedLineSegment = Clazz_defineMethod(c$, "getProjectedLineSegment", 
function(points, nPoints, ptA, unitVector, vTemp){
if (nPoints < 0) nPoints = points.length;
if (vTemp == null) vTemp =  new JU.V3();
var pmin = null;
var pmax = null;
var p;
var dmin = 3.4028235E38;
var dmax = -3.4028235E38;
for (var i = 0; i < points.length; i++) {
JU.Measure.projectOntoAxis(p = JU.P3.newP(points[i]), ptA, unitVector, vTemp);
var d = unitVector.dot(vTemp);
if (d < dmin) {
dmin = d;
pmin = p;
}if (d > dmax) {
dmax = d;
pmax = p;
}}
return  Clazz_newArray(-1, [pmin, pmax]);
}, "~A,~N,JU.P3,JU.V3,JU.V3");
c$.isInTriangle = Clazz_defineMethod(c$, "isInTriangle", 
function(p, a, b, c, v0, v1, v2){
v0.sub2(c, a);
v1.sub2(b, a);
v2.sub2(p, a);
var dot00 = v0.dot(v0);
var dot01 = v0.dot(v1);
var dot02 = v0.dot(v2);
var dot11 = v1.dot(v1);
var dot12 = v1.dot(v2);
var invDenom = 1 / (dot00 * dot11 - dot01 * dot01);
var u = (dot11 * dot02 - dot01 * dot12) * invDenom;
var v = (dot00 * dot12 - dot01 * dot02) * invDenom;
return (u >= 0 && v >= 0 && u + v <= 1);
}, "JU.P3,JU.P3,JU.P3,JU.P3,JU.V3,JU.V3,JU.V3");
c$.calcBestPlaneThroughPoints = Clazz_defineMethod(c$, "calcBestPlaneThroughPoints", 
function(points, nPoints, plane){
if (nPoints <= 0) {
nPoints = points.length;
}if (nPoints == 3) {
JU.Measure.getPlaneThroughPoints(points[0], points[1], points[2], null, null, plane);
return 0;
}var pmin = plane;
var plane2 =  new JU.P4();
var plane3;
var rmsd = JU.Measure.calcPlaneForMode(points, nPoints, plane, 'z');
if (rmsd < 1e-6) return rmsd;
var f2 = JU.Measure.calcPlaneForMode(points, nPoints, plane2, 'y');
if (f2 < rmsd) {
rmsd = f2;
pmin = plane2;
plane3 = plane;
} else {
plane3 = plane2;
}if (rmsd >= 1e-6) {
f2 = JU.Measure.calcPlaneForMode(points, nPoints, plane3, 'x');
if (f2 < rmsd) {
rmsd = f2;
pmin = plane3;
}}if (pmin !== plane) {
plane.setT(pmin);
plane.w = pmin.w;
}return rmsd;
}, "~A,~N,JU.P4");
c$.calcPlaneForMode = Clazz_defineMethod(c$, "calcPlaneForMode", 
function(points, nPoints, plane, mode){
var A =  Clazz_newDoubleArray (nPoints, 3, 0);
var AT =  Clazz_newDoubleArray (3, nPoints, 0);
var ATAT =  Clazz_newDoubleArray (3, nPoints, 0);
var ATA1 =  Clazz_newDoubleArray (3, 3, 0);
var B =  Clazz_newDoubleArray (nPoints, 0);
for (var i = nPoints; --i >= 0; ) {
var p = points[i];
A[i][0] = AT[0][i] = (mode == 'x' ? p.z : p.x);
A[i][1] = AT[1][i] = (mode == 'y' ? p.z : p.y);
A[i][2] = AT[2][i] = 1;
B[i] = -(mode == 'y' ? p.y : mode == 'x' ? p.x : p.z);
}
var m =  new JU.M3();
for (var i = 3; --i >= 0; ) {
for (var j = 3; --j >= 0; ) {
var d = 0;
for (var k = nPoints; --k >= 0; ) {
d += AT[i][k] * A[k][j];
}
m.set33(i, j, d);
}
}
m.invert();
for (var i = 3; --i >= 0; ) {
for (var j = 3; --j >= 0; ) {
ATA1[i][j] = m.get33(i, j);
}
}
for (var i = 3; --i >= 0; ) {
for (var k = nPoints; --k >= 0; ) {
var d = 0;
for (var j = 3; --j >= 0; ) {
d += ATA1[i][j] * AT[j][k];
}
ATAT[i][k] = d;
}
}
switch ((mode).charCodeAt(0)) {
case 120:
plane.x = 1;
break;
case 121:
plane.y = 1;
break;
case 122:
plane.z = 1;
break;
}
var len2 = 1;
for (var j = 3; --j >= 0; ) {
var v = 0;
for (var k = nPoints; --k >= 0; ) {
v += ATAT[j][k] * B[k];
}
switch (j) {
case 0:
len2 += v * v;
if (mode == 'x') plane.z = v;
 else plane.x = v;
break;
case 1:
len2 += v * v;
if (mode == 'y') plane.z = v;
 else plane.y = v;
break;
case 2:
plane.w = v;
}
}
var f = Math.sqrt(len2);
plane.scale4((1 / plane.w > 0 ? 1 : -1) / f);
var sum2 = 0;
for (var i = 0; i < nPoints; i++) {
var d = JU.Measure.distanceToPlane(plane, points[i]);
sum2 += d * d;
}
var ret = Math.sqrt(sum2 / nPoints);
return ret;
}, "~A,~N,JU.P4,~S");
c$.rndPt = Clazz_defineMethod(c$, "rndPt", 
function(){
return JU.P3.new3(Math.random() * 20, (Math.random() * 20), (Math.random() * 20));
});
c$.testRnd = Clazz_defineMethod(c$, "testRnd", 
function(){
var plane = JU.P4.new4(Math.random() * 20, Math.random() * 20, Math.random() * 20, Math.random() * 20);
plane.scale4(1 / plane.length());
System.out.println("\n==========\n ");
System.out.println("plane is " + plane);
var ptProj =  new JU.P3();
var vNorm =  new JU.V3();
var pts =  new Array(4);
for (var i = 0; i < pts.length; i++) {
pts[i] =  new JU.P3();
var p = JU.Measure.rndPt();
JU.Measure.getPlaneProjection(p, plane, ptProj, vNorm);
pts[i].setT(ptProj);
var d = Math.random() * 0.1;
pts[i].scaleAdd2(d, vNorm, ptProj);
System.out.println(pts[i] + " d=" + d);
}
var p2 =  new JU.P4();
var f = JU.Measure.calcBestPlaneThroughPoints(pts, -1, p2);
System.out.println("found " + p2 + " rmsd = " + f);
});
c$.test = Clazz_defineMethod(c$, "test", 
function(){
for (var i = 0; i < 10; i++) JU.Measure.testRnd();

System.exit(0);
});
c$.getPointsOnPlane = Clazz_defineMethod(c$, "getPointsOnPlane", 
function(pts, plane){
var ret =  new JU.Lst();
for (var i = pts.length; --i >= 0; ) {
var d = Math.abs(JU.Measure.distanceToPlane(plane, pts[i]));
if (d < 0.001) {
ret.addLast(pts[i]);
}}
return ret;
}, "~A,JU.P4");
c$.getLatticePoints = Clazz_defineMethod(c$, "getLatticePoints", 
function(cpts, h, k, l){
cpts.addLast( new JU.P3());
h = (h == 0 ? 1 : Math.abs(h));
k = (k == 0 ? 1 : Math.abs(k));
l = (l == 0 ? 1 : Math.abs(l));
var n = cpts.size();
for (var ih = -h; ih <= h; ih++) {
for (var ik = -k; ik <= k; ik++) {
for (var il = -l; il <= l; il++) {
for (var i = 0; i < n; i++) {
var pt = JU.P3.new3(ih, ik, il);
pt.add(cpts.get(i));
cpts.addLast(pt);
}
}
}
}
for (var i = n; --i >= 0; ) cpts.removeItemAt(0);

return cpts;
}, "JU.Lst,~N,~N,~N");
c$.computeHelicalAxis = Clazz_defineMethod(c$, "computeHelicalAxis", 
function(a, b, dq){
var vab =  new JU.V3();
vab.sub2(b, a);
var theta = dq.getTheta();
var n = dq.getNormal();
var v_dot_n = vab.dot(n);
if (Math.abs(v_dot_n) < 0.0001) v_dot_n = 0;
var va_prime_d =  new JU.V3();
va_prime_d.cross(vab, n);
if (va_prime_d.dot(va_prime_d) != 0) va_prime_d.normalize();
var vda =  new JU.V3();
var vcb = JU.V3.newV(n);
if (v_dot_n == 0) v_dot_n = 1.4E-45;
vcb.scale(v_dot_n);
vda.sub2(vcb, vab);
vda.scale(0.5);
va_prime_d.scale(theta == 0 ? 0 : (vda.length() / Math.tan(theta / 2 / 180 * 3.141592653589793)));
var r = JU.V3.newV(va_prime_d);
if (theta != 0) r.add(vda);
var pt_a_prime = JU.P3.newP(a);
pt_a_prime.sub(r);
if (v_dot_n != 1.4E-45) n.scale(v_dot_n);
var pt_b_prime = JU.P3.newP(pt_a_prime);
pt_b_prime.add(n);
theta = JU.Measure.computeTorsion(a, pt_a_prime, pt_b_prime, b, true);
if (Float.isNaN(theta) || r.length() < 0.0001) theta = dq.getThetaDirectedV(n);
var residuesPerTurn = Math.abs(theta == 0 ? 0 : 360 / theta);
var pitch = Math.abs(v_dot_n == 1.4E-45 ? 0 : n.length() * (theta == 0 ? 1 : 360 / theta));
return  Clazz_newArray(-1, [pt_a_prime, n, r, JU.P3.new3(theta, pitch, residuesPerTurn), pt_b_prime]);
}, "JU.P3,JU.P3,JU.Quat");
c$.axisY = JU.V3.new3(0, 1, 0);
});
;//5.0.1-v7 Mon Aug 17 10:07:10 MDT 2026
Clazz_declarePackage("JU");
Clazz_load(null, "JU.MeshSurface", ["JU.AU", "$.P3", "J.api.Interface", "JU.BoxInfo", "$.C", "$.GData", "$.Geodesic"], function(){
var c$ = Clazz_decorateAsClass(function(){
this.vwr = null;
this.slicer = null;
this.oabc = null;
this.meshType = null;
this.vc = 0;
this.vs = null;
this.vvs = null;
this.vertexSource = null;
this.surfaceAtoms = null;
this.pc = 0;
this.pis = null;
this.colorsExplicit = false;
this.isDrawPolygon = false;
this.haveQuads = false;
this.colix = 0;
this.colixBack = 0;
this.isColorSolid = true;
this.offset = null;
this.altVertices = null;
this.pcs = null;
this.vcs = null;
this.normals = null;
this.normalsTemp = null;
this.normalCount = 0;
this.normixCount = 0;
this.bsPolygons = null;
this.mat4 = null;
this.surfaceSet = null;
this.vertexSets = null;
this.nSets = 0;
this.dataOnly = false;
this.lastColor = 0;
this.lastColix = 0;
this.iA = 0;
this.iB = 0;
this.iC = 0;
this.polygonCount0 = 0;
this.vertexCount0 = 0;
this.bsSlabDisplay = null;
this.bsSlabGhost = null;
this.slabMeshType = 0;
this.slabColix = 0;
this.bsDisplay = null;
this.slabOptions = null;
this.mergeVertexCount0 = 0;
this.mergePolygonCount0 = 0;
this.isMerged = false;
Clazz_instantialize(this, arguments);}, JU, "MeshSurface", null);
Clazz_defineMethod(c$, "getMeshSlicer", 
function(){
return (this.slicer == null ? this.slicer = (J.api.Interface.getInterface("JU.MeshSlicer", this.vwr, "script")).set(this) : this.slicer);
});
c$.newMesh = Clazz_defineMethod(c$, "newMesh", 
function(isAlt, vertices, vertexCount, polygonIndexes, normals, nNormals){
var ms =  new JU.MeshSurface();
ms.pis = polygonIndexes;
if (isAlt) ms.altVertices = vertices;
 else ms.vs = vertices;
ms.vc = (vertexCount == 0 ? vertices.length : vertexCount);
ms.normals = normals;
ms.normalCount = (nNormals == 0 && normals != null ? normals.length : nNormals);
return ms;
}, "~B,~A,~N,~A,~A,~N");
Clazz_defineMethod(c$, "getVertices", 
function(){
return (this.altVertices == null ? this.vs : this.altVertices);
});
Clazz_defineMethod(c$, "getFaces", 
function(){
return this.pis;
});
Clazz_defineMethod(c$, "setColix", 
function(colix){
this.colix = colix;
}, "~N");
Clazz_defineMethod(c$, "setColixBack", 
function(colix){
this.colixBack = colix;
}, "~N");
Clazz_defineMethod(c$, "addV", 
function(vertex, asCopy){
if (this.vc == 0) this.vs =  new Array(25);
 else if (this.vc == this.vs.length) this.vs = JU.AU.doubleLength(this.vs);
this.vs[this.vc] = (asCopy ? JU.P3.newP(vertex) : vertex);
return this.vc++;
}, "JU.T3,~B");
Clazz_defineMethod(c$, "addTriangle", 
function(vertexA, vertexB, vertexC){
this.addPolygon( Clazz_newIntArray(-1, [vertexA, vertexB, vertexC]), null);
}, "~N,~N,~N");
Clazz_defineMethod(c$, "addQuad", 
function(vertexA, vertexB, vertexC, vertexD){
this.haveQuads = true;
this.addPolygon( Clazz_newIntArray(-1, [vertexA, vertexB, vertexC, vertexD]), null);
}, "~N,~N,~N,~N");
Clazz_defineMethod(c$, "setPolygonCount", 
function(polygonCount){
this.pc = polygonCount;
if (polygonCount < 0) return;
if (this.pis == null || polygonCount > this.pis.length) this.pis = JU.AU.newInt2(polygonCount);
}, "~N");
Clazz_defineMethod(c$, "addVCVal", 
function(vertex, value, asCopy){
if (this.vc == 0) this.vvs =  Clazz_newFloatArray (25, 0);
 else if (this.vc >= this.vvs.length) this.vvs = JU.AU.doubleLengthF(this.vvs);
this.vvs[this.vc] = value;
return this.addV(vertex, asCopy);
}, "JU.T3,~N,~B");
Clazz_defineMethod(c$, "addTriangleCheck", 
function(vertexA, vertexB, vertexC, check, iContour, color){
return (this.vs == null || this.vvs != null && (Float.isNaN(this.vvs[vertexA]) || Float.isNaN(this.vvs[vertexB]) || Float.isNaN(this.vvs[vertexC])) || Float.isNaN(this.vs[vertexA].x) || Float.isNaN(this.vs[vertexB].x) || Float.isNaN(this.vs[vertexC].x) ? -1 : this.addPolygonV3(vertexA, vertexB, vertexC, check, iContour, color, null));
}, "~N,~N,~N,~N,~N,~N");
Clazz_defineMethod(c$, "addPolygonV3", 
function(vertexA, vertexB, vertexC, check, iContour, color, bs){
return (this.dataOnly ? this.addPolygon( Clazz_newIntArray(-1, [vertexA, vertexB, vertexC, check]), bs) : this.addPolygonC( Clazz_newIntArray(-1, [vertexA, vertexB, vertexC, check, iContour]), color, bs, (iContour < 0)));
}, "~N,~N,~N,~N,~N,~N,JU.BS");
Clazz_defineMethod(c$, "addPolygonC", 
function(polygon, color, bs, isExplicit){
if (color != 0) {
if (this.pcs == null || this.pc == 0) this.lastColor = 0;
if (isExplicit) {
this.colorsExplicit = true;
} else {
if (this.pcs == null) {
this.pcs =  Clazz_newShortArray (25, 0);
} else if (this.pc >= this.pcs.length) {
this.pcs = JU.AU.doubleLengthShort(this.pcs);
}this.pcs[this.pc] = (isExplicit ? 2047 : color == this.lastColor ? this.lastColix : (this.lastColix = JU.C.getColix(this.lastColor = color)));
}}return this.addPolygon(polygon, bs);
}, "~A,~N,JU.BS,~B");
Clazz_defineMethod(c$, "addPolygon", 
function(polygon, bs){
var n = this.pc;
if (n == 0) this.pis = JU.AU.newInt2(25);
 else if (n == this.pis.length) this.pis = JU.AU.doubleLength(this.pis);
if (bs != null) bs.set(n);
this.pis[this.pc++] = polygon;
return n;
}, "~A,JU.BS");
Clazz_defineMethod(c$, "invalidatePolygons", 
function(){
for (var i = this.pc; --i >= this.mergePolygonCount0; ) if ((this.bsSlabDisplay == null || this.bsSlabDisplay.get(i)) && this.setABC(i) == null) this.pis[i] = null;

});
Clazz_defineMethod(c$, "setABC", 
function(i){
if (this.bsSlabDisplay != null && !this.bsSlabDisplay.get(i) && (this.bsSlabGhost == null || !this.bsSlabGhost.get(i))) return null;
var polygon = this.pis[i];
if (polygon == null || polygon.length < 3) return null;
this.iA = polygon[0];
this.iB = polygon[1];
this.iC = polygon[2];
return (this.vvs == null || !Float.isNaN(this.vvs[this.iA]) && !Float.isNaN(this.vvs[this.iB]) && !Float.isNaN(this.vvs[this.iC]) ? polygon : null);
}, "~N");
Clazz_defineMethod(c$, "setTranslucentVertices", 
function(bsVertices){
}, "JU.BS");
Clazz_defineMethod(c$, "getSlabColor", 
function(){
return (this.bsSlabGhost == null ? null : JU.C.getHexCode(this.slabColix));
});
Clazz_defineMethod(c$, "getSlabType", 
function(){
return (this.bsSlabGhost != null && this.slabMeshType == 1073742018 ? "mesh" : null);
});
Clazz_defineMethod(c$, "resetSlab", 
function(){
if (this.slicer != null) this.slicer.slabPolygons(JU.GData.getSlabObjectType(1073742333, null, false, null), false);
});
Clazz_defineMethod(c$, "slabPolygonsList", 
function(slabInfo, allowCap){
this.getMeshSlicer();
for (var i = 0; i < slabInfo.size(); i++) if (!this.slicer.slabPolygons(slabInfo.get(i), allowCap)) break;

}, "JU.Lst,~B");
Clazz_defineMethod(c$, "slabBrillouin", 
function(unitCellVectors){
return;
}, "~A");
Clazz_defineMethod(c$, "getResolution", 
function(){
return 0;
});
c$.getSphereData = Clazz_defineMethod(c$, "getSphereData", 
function(lvl){
JU.Geodesic.createGeodesic(lvl);
var vertexCount = JU.Geodesic.getVertexCount(lvl);
var f = JU.Geodesic.getFaceVertexes(lvl);
var nFaces = Clazz_doubleToInt(f.length / 3);
var faces = JU.AU.newInt2(nFaces);
for (var i = 0, fpt = 0; i < nFaces; i++) {
faces[i] =  Clazz_newIntArray(-1, [f[fpt++], f[fpt++], f[fpt++]]);
}
var vectors =  new Array(vertexCount);
for (var i = 0; i < vertexCount; i++) vectors[i] = JU.Geodesic.getVertexVector(i);

return JU.MeshSurface.newMesh(true, vectors, 0, faces, vectors, 0);
}, "~N");
Clazz_defineMethod(c$, "setBox", 
function(xyzMin, xyzMax){
xyzMin.set(3.4028235E38, 3.4028235E38, 3.4028235E38);
xyzMax.set(-3.4028235E38, -3.4028235E38, -3.4028235E38);
for (var i = 0; i < this.vc; i++) {
var p = this.vs[i];
if (!Float.isNaN(p.x)) JU.BoxInfo.addPoint(p, xyzMin, xyzMax, 0);
}
}, "JU.P3,JU.P3");
Clazz_defineMethod(c$, "setBoundingBox", 
function(boundBoxPoints){
}, "~A");
c$.getSphericalInterpolationFraction = Clazz_defineMethod(c$, "getSphericalInterpolationFraction", 
function(r, valueA, valueB, d){
var ra = Math.abs(r + valueA) / d;
var rb = Math.abs(r + valueB) / d;
r /= d;
var ra2 = ra * ra;
var q = ra2 - rb * rb + 1;
var p = 4 * (r * r - ra2);
var factor = (ra < rb ? 1 : -1);
return (((q) + factor * Math.sqrt(q * q + p)) / 2);
}, "~N,~N,~N,~N");
});
;//5.0.1-v7 Mon Aug 24 10:01:38 CDT 2026
Clazz_declarePackage("JU");
Clazz_load(["JU.Geodesic"], "JU.Normix", ["JU.BS"], function(){
var c$ = Clazz_declareType(JU, "Normix", null);
c$.getNormixCount = Clazz_defineMethod(c$, "getNormixCount", 
function(){
return (JU.Normix.normixCount > 1 ? JU.Normix.normixCount : (JU.Normix.normixCount = JU.Geodesic.getVertexCount(3)));
});
c$.newVertexBitSet = Clazz_defineMethod(c$, "newVertexBitSet", 
function(){
return JU.BS.newN(JU.Normix.getNormixCount());
});
c$.getVertexVectors = Clazz_defineMethod(c$, "getVertexVectors", 
function(){
if (JU.Normix.vertexVectors == null) JU.Normix.vertexVectors = JU.Geodesic.getVertexVectors();
return JU.Normix.vertexVectors;
});
c$.setInverseNormixes = Clazz_defineMethod(c$, "setInverseNormixes", 
function(){
if (JU.Normix.inverseNormixes != null) return;
JU.Normix.getNormixCount();
JU.Normix.getVertexVectors();
JU.Normix.inverseNormixes =  Clazz_newShortArray (JU.Normix.normixCount, 0);
var bsTemp =  new JU.BS();
for (var n = JU.Normix.normixCount; --n >= 0; ) {
var v = JU.Normix.vertexVectors[n];
JU.Normix.inverseNormixes[n] = JU.Normix.getNormix(-v.x, -v.y, -v.z, 3, bsTemp);
}
});
c$.getInverseNormix = Clazz_defineMethod(c$, "getInverseNormix", 
function(normix){
return JU.Normix.inverseNormixes[normix];
}, "~N");
c$.getNeighborVertexArrays = Clazz_defineMethod(c$, "getNeighborVertexArrays", 
function(){
if (JU.Normix.neighborVertexesArrays == null) {
JU.Normix.neighborVertexesArrays = JU.Geodesic.getNeighborVertexesArrays();
}return JU.Normix.neighborVertexesArrays;
});
c$.getNormixV = Clazz_defineMethod(c$, "getNormixV", 
function(v, bsTemp){
return JU.Normix.getNormix(v.x, v.y, v.z, 3, bsTemp);
}, "JU.V3,JU.BS");
c$.get2SidedNormix = Clazz_defineMethod(c$, "get2SidedNormix", 
function(v, bsTemp){
return ~JU.Normix.getNormixV(v, bsTemp);
}, "JU.V3,JU.BS");
c$.getNormix = Clazz_defineMethod(c$, "getNormix", 
function(x, y, z, geodesicLevel, bsConsidered){
var champion;
var t;
if (z >= 0) {
champion = 0;
t = z - 1;
} else {
champion = 11;
t = z - (-1);
}bsConsidered.clearAll();
bsConsidered.set(champion);
JU.Normix.getVertexVectors();
JU.Normix.getNeighborVertexArrays();
var championDist2 = x * x + y * y + t * t;
for (var lvl = 0; lvl <= geodesicLevel; ++lvl) {
var neighborVertexes = JU.Normix.neighborVertexesArrays[lvl];
for (var offsetNeighbors = 6 * champion, i = offsetNeighbors + (champion < 12 ? 5 : 6); --i >= offsetNeighbors; ) {
var challenger = neighborVertexes[i];
if (bsConsidered.get(challenger)) continue;
bsConsidered.set(challenger);
var v = JU.Normix.vertexVectors[challenger];
var d;
d = v.x - x;
var d2 = d * d;
if (d2 >= championDist2) continue;
d = v.y - y;
d2 += d * d;
if (d2 >= championDist2) continue;
d = v.z - z;
d2 += d * d;
if (d2 >= championDist2) continue;
champion = challenger;
championDist2 = d2;
}
}
return champion;
}, "~N,~N,~N,~N,JU.BS");
c$.normixCount = 0;
c$.vertexVectors = null;
c$.inverseNormixes = null;
c$.neighborVertexesArrays = null;
});
;//5.0.1-v7 Mon Aug 17 10:07:10 MDT 2026
Clazz_declarePackage("JU");
Clazz_load(null, "JU.Parser", ["JU.PT"], function(){
var c$ = Clazz_declareType(JU, "Parser", null);
c$.parseStringInfestedFloatArray = Clazz_defineMethod(c$, "parseStringInfestedFloatArray", 
function(str, bs, data){
return JU.Parser.parseFloatArrayBsData(JU.PT.getTokens(str), bs, data);
}, "~S,JU.BS,~A");
c$.parseStringInfestedIntArray = Clazz_defineMethod(c$, "parseStringInfestedIntArray", 
function(str, dims){
var floats =  Clazz_newFloatArray (dims.length, 0);
var n = JU.Parser.parseStringInfestedFloatArray(str, null, floats);
for (var i = dims.length; --i >= 0; ) {
dims[i] = Clazz_floatToInt(floats[i]);
}
return n;
}, "~S,~A");
c$.parseFloatArrayBsData = Clazz_defineMethod(c$, "parseFloatArrayBsData", 
function(tokens, bs, data){
var len = data.length;
var nTokens = tokens.length;
var n = 0;
var max = 0;
var haveBitSet = (bs != null);
for (var i = (haveBitSet ? bs.nextSetBit(0) : 0); i >= 0 && i < len && n < nTokens; i = (haveBitSet ? bs.nextSetBit(i + 1) : i + 1)) {
var f;
while (Float.isNaN(f = JU.PT.parseFloat(tokens[n++])) && n < nTokens) {
}
if (!Float.isNaN(f)) data[(max = i)] = f;
if (n == nTokens) break;
}
return max + 1;
}, "~A,JU.BS,~A");
c$.parseFloatArrayFromMatchAndField = Clazz_defineMethod(c$, "parseFloatArrayFromMatchAndField", 
function(str, bs, fieldMatch, fieldMatchColumnCount, matchData, field, fieldColumnCount, data, firstLine){
var f;
var i = -1;
var isMatch = (matchData != null);
var lines = JU.Parser.markLines(str, (str.indexOf('\n') >= 0 ? '\n' : ';'));
var iLine = (firstLine <= 1 || firstLine >= lines.length ? 0 : firstLine - 1);
var pt = (iLine == 0 ? 0 : lines[iLine - 1]);
var nLines = lines.length;
if (data == null) data =  Clazz_newFloatArray (nLines - iLine, 0);
var len = data.length;
var minLen = (fieldColumnCount <= 0 ? Math.max(field, fieldMatch) : Math.max(field + fieldColumnCount, fieldMatch + fieldMatchColumnCount) - 1);
var haveBitSet = (bs != null);
for (; iLine < nLines; iLine++) {
var line = str.substring(pt, lines[iLine]).trim();
pt = lines[iLine];
var tokens = (fieldColumnCount <= 0 ? JU.PT.getTokens(line) : null);
if (fieldColumnCount <= 0) {
if (tokens.length < minLen || Float.isNaN(f = JU.PT.parseFloat(tokens[field - 1]))) continue;
} else {
if (line.length < minLen || Float.isNaN(f = JU.PT.parseFloat(line.substring(field - 1, field + fieldColumnCount - 1)))) continue;
}var iData;
if (isMatch) {
iData = JU.PT.parseInt(tokens == null ? line.substring(fieldMatch - 1, fieldMatch + fieldMatchColumnCount - 1) : tokens[fieldMatch - 1]);
if (iData == -2147483648 || iData < 0 || iData >= len || (iData = matchData[iData]) < 0) continue;
if (haveBitSet) bs.set(iData);
} else {
if (haveBitSet) i = bs.nextSetBit(i + 1);
 else i++;
if (i < 0 || i >= len) return data;
iData = i;
}data[iData] = f;
}
return data;
}, "~S,JU.BS,~N,~N,~A,~N,~N,~A,~N");
c$.fixDataString = Clazz_defineMethod(c$, "fixDataString", 
function(str){
str = str.$replace(';', str.indexOf('\n') < 0 ? '\n' : ' ');
str = JU.PT.trim(str, "\n \t");
str = JU.PT.rep(str, "\n ", "\n");
str = JU.PT.rep(str, "\n\n", "\n");
return str;
}, "~S");
c$.markLines = Clazz_defineMethod(c$, "markLines", 
function(data, eol){
var nLines = 0;
for (var i = data.length; --i >= 0; ) if (data.charAt(i) == eol) nLines++;

var lines =  Clazz_newIntArray (nLines + 1, 0);
nLines = 0;
var pt = 0;
while ((pt = data.indexOf(eol, pt)) >= 0) lines[nLines++] = ++pt;

lines[nLines] = data.length;
return lines;
}, "~S,~S");
});
;//5.0.1-v7 Mon Aug 17 10:07:10 MDT 2026
Clazz_declarePackage("JU");
Clazz_load(["JU.P3"], "JU.Point3fi", null, function(){
var c$ = Clazz_decorateAsClass(function(){
this.mi = -1;
this.i = 0;
this.sX = 0;
this.sY = 0;
this.sZ = 0;
this.sD = -1;
Clazz_instantialize(this, arguments);}, JU, "Point3fi", JU.P3, Cloneable);
c$.newPF = Clazz_defineMethod(c$, "newPF", 
function(p, i){
var pi =  new JU.Point3fi();
pi.setT(p);
pi.i = i;
return pi;
}, "JU.T3,~N");
c$.new4 = Clazz_defineMethod(c$, "new4", 
function(x, y, z, i){
var pi =  new JU.Point3fi();
pi.set(x, y, z);
pi.i = i;
return pi;
}, "~N,~N,~N,~N");
Clazz_defineMethod(c$, "copy", 
function(){
try {
return this.clone();
} catch (e) {
if (Clazz_exceptionOf(e,"CloneNotSupportedException")){
return null;
} else {
throw e;
}
}
});
Clazz_defineMethod(c$, "setPF", 
function(p){
this.x = p.x;
this.y = p.y;
this.z = p.z;
this.i = p.i;
}, "JU.Point3fi");
});
;//5.0.1-v7 Mon Aug 17 10:07:10 MDT 2026
Clazz_declarePackage("JU");
(function(){
var c$ = Clazz_decorateAsClass(function(){
this.x = 0;
this.y = 0;
this.width = 0;
this.height = 0;
Clazz_instantialize(this, arguments);}, JU, "Rectangle", null);
Clazz_defineMethod(c$, "contains", 
function(X, Y){
return (X >= this.x && Y >= this.y && X - this.x < this.width && Y - this.y < this.height);
}, "~N,~N");
})();
;//5.0.1-v7 Mon Aug 17 10:07:10 MDT 2026
Clazz_declarePackage("JU");
Clazz_load(null, "JU.Rgb16", ["JU.SB"], function(){
var c$ = Clazz_decorateAsClass(function(){
this.r = 0;
this.g = 0;
this.b = 0;
Clazz_instantialize(this, arguments);}, JU, "Rgb16", null);
/*LV!1824 unnec constructor*/c$.newI = Clazz_defineMethod(c$, "newI", 
function(argb){
var c =  new JU.Rgb16();
c.setInt(argb);
return c;
}, "~N");
Clazz_defineMethod(c$, "setInt", 
function(a){
this.r = ((a >> 8) & 0xFF00) | 0x80;
this.g = ((a) & 0xFF00) | 0x80;
this.b = ((a << 8) & 0xFF00) | 0x80;
}, "~N");
Clazz_defineMethod(c$, "setRgb", 
function(a){
this.r = a.r;
this.g = a.g;
this.b = a.b;
}, "JU.Rgb16");
Clazz_defineMethod(c$, "diffDiv", 
function(a, b, divisor){
this.r = Clazz_doubleToInt((a.r - b.r) / divisor);
this.g = Clazz_doubleToInt((a.g - b.g) / divisor);
this.b = Clazz_doubleToInt((a.b - b.b) / divisor);
}, "JU.Rgb16,JU.Rgb16,~N");
Clazz_defineMethod(c$, "setAndIncrement", 
function(base, inc){
this.r = base.r;
base.r += inc.r;
this.g = base.g;
base.g += inc.g;
this.b = base.b;
base.b += inc.b;
}, "JU.Rgb16,JU.Rgb16");
Clazz_defineMethod(c$, "getArgb", 
function(){
return (0xFF000000 | ((this.r << 8) & 0x00FF0000) | (this.g & 0x0000FF00) | (this.b >> 8));
});
Clazz_overrideMethod(c$, "toString", 
function(){
return  new JU.SB().append("Rgb16(").appendI(this.r).appendC(',').appendI(this.g).appendC(',').appendI(this.b).append(" -> ").appendI((this.r >> 8) & 0xFF).appendC(',').appendI((this.g >> 8) & 0xFF).appendC(',').appendI((this.b >> 8) & 0xFF).appendC(')').toString();
});
});
;//5.0.1-v7 Mon Aug 17 10:07:10 MDT 2026
Clazz_declarePackage("JU");
Clazz_load(["JU.AU", "$.V3"], "JU.Shader", ["JU.CU", "JU.C"], function(){
var c$ = Clazz_decorateAsClass(function(){
this.xLight = 0;
this.yLight = 0;
this.zLight = 0;
this.lightSource = null;
this.specularOn = true;
this.usePhongExponent = false;
this.ambientPercent = 45;
this.diffusePercent = 84;
this.specularExponent = 6;
this.specularPercent = 22;
this.specularPower = 40;
this.phongExponent = 64;
this.ambientFraction = 0;
this.diffuseFactor = 0;
this.intenseFraction = 0;
this.specularFactor = 0;
this.ashades = null;
this.ashadesGreyscale = null;
this.celOn = false;
this.celPower = 10;
this.celRGB = 0;
this.celZ = 0;
this.useLight = false;
this.sphereShadeIndexes = null;
this.seed = 0x12345679;
this.sphereShapeCache = null;
this.ellipsoidShades = null;
this.nOut = 0;
this.nIn = 0;
Clazz_instantialize(this, arguments);}, JU, "Shader", null);
Clazz_prepareFields (c$, function(){
this.lightSource =  new JU.V3();
this.ambientFraction = this.ambientPercent / 100;
this.diffuseFactor = this.diffusePercent / 100;
this.intenseFraction = this.specularPower / 100;
this.specularFactor = this.specularPercent / 100;
this.ashades = JU.AU.newInt2(128);
this.sphereShadeIndexes =  Clazz_newByteArray (65536, 0);
this.sphereShapeCache = JU.AU.newInt2(128);
});
Clazz_makeConstructor(c$, 
function(){
this.setLightSource(-1.0, -1.0, 2.5);
});
Clazz_defineMethod(c$, "setLightSource", 
function(x, y, z){
this.lightSource.set(x, y, z);
this.lightSource.normalize();
this.xLight = this.lightSource.x;
this.yLight = this.lightSource.y;
this.zLight = this.lightSource.z;
}, "~N,~N,~N");
Clazz_defineMethod(c$, "setCel", 
function(celShading, celShadingPower, argb){
celShading = celShading && celShadingPower != 0;
argb = JU.C.getArgb(JU.C.getBgContrast(argb));
argb = (argb == 0xFF000000 ? 0xFF040404 : argb == -1 ? -2 : argb + 1);
if (this.celOn == celShading && this.celRGB == argb && this.celPower == celShadingPower) return;
this.celOn = celShading;
this.celPower = celShadingPower;
this.useLight = (!this.celOn || celShadingPower > 0);
this.celZ = 1 - Math.pow(2, -Math.abs(celShadingPower) / 10);
this.celRGB = argb;
this.flushCaches();
}, "~B,~N,~N");
Clazz_defineMethod(c$, "flushCaches", 
function(){
this.checkShades(JU.C.colixMax);
for (var i = JU.C.colixMax; --i >= 0; ) this.ashades[i] = null;

this.calcSphereShading();
for (var i = 128; --i >= 0; ) this.sphereShapeCache[i] = null;

this.ellipsoidShades = null;
});
Clazz_defineMethod(c$, "setLastColix", 
function(argb, asGrey){
JU.C.allocateColix(argb, true);
this.checkShades(2047);
if (asGrey) JU.C.setLastGrey(argb);
this.ashades[2047] = this.getShades2(argb, false);
}, "~N,~B");
Clazz_defineMethod(c$, "getShades", 
function(colix){
this.checkShades(JU.C.colixMax);
colix &= -30721;
var shades = this.ashades[colix];
if (shades == null) shades = this.ashades[colix] = this.getShades2(JU.C.argbs[colix], false);
return shades;
}, "~N");
Clazz_defineMethod(c$, "getShadesG", 
function(colix){
this.checkShades(JU.C.colixMax);
colix &= -30721;
if (this.ashadesGreyscale == null) this.ashadesGreyscale = JU.AU.newInt2(this.ashades.length);
var shadesGreyscale = this.ashadesGreyscale[colix];
if (shadesGreyscale == null) shadesGreyscale = this.ashadesGreyscale[colix] = this.getShades2(JU.C.argbs[colix], true);
return shadesGreyscale;
}, "~N");
Clazz_defineMethod(c$, "checkShades", 
function(n){
if (this.ashades != null && this.ashades.length >= n) return;
if (n == 2047) n++;
this.ashades = JU.AU.arrayCopyII(this.ashades, n);
if (this.ashadesGreyscale != null) this.ashadesGreyscale = JU.AU.arrayCopyII(this.ashadesGreyscale, n);
}, "~N");
Clazz_defineMethod(c$, "getShades2", 
function(rgb, greyScale){
var shades =  Clazz_newIntArray (64, 0);
if (rgb == 0) return shades;
var red0 = ((rgb >> 16) & 0xFF);
var grn0 = ((rgb >> 8) & 0xFF);
var blu0 = (rgb & 0xFF);
var red = 0;
var grn = 0;
var blu = 0;
var f = this.ambientFraction;
while (true) {
red = red0 * f + 0.5;
grn = grn0 * f + 0.5;
blu = blu0 * f + 0.5;
if (f > 0 && red < 4 && grn < 4 && blu < 4) {
red0++;
grn0++;
blu0++;
if (f < 0.1) f += 0.1;
rgb = JU.CU.rgb(Clazz_doubleToInt(Math.floor(red0)), Clazz_doubleToInt(Math.floor(grn0)), Clazz_doubleToInt(Math.floor(blu0)));
continue;
}break;
}
var i = 0;
f = (1 - f) / 52;
var redStep = red0 * f;
var grnStep = grn0 * f;
var bluStep = blu0 * f;
if (this.celOn) {
var max = 32;
var _rgb = JU.CU.rgb(Clazz_doubleToInt(Math.floor(red)), Clazz_doubleToInt(Math.floor(grn)), Clazz_doubleToInt(Math.floor(blu)));
if (this.celPower >= 0) for (; i < max; ++i) shades[i] = _rgb;

red += redStep * max;
grn += grnStep * max;
blu += bluStep * max;
_rgb = JU.CU.rgb(Clazz_doubleToInt(Math.floor(red)), Clazz_doubleToInt(Math.floor(grn)), Clazz_doubleToInt(Math.floor(blu)));
for (; i < 64; i++) shades[i] = _rgb;

shades[0] = shades[1] = this.celRGB;
} else {
for (; i < 52; ++i) {
shades[i] = JU.CU.rgb(Clazz_doubleToInt(Math.floor(red)), Clazz_doubleToInt(Math.floor(grn)), Clazz_doubleToInt(Math.floor(blu)));
red += redStep;
grn += grnStep;
blu += bluStep;
}
shades[i++] = rgb;
f = this.intenseFraction / (64 - i);
redStep = (255.5 - red) * f;
grnStep = (255.5 - grn) * f;
bluStep = (255.5 - blu) * f;
for (; i < 64; i++) {
red += redStep;
grn += grnStep;
blu += bluStep;
shades[i] = JU.CU.rgb(Clazz_doubleToInt(Math.floor(red)), Clazz_doubleToInt(Math.floor(grn)), Clazz_doubleToInt(Math.floor(blu)));
}
}if (greyScale) for (; --i >= 0; ) shades[i] = JU.CU.toFFGGGfromRGB(shades[i]);

return shades;
}, "~N,~B");
Clazz_defineMethod(c$, "getShadeIndex", 
function(x, y, z){
var magnitude = Math.sqrt(x * x + y * y + z * z);
return Math.round(this.getShadeF((x / magnitude), (y / magnitude), (z / magnitude)) * 63);
}, "~N,~N,~N");
Clazz_defineMethod(c$, "getShadeB", 
function(x, y, z){
return Math.round(this.getShadeF(x, y, z) * 63);
}, "~N,~N,~N");
Clazz_defineMethod(c$, "getShadeFp8", 
function(x, y, z){
var magnitude = Math.sqrt(x * x + y * y + z * z);
return Clazz_doubleToInt(Math.floor(this.getShadeF((x / magnitude), (y / magnitude), (z / magnitude)) * 63 * (256)));
}, "~N,~N,~N");
Clazz_defineMethod(c$, "getShadeF", 
function(x, y, z){
var NdotL = (this.useLight ? x * this.xLight + y * this.yLight + z * this.zLight : z);
if (NdotL <= 0) return 0;
var intensity = NdotL * this.diffuseFactor;
if (this.specularOn) {
var k_specular = 2 * NdotL * z - this.zLight;
if (k_specular > 0) {
if (this.usePhongExponent) {
k_specular = Math.pow(k_specular, this.phongExponent);
} else {
for (var n = this.specularExponent; --n >= 0 && k_specular > .0001; ) k_specular *= k_specular;

}intensity += k_specular * this.specularFactor;
}}return (this.celOn && z < this.celZ ? 0 : intensity > 1 ? 1 : intensity);
}, "~N,~N,~N");
Clazz_defineMethod(c$, "getShadeN", 
function(x, y, z, r){
var fp8ShadeIndex = Clazz_doubleToInt(Math.floor(this.getShadeF(x / r, y / r, z / r) * 63 * (256)));
var shadeIndex = fp8ShadeIndex >> 8;
if (!this.useLight) return shadeIndex;
if ((fp8ShadeIndex & 0xFF) > this.nextRandom8Bit()) ++shadeIndex;
var random16bit = this.seed & 0xFFFF;
if (random16bit < 21845 && shadeIndex > 0) --shadeIndex;
 else if (random16bit > 43690 && shadeIndex < 63) ++shadeIndex;
return shadeIndex;
}, "~N,~N,~N,~N");
Clazz_defineMethod(c$, "calcSphereShading", 
function(){
var xF = -127.5;
var r2 = 16900;
for (var i = 0; i < 256; ++xF, ++i) {
var yF = -127.5;
var xF2 = xF * xF;
for (var j = 0; j < 256; ++yF, ++j) {
var shadeIndex = 0;
var z2 = r2 - xF2 - yF * yF;
if (z2 > 0) {
var z = Math.sqrt(z2);
shadeIndex = this.getShadeN(xF, yF, z, 130);
}this.sphereShadeIndexes[(j << 8) + i] = shadeIndex;
}
}
});
Clazz_defineMethod(c$, "nextRandom8Bit", 
function(){
var t = this.seed;
this.seed = t = ((t << 16) + (t << 1) + t) & 0x7FFFFFFF;
return t >> 23;
});
Clazz_defineMethod(c$, "getEllipsoidShade", 
function(x, y, z, radius, mDeriv){
var tx = mDeriv.m00 * x + mDeriv.m01 * y + mDeriv.m02 * z + mDeriv.m03;
var ty = mDeriv.m10 * x + mDeriv.m11 * y + mDeriv.m12 * z + mDeriv.m13;
var tz = mDeriv.m20 * x + mDeriv.m21 * y + mDeriv.m22 * z + mDeriv.m23;
var f = Math.min(radius / 2, 45) / Math.sqrt(tx * tx + ty * ty + tz * tz);
var i = Clazz_floatToInt(-tx * f);
var j = Clazz_floatToInt(-ty * f);
var k = Clazz_floatToInt(tz * f);
var outside = i < -20 || i >= 20 || j < -20 || j >= 20 || k < 0 || k >= 40;
if (outside) {
while (i % 2 == 0 && j % 2 == 0 && k % 2 == 0 && i + j + k > 0) {
i >>= 1;
j >>= 1;
k >>= 1;
}
outside = i < -20 || i >= 20 || j < -20 || j >= 20 || k < 0 || k >= 40;
}if (outside) this.nOut++;
 else this.nIn++;
return (outside ? this.getShadeIndex(i, j, k) : this.ellipsoidShades[i + 20][j + 20][k]);
}, "~N,~N,~N,~N,JU.M4");
Clazz_defineMethod(c$, "createEllipsoidShades", 
function(){
this.ellipsoidShades =  Clazz_newByteArray (40, 40, 40, 0);
for (var ii = 0; ii < 40; ii++) for (var jj = 0; jj < 40; jj++) for (var kk = 0; kk < 40; kk++) this.ellipsoidShades[ii][jj][kk] = this.getShadeIndex(ii - 20, jj - 20, kk);



});
});
;//5.0.1-v7 Mon Aug 17 10:07:10 MDT 2026
Clazz_declarePackage("JU");
Clazz_load(["JV.Viewer"], "JU.SimpleUnitCell", ["JU.AU", "$.M4", "$.P3", "$.P4", "$.PT", "$.V3", "JU.Escape"], function(){
var c$ = Clazz_decorateAsClass(function(){
this.unitCellParams = null;
this.slop = 0;
this.matrixCartesianToFractional = null;
this.matrixFractionalToCartesian = null;
this.matrixCtoFNoOffset = null;
this.matrixFtoCNoOffset = null;
this.volume = 0;
this.dimension = 3;
this.dimensionType = 7;
this.fractionalOrigin = null;
this.na = 0;
this.nb = 0;
this.nc = 0;
this.a = 0;
this.b = 0;
this.c = 0;
this.alpha = 0;
this.beta = 0;
this.gamma = 0;
this.cosAlpha = 0;
this.sinAlpha = 0;
this.cosBeta = 0;
this.sinBeta = 0;
this.cosGamma = 0;
this.sinGamma = 0;
this.cA_ = 0;
this.cB_ = 0;
this.a_ = 0;
this.b_ = 0;
this.c_ = 0;
Clazz_instantialize(this, arguments);}, JU, "SimpleUnitCell", null);
Clazz_prepareFields (c$, function(){
this.slop = (JV.Viewer.isHighPrecision ? 1.0E-12 : 1.0E-4);
});
Clazz_makeConstructor(c$, 
function(){
this.fractionalOrigin =  new JU.P3();
});
Clazz_defineMethod(c$, "getPrecision", 
function(){
return this.slop;
});
Clazz_defineMethod(c$, "setPrecision", 
function(slop){
this.unitCellParams[26] = this.slop = (!Float.isNaN(slop) ? slop : !Float.isNaN(this.unitCellParams[26]) ? this.unitCellParams[26] : JV.Viewer.isHighPrecision ? 1.0E-12 : 1.0E-4);
}, "~N");
Clazz_defineMethod(c$, "isSupercell", 
function(){
return (this.na > 1 || this.nb > 1 || this.nc > 1);
});
c$.isValid = Clazz_defineMethod(c$, "isValid", 
function(parameters){
return (parameters != null && (parameters[0] > 0 || parameters.length > 14 && !Float.isNaN(parameters[14])));
}, "~A");
c$.newA = Clazz_defineMethod(c$, "newA", 
function(params){
var c =  new JU.SimpleUnitCell();
c.init(params);
return c;
}, "~A");
c$.getDimensionFromParams = Clazz_defineMethod(c$, "getDimensionFromParams", 
function(params){
return (params[0] <= 0 ? 3 : params[1] < 0 ? 1 : params[2] < 0 ? 2 : 3);
}, "~A");
Clazz_defineMethod(c$, "init", 
function(params){
if (params == null) params =  Clazz_newFloatArray(-1, [1, 1, 1, 90, 90, 90]);
if (!JU.SimpleUnitCell.isValid(params)) return;
this.unitCellParams = JU.SimpleUnitCell.newParams(params, NaN);
var rotateHex = false;
this.dimension = JU.SimpleUnitCell.getDimensionFromParams(params);
switch (this.dimension) {
case 1:
this.dimensionType = 1;
break;
case 2:
this.dimensionType = 3;
break;
case 3:
this.dimensionType = 7;
break;
}
this.a = params[0];
this.b = params[1];
this.c = params[2];
this.alpha = params[3];
this.beta = params[4];
this.gamma = params[5];
if (this.gamma == -1 && this.c > 0) {
rotateHex = true;
this.gamma = 120;
}if (params.length > 26) {
if (Float.isNaN(params[26])) {
params[26] = this.slop;
} else {
this.slop = params[26];
}}var fa = this.na = Math.max(1, params.length > 24 && !Float.isNaN(params[22]) ? Clazz_floatToInt(params[22]) : 1);
var fb = this.nb = Math.max(1, params.length > 24 && !Float.isNaN(params[23]) ? Clazz_floatToInt(params[23]) : 1);
var fc = this.nc = Math.max(1, params.length > 24 && !Float.isNaN(params[24]) ? Clazz_floatToInt(params[24]) : 1);
if (params.length > 25 && !Float.isNaN(params[25])) {
var fScale = params[25];
if (fScale > 0) {
fa *= fScale;
fb *= fScale;
fc *= fScale;
}} else {
fa = fb = fc = 1;
}if (this.a <= 0 && this.c <= 0) {
var va = JU.SimpleUnitCell.newV(params, 6);
var vb = JU.SimpleUnitCell.newV(params, 9);
var vc = JU.SimpleUnitCell.newV(params, 12);
this.setABC(va, vb, vc);
if (this.c < 0) {
var n = JU.AU.arrayCopyF(params, -1);
if (this.b < 0) {
vb.set(0, 0, 1);
vb.cross(vb, va);
if (vb.length() < 0.001) vb.set(0, 1, 0);
vb.normalize();
n[9] = vb.x;
n[10] = vb.y;
n[11] = vb.z;
}if (this.c < 0) {
vc.cross(va, vb);
vc.normalize();
n[12] = vc.x;
n[13] = vc.y;
n[14] = vc.z;
}params = n;
}}this.a *= fa;
if (this.b <= 0) {
this.b = this.c = 1;
} else if (this.c <= 0) {
this.c = 1;
this.b *= fb;
} else {
this.b *= fb;
this.c *= fc;
}this.setCellParams();
if (params.length > 21 && !Float.isNaN(params[21])) {
var scaleMatrix =  Clazz_newFloatArray (16, 0);
for (var i = 0; i < 16; i++) {
var f;
switch (i % 4) {
case 0:
f = fa;
break;
case 1:
f = fb;
break;
case 2:
f = fc;
break;
default:
f = 1;
break;
}
scaleMatrix[i] = params[6 + i] * f;
}
this.matrixCartesianToFractional = JU.M4.newA16(scaleMatrix);
this.matrixCartesianToFractional.getTranslation(this.fractionalOrigin);
this.matrixFractionalToCartesian = JU.M4.newM4(this.matrixCartesianToFractional).invert();
if (params[0] == 1) this.setParamsFromMatrix();
} else if (params.length > 14 && !Float.isNaN(params[14])) {
var m = this.matrixFractionalToCartesian =  new JU.M4();
m.setColumn4(0, params[6] * fa, params[7] * fa, params[8] * fa, 0);
m.setColumn4(1, params[9] * fb, params[10] * fb, params[11] * fb, 0);
m.setColumn4(2, params[12] * fc, params[13] * fc, params[14] * fc, 0);
if (params.length > 17 && !Float.isNaN(params[17])) {
m.setColumn4(3, params[15], params[16], params[17], 1);
} else {
m.setColumn4(3, 0, 0, 0, 1);
}this.matrixCartesianToFractional = JU.M4.newM4(this.matrixFractionalToCartesian).invert();
} else {
var m = this.matrixFractionalToCartesian =  new JU.M4();
if (rotateHex) {
m.setColumn4(0, (-this.b * this.cosGamma), (-this.b * this.sinGamma), 0, 0);
m.setColumn4(1, (-this.b * this.cosGamma), (this.b * this.sinGamma), 0, 0);
} else {
m.setColumn4(0, this.a, 0, 0, 0);
m.setColumn4(1, (this.b * this.cosGamma), (this.b * this.sinGamma), 0, 0);
}m.setColumn4(2, (this.c * this.cosBeta), (this.c * (this.cosAlpha - this.cosBeta * this.cosGamma) / this.sinGamma), (this.volume / (this.a * this.b * this.sinGamma)), 0);
m.setColumn4(3, 0, 0, 0, 1);
this.matrixCartesianToFractional = JU.M4.newM4(this.matrixFractionalToCartesian).invert();
}this.matrixCtoFNoOffset = this.matrixCartesianToFractional;
this.matrixFtoCNoOffset = this.matrixFractionalToCartesian;
}, "~A");
c$.newV = Clazz_defineMethod(c$, "newV", 
function(p, i){
return JU.V3.new3(p[i++], p[i++], p[i]);
}, "~A,~N");
c$.newParams = Clazz_defineMethod(c$, "newParams", 
function(params, slop){
var p =  Clazz_newFloatArray (27, 0);
var n = params.length;
for (var i = 0; i < 27; i++) p[i] = (i < n ? params[i] : NaN);

if (n < 27) p[26] = slop;
return p;
}, "~A,~N");
c$.addVectors = Clazz_defineMethod(c$, "addVectors", 
function(params){
var c = JU.SimpleUnitCell.newA(params);
var m = c.matrixFractionalToCartesian;
for (var i = 0; i < 9; i++) params[6 + i] = m.getElement(i % 3, Clazz_doubleToInt(i / 3));

}, "~A");
Clazz_defineMethod(c$, "setParamsFromMatrix", 
function(){
var va = JU.V3.new3(1, 0, 0);
var vb = JU.V3.new3(0, 1, 0);
var vc = JU.V3.new3(0, 0, 1);
this.matrixFractionalToCartesian.rotate(va);
this.matrixFractionalToCartesian.rotate(vb);
this.matrixFractionalToCartesian.rotate(vc);
this.setABC(va, vb, vc);
this.setCellParams();
});
Clazz_defineMethod(c$, "setABC", 
function(va, vb, vc){
JU.SimpleUnitCell.fillParams(va, vb, vc, this.unitCellParams);
var p = this.unitCellParams;
this.a = p[0];
this.b = p[1];
this.c = p[2];
this.alpha = p[3];
this.beta = p[4];
this.gamma = p[5];
}, "JU.V3,JU.V3,JU.V3");
c$.fillParams = Clazz_defineMethod(c$, "fillParams", 
function(va, vb, vc, p){
if (va == null) {
va = JU.SimpleUnitCell.newV(p, 6);
vb = JU.SimpleUnitCell.newV(p, 9);
vc = JU.SimpleUnitCell.newV(p, 12);
}var a = va.length();
var b = vb.length();
var c = vc.length();
if (a == 0) return;
if (b == 0) b = c = -1;
 else if (c == 0) c = -1;
p[0] = a;
p[1] = b;
p[2] = c;
p[3] = (b < 0 || c < 0 ? 90 : vb.angle(vc) / 0.017453292519943295);
p[4] = (c < 0 ? 90 : va.angle(vc) / 0.017453292519943295);
p[5] = (b < 0 ? 90 : va.angle(vb) / 0.017453292519943295);
}, "JU.V3,JU.V3,JU.V3,~A");
Clazz_defineMethod(c$, "setCellParams", 
function(){
this.cosAlpha = Math.cos(0.017453292519943295 * this.alpha);
this.sinAlpha = Math.sin(0.017453292519943295 * this.alpha);
this.cosBeta = Math.cos(0.017453292519943295 * this.beta);
this.sinBeta = Math.sin(0.017453292519943295 * this.beta);
this.cosGamma = Math.cos(0.017453292519943295 * this.gamma);
this.sinGamma = Math.sin(0.017453292519943295 * this.gamma);
var unitVolume = Math.sqrt(this.sinAlpha * this.sinAlpha + this.sinBeta * this.sinBeta + this.sinGamma * this.sinGamma + 2.0 * this.cosAlpha * this.cosBeta * this.cosGamma - 2);
this.volume = this.a * this.b * this.c * unitVolume;
this.cA_ = (this.cosAlpha - this.cosBeta * this.cosGamma) / this.sinGamma;
this.cB_ = unitVolume / this.sinGamma;
this.a_ = this.b * this.c * this.sinAlpha / this.volume;
this.b_ = this.a * this.c * this.sinBeta / this.volume;
this.c_ = this.a * this.b * this.sinGamma / this.volume;
});
Clazz_defineMethod(c$, "getFractionalOrigin", 
function(){
return this.fractionalOrigin;
});
Clazz_defineMethod(c$, "toSupercell", 
function(fpt){
fpt.x /= this.na;
fpt.y /= this.nb;
fpt.z /= this.nc;
return fpt;
}, "JU.P3");
Clazz_defineMethod(c$, "toCartesian", 
function(pt, ignoreOffset){
if (this.matrixFractionalToCartesian != null) (ignoreOffset ? this.matrixFtoCNoOffset : this.matrixFractionalToCartesian).rotTrans(pt);
}, "JU.T3,~B");
Clazz_defineMethod(c$, "toFractionalM", 
function(m){
if (this.matrixCartesianToFractional == null) return;
m.mul(this.matrixFractionalToCartesian);
m.mul2(this.matrixCartesianToFractional, m);
}, "JU.M4");
Clazz_defineMethod(c$, "toFractional", 
function(pt, ignoreOffset){
if (this.matrixCartesianToFractional == null) return;
(ignoreOffset ? this.matrixCtoFNoOffset : this.matrixCartesianToFractional).rotTrans(pt);
}, "JU.T3,~B");
Clazz_defineMethod(c$, "isPolymer", 
function(){
return (this.dimension == 1);
});
Clazz_defineMethod(c$, "isSlab", 
function(){
return (this.dimension == 2);
});
Clazz_defineMethod(c$, "getUnitCellParams", 
function(){
return this.unitCellParams;
});
Clazz_defineMethod(c$, "getUnitCellAsArray", 
function(vectorsOnly){
var m = this.matrixFractionalToCartesian;
return (vectorsOnly ?  Clazz_newFloatArray(-1, [m.m00, m.m10, m.m20, m.m01, m.m11, m.m21, m.m02, m.m12, m.m22]) :  Clazz_newFloatArray(-1, [this.a, this.b, this.c, this.alpha, this.beta, this.gamma, m.m00, m.m10, m.m20, m.m01, m.m11, m.m21, m.m02, m.m12, m.m22, this.dimension, this.dimensionType, this.volume]));
}, "~B");
Clazz_defineMethod(c$, "getInfoStr", 
function(type){
var itype;
switch (type.toLowerCase()) {
case "a":
itype = 0;
break;
case "b":
itype = 1;
break;
case "c":
itype = 2;
break;
case "alpha":
itype = 3;
break;
case "beta":
itype = 4;
break;
case "gamma":
itype = 5;
break;
case "dim":
itype = 6;
break;
case "dimtype":
itype = 7;
break;
case "volume":
itype = 10;
break;
default:
itype = -1;
break;
}
return (itype < 0 ? NaN : this.getInfo(itype));
}, "~S");
Clazz_defineMethod(c$, "getInfo", 
function(infoType){
switch (infoType) {
case 0:
return this.a;
case 1:
return this.b;
case 2:
return this.c;
case 3:
return this.alpha;
case 4:
return this.beta;
case 5:
return this.gamma;
case 6:
return this.dimension;
case 7:
return this.dimensionType;
case 8:
return (JU.SimpleUnitCell.isHexagonal(this.unitCellParams) ? 1 : 0);
case 9:
return (JU.SimpleUnitCell.isRhombohedral(this.unitCellParams) ? 1 : 0);
case 10:
return this.volume;
}
return NaN;
}, "~N");
c$.getReciprocal = Clazz_defineMethod(c$, "getReciprocal", 
function(abc, ret, scale){
var off = (abc.length == 4 ? 1 : 0);
var rabc =  new Array(4);
rabc[0] = (off == 1 ? JU.P3.newP(abc[0]) :  new JU.P3());
if (scale == 0) scale = (6.283185307179586);
for (var i = 0; i < 3; i++) {
var v = rabc[i + 1] =  new JU.P3();
v.cross(abc[((i + 1) % 3) + off], abc[((i + 2) % 3) + off]);
var vol = abc[i + off].dot(v);
if (scale == -1) scale = Math.sqrt(vol);
v.scale(scale / vol);
}
if (ret == null) return rabc;
for (var i = 0; i < 4; i++) {
ret[i] = rabc[i];
}
return ret;
}, "~A,~A,~N");
c$.setAbc = Clazz_defineMethod(c$, "setAbc", 
function(abcabg, params, ucnew){
if (abcabg != null) {
if (params == null) params =  Clazz_newFloatArray (6, 0);
var tokens = JU.PT.split(abcabg.$replace(',', '='), "=");
if (tokens.length >= 12) for (var i = 0; i < 6; i++) params[i] = JU.PT.parseFloat(tokens[i * 2 + 1]);

}if (ucnew == null) return null;
return JU.SimpleUnitCell.setAbcFromParams(params, ucnew);
}, "~S,~A,~A");
c$.setAbcFromParams = Clazz_defineMethod(c$, "setAbcFromParams", 
function(params, ucnew){
var f = JU.SimpleUnitCell.newA(params).getUnitCellAsArray(true);
if (ucnew[0] == null) {
for (var i = 4; --i >= 0; ) {
ucnew[i] =  new JU.P3();
}
}ucnew[1].set(f[0], f[1], f[2]);
ucnew[2].set(f[3], f[4], f[5]);
ucnew[3].set(f[6], f[7], f[8]);
return ucnew;
}, "~A,~A");
Clazz_defineMethod(c$, "unitizeDim", 
function(dimension, pt){
switch (dimension) {
case 3:
pt.z = JU.SimpleUnitCell.unitizeX(pt.z, this.slop);
case 2:
pt.y = JU.SimpleUnitCell.unitizeX(pt.y, this.slop);
case 1:
pt.x = JU.SimpleUnitCell.unitizeX(pt.x, this.slop);
}
}, "~N,JU.T3");
c$.unitizeDimRnd = Clazz_defineMethod(c$, "unitizeDimRnd", 
function(dimension, pt, slop){
switch (dimension) {
case 3:
pt.z = JU.SimpleUnitCell.unitizeXRnd(pt.z, slop);
case 2:
pt.y = JU.SimpleUnitCell.unitizeXRnd(pt.y, slop);
case 1:
pt.x = JU.SimpleUnitCell.unitizeXRnd(pt.x, slop);
}
}, "~N,JU.T3,~N");
c$.unitizeX = Clazz_defineMethod(c$, "unitizeX", 
function(x, slop){
x = (x - Math.floor(x));
if (x > 1 - slop || x < slop) x = 0;
return x;
}, "~N,~N");
c$.unitizeXRnd = Clazz_defineMethod(c$, "unitizeXRnd", 
function(x, slop){
x = (x - Math.floor(x));
if (x > 1 - slop || x < slop) x = 0;
return x;
}, "~N,~N");
Clazz_defineMethod(c$, "twelfthsOf", 
function(f){
if (f == 0) return 0;
f = Math.abs(f * 12);
var i = Math.round(f);
return (i <= 12 && Math.abs(f - i) < this.slop * 12 ? i : -1);
}, "~N");
Clazz_defineMethod(c$, "twelfthify", 
function(pt){
switch (this.dimension) {
case 3:
pt.z = this.setTwelfths(pt.z);
case 2:
pt.y = this.setTwelfths(pt.y);
case 1:
pt.x = this.setTwelfths(pt.x);
break;
}
}, "JU.P3");
Clazz_defineMethod(c$, "setTwelfths", 
function(x){
var i = this.twelfthsOf(x);
return (i >= 0 ? i / 12 * (x < 0 ? -1 : 1) : x);
}, "~N");
c$.ijkToPoint3f = Clazz_defineMethod(c$, "ijkToPoint3f", 
function(nnn, cell, offset, kcode){
var f = (nnn > 1000000000 ? 1000 : nnn > 1000000 ? 100 : 10);
var f2 = f * f;
offset -= (offset >= 0 ? Clazz_doubleToInt(5 * f / 10) : offset);
cell.x = ((Clazz_doubleToInt(nnn / f2)) % f) + offset;
cell.y = Clazz_doubleToInt((nnn % f2) / f) + offset;
cell.z = (kcode == 0 ? nnn % f : (offset == -500 ? Clazz_doubleToInt(kcode / f) : kcode) % f) + offset;
}, "~N,JU.P3,~N,~N");
c$.ptToIJK = Clazz_defineMethod(c$, "ptToIJK", 
function(pt, scale){
if (pt.x <= 5 && pt.y <= 5 && pt.z <= 5) {
return JU.P4.new4(555, (pt.x + 4) * 100 + (pt.y + 4) * 10 + pt.z + 4, scale, 0);
}var i555 = 1500500500;
return JU.P4.new4(i555, i555 + pt.x * 1000000 + pt.y * 1000 + pt.z, scale, 1500500 + pt.z);
}, "JU.T3,~N");
c$.escapeMultiplier = Clazz_defineMethod(c$, "escapeMultiplier", 
function(pt){
if (Clazz_instanceOf(pt,"JU.P4")) {
var pt4 = pt;
var x = Clazz_doubleToInt(Math.floor(pt4.x / 1000)) * 1000 + Clazz_doubleToInt(Math.floor(pt4.w / 1000)) - 1000;
var y = Clazz_doubleToInt(Math.floor(pt4.y / 1000)) * 1000 + Clazz_doubleToInt(Math.floor(pt4.w)) % 1000;
return "{" + x + " " + y + " " + pt.z + "}";
}return JU.Escape.eP(pt);
}, "JU.T3");
c$.setMinMaxLatticeParameters = Clazz_defineMethod(c$, "setMinMaxLatticeParameters", 
function(dimension, minXYZ, maxXYZ, kcode){
if (maxXYZ.x <= maxXYZ.y && maxXYZ.y >= 555) {
var pt =  new JU.P3();
JU.SimpleUnitCell.ijkToPoint3f(maxXYZ.x, pt, 0, kcode);
minXYZ.x = Clazz_floatToInt(pt.x);
minXYZ.y = Clazz_floatToInt(pt.y);
minXYZ.z = Clazz_floatToInt(pt.z);
JU.SimpleUnitCell.ijkToPoint3f(maxXYZ.y, pt, 1, kcode);
maxXYZ.x = Clazz_floatToInt(pt.x);
maxXYZ.y = Clazz_floatToInt(pt.y);
maxXYZ.z = Clazz_floatToInt(pt.z);
}switch (dimension) {
case 1:
minXYZ.y = 0;
maxXYZ.y = 1;
case 2:
minXYZ.z = 0;
maxXYZ.z = 1;
}
}, "~N,JU.P3i,JU.P3i,~N");
c$.isHexagonal = Clazz_defineMethod(c$, "isHexagonal", 
function(params){
return (JU.SimpleUnitCell.approx0(params[0] - params[1]) && JU.SimpleUnitCell.approx0(params[3] - 90) && JU.SimpleUnitCell.approx0(params[4] - 90) && (JU.SimpleUnitCell.approx0(params[5] - 120) || params[5] == -1));
}, "~A");
c$.isRhombohedral = Clazz_defineMethod(c$, "isRhombohedral", 
function(params){
return (JU.SimpleUnitCell.approx0(params[0] - params[1]) && JU.SimpleUnitCell.approx0(params[1] - params[2]) && !JU.SimpleUnitCell.approx0(params[3] - 90) && JU.SimpleUnitCell.approx0(params[3] - params[4]) && JU.SimpleUnitCell.approx0(params[4] - params[5]));
}, "~A");
c$.approx0 = Clazz_defineMethod(c$, "approx0", 
function(f){
return (Math.abs(f) < 0.001);
}, "~N");
c$.getCellRange = Clazz_defineMethod(c$, "getCellRange", 
function(fset, cellRange){
var t3w = (Clazz_instanceOf(fset,"JU.T4") ? Clazz_floatToInt((fset).w) : 0);
JU.SimpleUnitCell.ijkToPoint3f(Clazz_floatToInt(fset.x), cellRange[0], 0, t3w);
JU.SimpleUnitCell.ijkToPoint3f(Clazz_floatToInt(fset.y), cellRange[1], 1, t3w);
if (fset.z < 0) {
cellRange[0].scale(-1 / fset.z);
cellRange[1].scale(-1 / fset.z);
}return t3w;
}, "JU.T3,~A");
c$.parseCalc = Clazz_defineMethod(c$, "parseCalc", 
function(vwr, s){
return JU.SimpleUnitCell.parseCalcFunctions(vwr, JU.SimpleUnitCell.functions, s);
}, "JV.Viewer,~S");
c$.parseCalcFunctions = Clazz_defineMethod(c$, "parseCalcFunctions", 
function(vwr, functions, s){
var parts;
if (s.startsWith("+")) s = s.substring(1);
var d = JU.PT.parseFloatStrict(s);
if (!Float.isNaN(d)) return d;
s = s.toLowerCase();
if (functions != null && s.indexOf('(') >= 0) {
parts = JU.PT.split(s, "(");
for (var i = parts.length - 1; --i >= 0; ) {
var p = parts[i];
if (p.length == 0) continue;
var f = null;
for (var j = functions.length; --j >= 0; ) {
if (p.endsWith(functions[j])) {
f = functions[j];
break;
}}
if (f == null) {
System.err.println("Unrecognized function " + s);
parts[i] += "?";
}}
s = JU.PT.join(parts, '(', 0);
}if (s.indexOf('/') >= 0) {
parts = JU.PT.split(s, "/");
for (var i = parts.length - 1; --i >= 0; ) {
var p = parts[i];
var haveDecimal = false;
var haveDigit = false;
for (var j = p.length; --j >= 0; ) {
var c = p.charAt(j);
if (c == '.') {
haveDecimal = true;
break;
} else if (c == ')') {
if (haveDigit) {
return NaN;
}parts[i] += "*1.0";
break;
}if (c == '.') {
haveDecimal = true;
break;
}if (!JU.PT.isDigit(c)) {
break;
}haveDigit = true;
}
if (haveDigit && !haveDecimal) parts[i] += ".0";
}
s = JU.PT.join(parts, '/', 0);
}return vwr.evaluateExpressionAsVariable(s).asFloat();
}, "JV.Viewer,~A,~S");
c$.parseSimpleMath = Clazz_defineMethod(c$, "parseSimpleMath", 
function(vwr, suvw){
suvw = JU.PT.rep(suvw.toLowerCase(), " ", "");
if (suvw.indexOf('(') < 0) return suvw;
var isNeg = suvw.startsWith("!");
if (isNeg) suvw = suvw.substring(1);
if (suvw.indexOf("pi") >= 0) {
suvw = JU.PT.rep(suvw, "pi", "(180)");
}suvw = JU.PT.rep(suvw, ")(", ")*(");
var parts = suvw.$replace('"', ' ').$replace('\'', ' ').$plit(",");
for (var p = 0; p < parts.length; p++) {
var part = parts[p].trim();
if (part.indexOf('(') < 0) continue;
part = ',' + part;
var n = part.length;
var pt = n;
for (var i = n; --i >= 0; ) {
switch ((part.charAt(i)).charCodeAt(0)) {
case 110:
case 111:
i--;
default:
continue;
case 93:
case 91:
case 44:
case 97:
case 98:
case 99:
case 117:
case 118:
case 119:
case 120:
case 121:
case 122:
if (pt > i + 1) {
var exp = part.substring(i + 1, pt);
var k = exp.lastIndexOf('(');
if (k > 0) {
while (k > 0) {
while (--k >= 0) {
var c = exp.charAt(k);
if (c < '0') break;
if (c <= '9') {
exp = exp.substring(0, k + 1) + "*" + exp.substring(k + 1);
break;
}}
k = exp.lastIndexOf('(', k);
}
var val = JU.SimpleUnitCell.parseCalc(vwr, exp);
var sign = (i > 1 && val >= 0 ? "+" : "");
part = part.substring(0, i + 1) + sign + val + part.substring(pt);
}}pt = i;
break;
}
}
parts[p] = part.substring(1);
}
var ret = (isNeg ? "!" : "") + JU.PT.join(parts, ',', 0);
return ret;
}, "JV.Viewer,~S");
Clazz_overrideMethod(c$, "toString", 
function(){
return "[" + this.a + " " + this.b + " " + this.c + " " + this.alpha + " " + this.beta + " " + this.gamma + "]";
});
c$.functions =  Clazz_newArray(-1, ["sqrt", "sin", "cos", "tan", "+", "-", "*", "/"]);
});
;//5.0.1-v7 Mon Aug 24 10:01:38 CDT 2026
Clazz_declarePackage("JU");
Clazz_load(null, "JU.TempArray", ["JU.P3", "$.P3i"], function(){
var c$ = Clazz_decorateAsClass(function(){
this.lengthsFreePoints = null;
this.freePoints = null;
this.lengthsFreeScreens = null;
this.freeScreens = null;
this.lengthsFreeEnum = null;
this.freeEnum = null;
Clazz_instantialize(this, arguments);}, JU, "TempArray", null);
Clazz_prepareFields (c$, function(){
this.lengthsFreePoints =  Clazz_newIntArray (6, 0);
this.freePoints =  new Array(6);
this.lengthsFreeScreens =  Clazz_newIntArray (6, 0);
this.freeScreens =  new Array(6);
this.lengthsFreeEnum =  Clazz_newIntArray (2, 0);
this.freeEnum =  new Array(2);
});
Clazz_makeConstructor(c$, 
function(){
});
Clazz_defineMethod(c$, "clear", 
function(){
this.clearTempPoints();
this.clearTempScreens();
});
c$.findBestFit = Clazz_defineMethod(c$, "findBestFit", 
function(size, lengths){
var iFit = -1;
var fitLength = 2147483647;
for (var i = lengths.length; --i >= 0; ) {
var freeLength = lengths[i];
if (freeLength >= size && freeLength < fitLength) {
fitLength = freeLength;
iFit = i;
}}
if (iFit >= 0) lengths[iFit] = 0;
return iFit;
}, "~N,~A");
c$.findShorter = Clazz_defineMethod(c$, "findShorter", 
function(size, lengths){
for (var i = lengths.length; --i >= 0; ) if (lengths[i] == 0) {
lengths[i] = size;
return i;
}
var iShortest = 0;
var shortest = lengths[0];
for (var i = lengths.length; --i > 0; ) if (lengths[i] < shortest) {
shortest = lengths[i];
iShortest = i;
}
if (shortest < size) {
lengths[iShortest] = size;
return iShortest;
}return -1;
}, "~N,~A");
Clazz_defineMethod(c$, "clearTempPoints", 
function(){
for (var i = 0; i < 6; i++) {
this.lengthsFreePoints[i] = 0;
this.freePoints[i] = null;
}
});
Clazz_defineMethod(c$, "allocTempPoints", 
function(size){
var tempPoints;
var iFit = JU.TempArray.findBestFit(size, this.lengthsFreePoints);
if (iFit > 0) {
tempPoints = this.freePoints[iFit];
} else {
tempPoints =  new Array(size);
for (var i = size; --i >= 0; ) tempPoints[i] =  new JU.P3();

}return tempPoints;
}, "~N");
Clazz_defineMethod(c$, "freeTempPoints", 
function(tempPoints){
for (var i = 0; i < this.freePoints.length; i++) if (this.freePoints[i] === tempPoints) {
this.lengthsFreePoints[i] = tempPoints.length;
return;
}
var iFree = JU.TempArray.findShorter(tempPoints.length, this.lengthsFreePoints);
if (iFree >= 0) this.freePoints[iFree] = tempPoints;
}, "~A");
Clazz_defineMethod(c$, "clearTempScreens", 
function(){
for (var i = 0; i < 6; i++) {
this.lengthsFreeScreens[i] = 0;
this.freeScreens[i] = null;
}
});
Clazz_defineMethod(c$, "allocTempScreens", 
function(size){
var tempScreens;
var iFit = JU.TempArray.findBestFit(size, this.lengthsFreeScreens);
if (iFit > 0) {
tempScreens = this.freeScreens[iFit];
} else {
tempScreens =  new Array(size);
for (var i = size; --i >= 0; ) tempScreens[i] =  new JU.P3i();

}return tempScreens;
}, "~N");
Clazz_defineMethod(c$, "freeTempScreens", 
function(tempScreens){
for (var i = 0; i < this.freeScreens.length; i++) if (this.freeScreens[i] === tempScreens) {
this.lengthsFreeScreens[i] = tempScreens.length;
return;
}
var iFree = JU.TempArray.findShorter(tempScreens.length, this.lengthsFreeScreens);
if (iFree >= 0) this.freeScreens[iFree] = tempScreens;
}, "~A");
Clazz_defineMethod(c$, "allocTempEnum", 
function(size){
var tempEnum;
var iFit = JU.TempArray.findBestFit(size, this.lengthsFreeEnum);
if (iFit > 0) {
tempEnum = this.freeEnum[iFit];
} else {
tempEnum =  new Array(size);
}return tempEnum;
}, "~N");
Clazz_defineMethod(c$, "freeTempEnum", 
function(tempEnum){
for (var i = 0; i < this.freeEnum.length; i++) if (this.freeEnum[i] === tempEnum) {
this.lengthsFreeEnum[i] = tempEnum.length;
return;
}
var iFree = JU.TempArray.findShorter(tempEnum.length, this.lengthsFreeEnum);
if (iFree >= 0) this.freeEnum[iFree] = tempEnum;
}, "~A");
});
;//5.0.1-v7 Mon Aug 17 10:07:10 MDT 2026
Clazz_declarePackage("JU");
(function(){
var c$ = Clazz_declareType(JU, "Txt", null);
})();
;//5.0.1-v7 Mon Aug 17 10:07:10 MDT 2026
Clazz_declarePackage("JU");
Clazz_load(["JU.V3", "$.M3"], "JU.Vibration", ["JU.P3", "$.Quat", "JU.BSUtil"], function(){
var c$ = Clazz_decorateAsClass(function(){
this.modDim = -1;
this.modScale = NaN;
this.magMoment = 0;
this.showTrace = false;
this.isFractional = false;
this.v0 = null;
this.tracePt = 0;
this.trace = null;
this.symmform = null;
this.spin = 0;
this.isFrom000 = false;
this.matTemp = null;
this.matInv = null;
Clazz_instantialize(this, arguments);}, JU, "Vibration", JU.V3);
Clazz_prepareFields (c$, function(){
this.matTemp =  new JU.M3();
this.matInv =  new JU.M3();
});
Clazz_defineMethod(c$, "setCalcPoint", 
function(pt, t456, scale, modulationScale){
switch (this.modDim) {
case -2:
case -3:
break;
default:
pt.scaleAdd2((Math.cos(t456.x * 6.283185307179586) * scale), this, pt);
break;
}
return pt;
}, "JU.T3,JU.T3,~N,~N");
Clazz_defineMethod(c$, "getInfo", 
function(info){
info.put("vibVector", JU.V3.newV(this));
info.put("vibType", (this.modDim == -2 ? "spin" : this.modDim == -1 ? "vib" : "mod"));
}, "java.util.Map");
Clazz_overrideMethod(c$, "clone", 
function(){
var v =  new JU.Vibration();
v.setT(this);
v.modDim = this.modDim;
v.magMoment = this.magMoment;
v.v0 = this.v0;
return v;
});
Clazz_defineMethod(c$, "setXYZ", 
function(vib){
this.setT(vib);
}, "JU.T3");
Clazz_defineMethod(c$, "setV0", 
function(){
this.v0 = JU.V3.newV(this);
});
Clazz_defineMethod(c$, "setType", 
function(type){
this.modDim = type;
return this;
}, "~N");
Clazz_defineMethod(c$, "isNonzero", 
function(){
return this.x != 0 || this.y != 0 || this.z != 0;
});
Clazz_defineMethod(c$, "getOccupancy100", 
function(isTemp){
return -2147483648;
}, "~B");
Clazz_defineMethod(c$, "startTrace", 
function(n){
this.trace =  new Array(n);
this.tracePt = n;
}, "~N");
Clazz_defineMethod(c$, "addTracePt", 
function(n, ptNew){
if (this.trace == null || n == 0 || n != this.trace.length) this.startTrace(n);
if (ptNew != null && n > 2) {
if (--this.tracePt <= 0) {
var p0 = this.trace[this.trace.length - 1];
for (var i = this.trace.length; --i >= 1; ) this.trace[i] = this.trace[i - 1];

this.trace[1] = p0;
this.tracePt = 1;
}var p = this.trace[this.tracePt];
if (p == null) p = this.trace[this.tracePt] =  new JU.P3();
p.setT(ptNew);
}return this.trace;
}, "~N,JU.Point3fi");
Clazz_defineMethod(c$, "getApproxString100", 
function(){
return Math.round(this.x * 100) + "," + Math.round(this.y * 100) + "," + Math.round(this.z * 100);
});
Clazz_defineMethod(c$, "rotateSpin", 
function(matInv, rot, dRot, a){
JU.Vibration.rot(matInv, rot, dRot, this);
if (this.isFrom000) {
JU.Vibration.rot(matInv, rot, dRot, a);
}}, "JU.M3,JU.M3,JU.M3,JM.Atom");
c$.rot = Clazz_defineMethod(c$, "rot", 
function(matInv, rot, dRot, t){
if (matInv == null) {
dRot.rotate(t);
} else {
matInv.rotate(t);
rot.rotate(t);
}}, "JU.M3,JU.M3,JU.M3,JU.T3");
Clazz_defineMethod(c$, "rotateModelSpinVectors", 
function(ms, modelIndex, rot, isdx){
if (modelIndex < 0 || modelIndex >= ms.mc || ms.vibrations == null) return -1;
var vwr = ms.vwr;
var m = ms.am[modelIndex];
if (m.isJmolDataFrame) modelIndex = m.dataSourceFrame;
var info = ms.getModelAuxiliaryInfo(modelIndex);
if (rot == null) {
rot = info.get("spinFrameRotationMatrix");
if (rot == null) return -1;
}var noref = Double.isNaN(rot.getElement(0, 0));
var isScreenZ = (noref && rot.getElement(2, 2) == 1);
var deg = (noref || isScreenZ ? rot.getElement(1, 1) : 0);
if (noref && deg != 0) {
rot.setElement(1, 1, 0);
this.rotateModelSpinVectors(ms, modelIndex, rot, false);
rot.setElement(1, 1, deg);
}var m0 = info.get("spinFrameRotationMatrix");
var mat = info.get("spinRotationMatrixApplied");
if (mat == null && m0 == null) {
m0 = JU.M3.newM3(null);
info.put("spinFrameRotationMatrix", m0);
}if (mat == null) {
mat = m0;
}if (noref) {
var qn;
if (isScreenZ) {
var pt3 = JU.P3.new3(0, 0, 100);
var pt4 = JU.P3.new3(0, 0, 200);
vwr.tm.unTransformPoint(pt3, pt3);
vwr.tm.unTransformPoint(pt4, pt4);
qn = JU.V3.newVsub(pt3, pt4);
} else {
qn = JU.Quat.newM(mat).getNormal();
}rot = JU.Quat.newVA(qn, deg).getMatrix();
}var bs = JU.BSUtil.newAndSetBit(modelIndex);
ms.includeAllRelatedFrames(bs, true);
var bsModels = JU.BSUtil.copy(bs);
bs = vwr.getModelUndeletedAtomsBitSetBs(bs);
var matInv;
var drot;
drot = this.matTemp;
if (isdx) {
drot.setM3(rot);
rot.mul2(rot, mat);
matInv = null;
} else {
matInv = this.matInv;
matInv.setM3(mat);
matInv.invert();
}for (var i = bs.nextSetBit(0); i >= 0; i = bs.nextSetBit(i + 1)) {
if (i >= ms.vibrations.length) break;
var v = ms.vibrations[i];
if (v == null || !v.isFrom000 && v.magMoment == 0) continue;
v.rotateSpin(matInv, rot, drot, ms.at[i]);
}
var quat = JU.Quat.newM(rot);
var aa = quat.toAxisAngle4f();
mat = JU.M3.newM3(rot);
info.put("spinRotationMatrixApplied", mat);
var jmolSpinModel = -1;
for (var i = bsModels.nextSetBit(0); i >= 0; i = bsModels.nextSetBit(i + 1)) {
m = ms.am[i];
if (m.uvw0 != null) {
jmolSpinModel = i;
mat.rotate2(m.uvw0[0], m.uvw[0]);
mat.rotate2(m.uvw0[1], m.uvw[1]);
mat.rotate2(m.uvw0[2], m.uvw[2]);
}}
info.put("spinRotationAxisAngleApplied", aa);
if (ms.unitCells[modelIndex] != null) ms.unitCells[modelIndex].setSpinAxisAngle(aa);
return jmolSpinModel;
}, "JM.ModelSet,~N,JU.M3,~B");
c$.find = Clazz_defineMethod(c$, "find", 
function(modelSet, bs, v0){
if (v0 != null) for (var i = bs.nextSetBit(0); i >= 0; i = bs.nextSetBit(i + 1)) {
var v = modelSet.getVibration(i, false);
if (v != null && v.distance(v0) < 0.1) return modelSet.at[i];
}
return null;
}, "JM.ModelSet,JU.BS,JU.Vibration");
Clazz_defineMethod(c$, "resetMoment", 
function(){
if (this.magMoment == 0) return;
var d = this.lengthSquared();
if (d != 0) this.scale(this.magMoment / Math.sqrt(d));
});
});
;//5.0.1-v7 Mon Aug 24 10:01:38 CDT 2026
Clazz_declarePackage("JV");
Clazz_load(["J.api.EventManager", "JU.Rectangle"], ["JV.MotionPoint", "$.ActionManager", "$.Gesture"], ["JU.AU", "$.PT", "J.api.Interface", "J.i18n.GT", "JS.SV", "$.ScriptEval", "J.thread.HoverWatcherThread", "JU.BSUtil", "$.Escape", "$.Logger", "$.Point3fi", "JV.MouseState", "$.Viewer", "JV.binding.Binding", "$.JmolBinding"], function(){
var c$ = Clazz_decorateAsClass(function(){
this.vwr = null;
this.haveMultiTouchInput = false;
this.isMultiTouch = false;
this.b = null;
this.jmolBinding = null;
this.pfaatBinding = null;
this.dragBinding = null;
this.rasmolBinding = null;
this.predragBinding = null;
this.LEFT_DRAGGED = 0;
this.current = null;
this.moved = null;
this.clicked = null;
this.pressed = null;
this.dragged = null;
this.hoverable = false;
this.hoverWatcherThread = null;
this.dragGesture = null;
this.apm = 1;
this.bondPickingMode = 0;
this.pickingStyle = 0;
this.pickingStyleSelect = 0;
this.pickingStyleMeasure = 5;
this.rootPickingStyle = 0;
this.gestureSwipeFactor = 1.0;
this.mouseDragFactor = 1.0;
this.mouseWheelFactor = 1.15;
this.pressedCount = 0;
this.clickedCount = 0;
this.drawMode = false;
this.labelMode = false;
this.dragSelectedMode = false;
this.measuresEnabled = true;
this.haveSelection = false;
this.hoverActive = false;
this.mp = null;
this.dragAtomIndex = -1;
this.mkBondPressed = false;
this.rubberbandSelectionMode = false;
this.rectRubber = null;
this.isAltKeyReleased = true;
this.keyProcessing = false;
this.isMultiTouchClient = false;
this.isMultiTouchServer = false;
this.pressAction = 0;
this.dragAction = 0;
this.clickAction = 0;
this.measurementQueued = null;
this.zoomTrigger = false;
this.selectionWorking = false;
Clazz_instantialize(this, arguments);}, JV, "ActionManager", null, J.api.EventManager);
Clazz_prepareFields (c$, function(){
this.rectRubber =  new JU.Rectangle();
});
Clazz_defineMethod(c$, "setViewer", 
function(vwr, commandOptions){
this.vwr = vwr;
this.current =  new JV.MouseState("current");
this.moved =  new JV.MouseState("moved");
this.clicked =  new JV.MouseState("clicked");
this.pressed =  new JV.MouseState("pressed");
this.dragged =  new JV.MouseState("dragged");
if (!JV.Viewer.isJS) this.createActions();
this.setBinding(this.jmolBinding =  new JV.binding.JmolBinding());
this.LEFT_DRAGGED = JV.binding.Binding.getMouseAction(1, 16, 1);
this.dragGesture =  new JV.Gesture(20, vwr);
}, "JV.Viewer,~S");
Clazz_defineMethod(c$, "isHoverable", 
function(){
return this.hoverable;
});
Clazz_defineMethod(c$, "checkHover", 
function(){
if (this.zoomTrigger) {
this.zoomTrigger = false;
if (this.vwr.currentCursor == 8) this.vwr.setCursor(0);
this.vwr.setInMotion(false);
return;
}if (!this.vwr.getInMotion(true) && !this.vwr.tm.spinOn && !this.vwr.tm.navOn && !this.vwr.checkObjectHovered(this.current.x, this.current.y)) {
var atomIndex = this.vwr.findNearestAtomIndex(this.current.x, this.current.y);
if (atomIndex < 0) return;
var isLabel = (this.apm == 2 && this.bnd(JV.binding.Binding.getMouseAction(this.clickedCount, this.moved.modifiers, 1), [10]));
this.vwr.hoverOn(atomIndex, isLabel);
}});
Clazz_defineMethod(c$, "processMultitouchEvent", 
function(groupID, eventType, touchID, iData, pt, time){
}, "~N,~N,~N,~N,JU.P3,~N");
Clazz_defineMethod(c$, "bind", 
function(desc, name){
var jmolAction = JV.ActionManager.getActionFromName(name);
var mouseAction = JV.binding.Binding.getMouseActionStr(desc);
if (mouseAction == 0) return;
if (jmolAction >= 0) {
this.b.bindAction(mouseAction, jmolAction);
} else {
this.b.bindName(mouseAction, name);
}}, "~S,~S");
Clazz_defineMethod(c$, "clearBindings", 
function(){
this.setBinding(this.jmolBinding =  new JV.binding.JmolBinding());
this.pfaatBinding = null;
this.dragBinding = null;
this.rasmolBinding = null;
});
Clazz_defineMethod(c$, "unbindAction", 
function(desc, name){
if (desc == null && name == null) {
this.clearBindings();
return;
}var jmolAction = JV.ActionManager.getActionFromName(name);
var mouseAction = JV.binding.Binding.getMouseActionStr(desc);
if (jmolAction >= 0) this.b.unbindAction(mouseAction, jmolAction);
 else if (mouseAction != 0) this.b.unbindName(mouseAction, name);
if (name == null) this.b.unbindUserAction(desc);
}, "~S,~S");
c$.newAction = Clazz_defineMethod(c$, "newAction", 
function(i, name, info){
JV.ActionManager.actionInfo[i] = info;
JV.ActionManager.actionNames[i] = name;
}, "~N,~S,~S");
Clazz_defineMethod(c$, "createActions", 
function(){
if (JV.ActionManager.actionInfo[0] != null) return;
JV.ActionManager.newAction(0, "_assignNew", J.i18n.GT.o(J.i18n.GT.$("assign/new atom or bond (requires {0})"), "set picking assignAtom_??/assignBond_?"));
JV.ActionManager.newAction(1, "_center", J.i18n.GT.$("center"));
JV.ActionManager.newAction(2, "_clickFrank", J.i18n.GT.$("pop up recent context menu (click on Jmol frank)"));
JV.ActionManager.newAction(4, "_deleteAtom", J.i18n.GT.o(J.i18n.GT.$("delete atom (requires {0})"), "set picking DELETE ATOM"));
JV.ActionManager.newAction(5, "_deleteBond", J.i18n.GT.o(J.i18n.GT.$("delete bond (requires {0})"), "set picking DELETE BOND"));
JV.ActionManager.newAction(6, "_depth", J.i18n.GT.o(J.i18n.GT.$("adjust depth (back plane; requires {0})"), "SLAB ON"));
JV.ActionManager.newAction(7, "_dragAtom", J.i18n.GT.o(J.i18n.GT.$("move atom (requires {0})"), "set picking DRAGATOM"));
JV.ActionManager.newAction(8, "_dragDrawObject", J.i18n.GT.o(J.i18n.GT.$("move whole DRAW object (requires {0})"), "set picking DRAW"));
JV.ActionManager.newAction(9, "_dragDrawPoint", J.i18n.GT.o(J.i18n.GT.$("move specific DRAW point (requires {0})"), "set picking DRAW"));
JV.ActionManager.newAction(10, "_dragLabel", J.i18n.GT.o(J.i18n.GT.$("move label (requires {0})"), "set picking LABEL"));
JV.ActionManager.newAction(11, "_dragMinimize", J.i18n.GT.o(J.i18n.GT.$("move atom and minimize molecule (requires {0})"), "set picking DRAGMINIMIZE"));
JV.ActionManager.newAction(12, "_dragMinimizeMolecule", J.i18n.GT.o(J.i18n.GT.$("move and minimize molecule (requires {0})"), "set picking DRAGMINIMIZEMOLECULE"));
JV.ActionManager.newAction(13, "_dragSelected", J.i18n.GT.o(J.i18n.GT.$("move selected atoms (requires {0})"), "set DRAGSELECTED"));
JV.ActionManager.newAction(14, "_dragZ", J.i18n.GT.o(J.i18n.GT.$("drag atoms in Z direction (requires {0})"), "set DRAGSELECTED"));
JV.ActionManager.newAction(15, "_multiTouchSimulation", J.i18n.GT.$("simulate multi-touch using the mouse)"));
JV.ActionManager.newAction(16, "_navTranslate", J.i18n.GT.o(J.i18n.GT.$("translate navigation point (requires {0} and {1})"),  Clazz_newArray(-1, ["set NAVIGATIONMODE", "set picking NAVIGATE"])));
JV.ActionManager.newAction(17, "_pickAtom", J.i18n.GT.$("pick an atom"));
JV.ActionManager.newAction(3, "_pickConnect", J.i18n.GT.o(J.i18n.GT.$("connect atoms (requires {0})"), "set picking CONNECT"));
JV.ActionManager.newAction(18, "_pickIsosurface", J.i18n.GT.o(J.i18n.GT.$("pick an ISOSURFACE point (requires {0}"), "set DRAWPICKING"));
JV.ActionManager.newAction(19, "_pickLabel", J.i18n.GT.o(J.i18n.GT.$("pick a label to toggle it hidden/displayed (requires {0})"), "set picking LABEL"));
JV.ActionManager.newAction(20, "_pickMeasure", J.i18n.GT.o(J.i18n.GT.$("pick an atom to include it in a measurement (after starting a measurement or after {0})"), "set picking DISTANCE/ANGLE/TORSION"));
JV.ActionManager.newAction(21, "_pickNavigate", J.i18n.GT.o(J.i18n.GT.$("pick a point or atom to navigate to (requires {0})"), "set NAVIGATIONMODE"));
JV.ActionManager.newAction(22, "_pickPoint", J.i18n.GT.o(J.i18n.GT.$("pick a DRAW point (for measurements) (requires {0}"), "set DRAWPICKING"));
JV.ActionManager.newAction(23, "_popupMenu", J.i18n.GT.$("pop up the full context menu"));
JV.ActionManager.newAction(24, "_reset", J.i18n.GT.$("reset (when clicked off the model)"));
JV.ActionManager.newAction(25, "_rotate", J.i18n.GT.$("rotate"));
JV.ActionManager.newAction(26, "_rotateBranch", J.i18n.GT.o(J.i18n.GT.$("rotate branch around bond (requires {0})"), "set picking ROTATEBOND"));
JV.ActionManager.newAction(27, "_rotateSelected", J.i18n.GT.o(J.i18n.GT.$("rotate selected atoms (requires {0})"), "set DRAGSELECTED"));
JV.ActionManager.newAction(28, "_rotateZ", J.i18n.GT.$("rotate Z"));
JV.ActionManager.newAction(29, "_rotateZorZoom", J.i18n.GT.$("rotate Z (horizontal motion of mouse) or zoom (vertical motion of mouse)"));
JV.ActionManager.newAction(30, "_select", J.i18n.GT.o(J.i18n.GT.$("select an atom (requires {0})"), "set pickingStyle EXTENDEDSELECT"));
JV.ActionManager.newAction(31, "_selectAndDrag", J.i18n.GT.o(J.i18n.GT.$("select and drag atoms (requires {0})"), "set DRAGSELECTED"));
JV.ActionManager.newAction(32, "_selectAndNot", J.i18n.GT.o(J.i18n.GT.$("unselect this group of atoms (requires {0})"), "set pickingStyle DRAG/EXTENDEDSELECT"));
JV.ActionManager.newAction(33, "_selectNone", J.i18n.GT.o(J.i18n.GT.$("select NONE (requires {0})"), "set pickingStyle EXTENDEDSELECT"));
JV.ActionManager.newAction(34, "_selectOr", J.i18n.GT.o(J.i18n.GT.$("add this group of atoms to the set of selected atoms (requires {0})"), "set pickingStyle DRAG/EXTENDEDSELECT"));
JV.ActionManager.newAction(35, "_selectToggle", J.i18n.GT.o(J.i18n.GT.$("toggle selection (requires {0})"), "set pickingStyle DRAG/EXTENDEDSELECT/RASMOL"));
JV.ActionManager.newAction(36, "_selectToggleOr", J.i18n.GT.o(J.i18n.GT.$("if all are selected, unselect all, otherwise add this group of atoms to the set of selected atoms (requires {0})"), "set pickingStyle DRAG"));
JV.ActionManager.newAction(37, "_setMeasure", J.i18n.GT.$("pick an atom to initiate or conclude a measurement"));
JV.ActionManager.newAction(38, "_slab", J.i18n.GT.o(J.i18n.GT.$("adjust slab (front plane; requires {0})"), "SLAB ON"));
JV.ActionManager.newAction(39, "_slabAndDepth", J.i18n.GT.o(J.i18n.GT.$("move slab/depth window (both planes; requires {0})"), "SLAB ON"));
JV.ActionManager.newAction(40, "_slideZoom", J.i18n.GT.$("zoom (along right edge of window)"));
JV.ActionManager.newAction(41, "_spinDrawObjectCCW", J.i18n.GT.o(J.i18n.GT.$("click on two points to spin around axis counterclockwise (requires {0})"), "set picking SPIN"));
JV.ActionManager.newAction(42, "_spinDrawObjectCW", J.i18n.GT.o(J.i18n.GT.$("click on two points to spin around axis clockwise (requires {0})"), "set picking SPIN"));
JV.ActionManager.newAction(43, "_stopMotion", J.i18n.GT.o(J.i18n.GT.$("stop motion (requires {0})"), "set waitForMoveTo FALSE"));
JV.ActionManager.newAction(44, "_swipe", J.i18n.GT.$("spin model (swipe and release button and stop motion simultaneously)"));
JV.ActionManager.newAction(45, "_translate", J.i18n.GT.$("translate"));
JV.ActionManager.newAction(46, "_wheelZoom", J.i18n.GT.$("zoom"));
});
c$.getActionName = Clazz_defineMethod(c$, "getActionName", 
function(i){
return (i < JV.ActionManager.actionNames.length ? JV.ActionManager.actionNames[i] : null);
}, "~N");
c$.getActionFromName = Clazz_defineMethod(c$, "getActionFromName", 
function(name){
for (var i = 0; i < JV.ActionManager.actionNames.length; i++) if (JV.ActionManager.actionNames[i].equalsIgnoreCase(name)) return i;

return -1;
}, "~S");
Clazz_defineMethod(c$, "getBindingInfo", 
function(qualifiers){
return this.b.getBindingInfo(JV.ActionManager.actionInfo, JV.ActionManager.actionNames, qualifiers);
}, "~S");
Clazz_defineMethod(c$, "setBinding", 
function(newBinding){
this.b = newBinding;
}, "JV.binding.Binding");
Clazz_defineMethod(c$, "bnd", 
function(mouseAction, jmolActions){
for (var i = jmolActions.length; --i >= 0; ) if (this.b.isBound(mouseAction, jmolActions[i])) return true;

return false;
}, "~N,~A");
Clazz_defineMethod(c$, "isDrawOrLabelAction", 
function(a){
return (this.drawMode && this.bnd(a, [8, 9]) || this.labelMode && this.bnd(a, [10]));
}, "~N");
Clazz_defineMethod(c$, "getBondPickingMode", 
function(){
return this.bondPickingMode;
});
c$.getPickingModeName = Clazz_defineMethod(c$, "getPickingModeName", 
function(pickingMode){
return (pickingMode < 0 || pickingMode >= JV.ActionManager.pickingModeNames.length ? "off" : JV.ActionManager.pickingModeNames[pickingMode]);
}, "~N");
c$.getPickingMode = Clazz_defineMethod(c$, "getPickingMode", 
function(str){
for (var i = JV.ActionManager.pickingModeNames.length; --i >= 0; ) if (str.equalsIgnoreCase(JV.ActionManager.pickingModeNames[i])) {
if (i == 38) i = 6;
return i;
}
return -1;
}, "~S");
c$.getPickingStyleName = Clazz_defineMethod(c$, "getPickingStyleName", 
function(pickingStyle){
return (pickingStyle < 0 || pickingStyle >= JV.ActionManager.pickingStyleNames.length ? "toggle" : JV.ActionManager.pickingStyleNames[pickingStyle]);
}, "~N");
c$.getPickingStyleIndex = Clazz_defineMethod(c$, "getPickingStyleIndex", 
function(str){
for (var i = JV.ActionManager.pickingStyleNames.length; --i >= 0; ) if (str.equalsIgnoreCase(JV.ActionManager.pickingStyleNames[i])) return i;

return -1;
}, "~S");
Clazz_defineMethod(c$, "getAtomPickingMode", 
function(){
return this.apm;
});
Clazz_defineMethod(c$, "setPickingMode", 
function(pickingMode){
var isNew = false;
switch (pickingMode) {
case -1:
isNew = true;
this.bondPickingMode = 35;
pickingMode = 1;
this.vwr.setStringProperty("pickingStyle", "toggle");
this.vwr.setBooleanProperty("bondPicking", false);
break;
case 34:
case 33:
case 8:
this.vwr.getModelkit(false);
case 35:
this.vwr.setBooleanProperty("bondPicking", true);
this.bondPickingMode = pickingMode;
this.resetMeasurement();
return;
}
isNew = new Boolean (isNew | (this.apm != pickingMode)).valueOf();
this.apm = pickingMode;
if (isNew) this.resetMeasurement();
}, "~N");
Clazz_defineMethod(c$, "getPickingState", 
function(){
var script = ";set modelkitMode " + this.vwr.getBoolean(603983903) + ";set picking " + JV.ActionManager.getPickingModeName(this.apm);
if (this.apm == 32) script += "_" + this.vwr.getModelkitPropertySafely("atomtype");
script += ";";
if (this.bondPickingMode != 0) script += "set picking " + JV.ActionManager.getPickingModeName(this.bondPickingMode);
if (this.bondPickingMode == 33) script += "_" + this.vwr.getModelkitPropertySafely("bondtype");
script += ";";
return script;
});
Clazz_defineMethod(c$, "getPickingStyle", 
function(){
return this.pickingStyle;
});
Clazz_defineMethod(c$, "setPickingStyle", 
function(pickingStyle){
this.pickingStyle = pickingStyle;
if (pickingStyle >= 4) {
this.pickingStyleMeasure = pickingStyle;
this.resetMeasurement();
} else {
if (pickingStyle < 3) this.rootPickingStyle = pickingStyle;
this.pickingStyleSelect = pickingStyle;
}this.rubberbandSelectionMode = false;
switch (this.pickingStyleSelect) {
case 2:
if (!this.b.name.equals("extendedSelect")) this.setBinding(this.pfaatBinding == null ? this.pfaatBinding = JV.binding.Binding.newBinding(this.vwr, "Pfaat") : this.pfaatBinding);
break;
case 3:
if (!this.b.name.equals("drag")) this.setBinding(this.dragBinding == null ? this.dragBinding = JV.binding.Binding.newBinding(this.vwr, "Drag") : this.dragBinding);
this.rubberbandSelectionMode = true;
break;
case 1:
if (!this.b.name.equals("selectOrToggle")) this.setBinding(this.rasmolBinding == null ? this.rasmolBinding = JV.binding.Binding.newBinding(this.vwr, "Rasmol") : this.rasmolBinding);
break;
default:
if (this.b !== this.jmolBinding) this.setBinding(this.jmolBinding);
}
if (!this.b.name.equals("drag")) this.predragBinding = this.b;
}, "~N");
Clazz_defineMethod(c$, "setGestureSwipeFactor", 
function(factor){
this.gestureSwipeFactor = factor;
}, "~N");
Clazz_defineMethod(c$, "setMouseDragFactor", 
function(factor){
this.mouseDragFactor = factor;
}, "~N");
Clazz_defineMethod(c$, "setMouseWheelFactor", 
function(factor){
this.mouseWheelFactor = factor;
}, "~N");
Clazz_defineMethod(c$, "setCurrent", 
function(time, x, y, mods){
this.vwr.hoverOff();
this.current.set(time, x, y, mods);
}, "~N,~N,~N,~N");
Clazz_defineMethod(c$, "getCurrentX", 
function(){
return this.current.x;
});
Clazz_defineMethod(c$, "getCurrentY", 
function(){
return this.current.y;
});
Clazz_defineMethod(c$, "setMouseMode", 
function(){
this.drawMode = this.labelMode = false;
this.dragSelectedMode = this.vwr.getDragSelected();
this.measuresEnabled = !this.dragSelectedMode;
if (!this.dragSelectedMode) switch (this.apm) {
default:
return;
case 32:
this.measuresEnabled = !this.vwr.getModelkit(false).isPickAtomAssignCharge();
return;
case 4:
this.drawMode = true;
this.measuresEnabled = false;
break;
case 2:
this.labelMode = true;
this.measuresEnabled = false;
break;
case 9:
this.measuresEnabled = false;
break;
case 19:
case 22:
case 20:
case 21:
this.measuresEnabled = false;
return;
}
this.exitMeasurementMode(null);
});
Clazz_defineMethod(c$, "clearMouseInfo", 
function(){
this.pressedCount = this.clickedCount = 0;
this.dragGesture.setAction(0, 0);
this.exitMeasurementMode(null);
});
Clazz_defineMethod(c$, "setDragAtomIndex", 
function(iatom){
this.dragAtomIndex = iatom;
this.setAtomsPicked(JU.BSUtil.newAndSetBit(iatom), "Label picked for atomIndex = " + iatom);
}, "~N");
Clazz_defineMethod(c$, "isMTClient", 
function(){
return this.isMultiTouchClient;
});
Clazz_defineMethod(c$, "isMTServer", 
function(){
return this.isMultiTouchServer;
});
Clazz_defineMethod(c$, "dispose", 
function(){
this.clear();
});
Clazz_defineMethod(c$, "clear", 
function(){
this.startHoverWatcher(false);
if (this.predragBinding != null) this.b = this.predragBinding;
this.vwr.setPickingStyle(null, this.rootPickingStyle);
this.isAltKeyReleased = true;
});
Clazz_defineMethod(c$, "startHoverWatcher", 
function(isStart){
if (this.vwr.isPreviewOnly) return;
try {
if (isStart) {
if (this.hoverWatcherThread != null) return;
this.current.time = -1;
this.hoverWatcherThread =  new J.thread.HoverWatcherThread(this, this.current, this.moved, this.vwr);
} else {
if (this.hoverWatcherThread == null) return;
this.current.time = -1;
this.hoverWatcherThread.interrupt();
this.hoverWatcherThread = null;
}} catch (e) {
if (Clazz_exceptionOf(e, Exception)){
} else {
throw e;
}
}
}, "~B");
Clazz_defineMethod(c$, "setModeMouse", 
function(modeMouse){
if (modeMouse == -1) {
this.startHoverWatcher(false);
}}, "~N");
Clazz_overrideMethod(c$, "keyPressed", 
function(key, modifiers){
if (this.keyProcessing) return false;
this.keyProcessing = true;
switch (key) {
case 18:
if (this.dragSelectedMode && this.isAltKeyReleased) this.vwr.moveSelectedXY(-2147483648, 0, modifiers);
this.isAltKeyReleased = false;
this.moved.modifiers |= 8;
break;
case 16:
this.moved.keybuf = 0;
this.dragged.modifiers |= 1;
this.moved.modifiers |= 1;
break;
case 17:
this.moved.modifiers |= 2;
break;
case 27:
this.vwr.hoverOff();
this.exitMeasurementMode("escape");
break;
default:
this.vwr.hoverOff();
break;
}
var action = 16 | 256 | 8192 | this.moved.modifiers;
if (!this.labelMode && !this.b.isUserAction(action)) {
this.checkMotionRotateZoom(action, this.current.x, 0, 0, false);
}if (this.vwr.getBoolean(603979889)) {
switch (key) {
case 38:
case 40:
case 37:
case 39:
case 32:
case 46:
this.vwr.navigate(key, modifiers);
break;
}
}this.keyProcessing = false;
return true;
}, "~N,~N");
Clazz_overrideMethod(c$, "keyTyped", 
function(keyChar, modifiers){
return false;
}, "~N,~N");
Clazz_overrideMethod(c$, "keyReleased", 
function(key){
switch (key) {
case 18:
this.moved.modifiers &= -9;
if (this.dragSelectedMode) this.vwr.moveSelectedXY(2147483647, 0, this.moved.modifiers);
this.isAltKeyReleased = true;
break;
case 16:
this.moved.modifiers &= -2;
if (this.moved.keybuf > 0 && this.vwr.isModelKitOpen()) this.checkKeyBuf(0);
break;
case 17:
this.moved.modifiers &= -3;
}
if (this.moved.modifiers == 0) this.vwr.setCursor(0);
if (key >= 65 && this.vwr.isModelKitOpen()) {
this.dragAtomIndex = this.vwr.findNearestAtomIndex(this.current.x, this.current.y);
if (this.dragAtomIndex >= 0) {
this.checkKeyBuf(key);
return;
}}if (this.vwr.getBoolean(603979889)) {
switch (key) {
case 38:
case 40:
case 37:
case 39:
this.vwr.navigate(0, 0);
break;
}
}this.moved.keybuf = 0;
}, "~N");
Clazz_defineMethod(c$, "checkKeyBuf", 
function(key){
var shiftDown = ((this.moved.modifiers & 1) != 0);
if (key != 0) {
if (this.moved.keybuf == 0) {
this.moved.keybuf = key;
if (shiftDown) return;
} else {
this.moved.keybuf += (key << 8);
}}if (this.moved.keybuf > 0) {
this.assignNew(this.moved.keybuf);
this.moved.keybuf = 0;
}}, "~N");
Clazz_overrideMethod(c$, "mouseEnterExit", 
function(time, x, y, isExit){
x = (this.vwr.tm.stereoDoubleDTI ? x << 1 : this.vwr.am.splitFrame ? this.vwr.am.setSplitFrameMouse(x) : x);
this.setCurrent(time, x, y, 0);
if (isExit) this.exitMeasurementMode("mouseExit");
}, "~N,~N,~N,~B");
Clazz_defineMethod(c$, "setMouseActions", 
function(count, buttonMods, isRelease){
this.pressAction = JV.binding.Binding.getMouseAction(count, buttonMods, isRelease ? 5 : 4);
this.dragAction = JV.binding.Binding.getMouseAction(count, buttonMods, 1);
this.clickAction = JV.binding.Binding.getMouseAction(count, buttonMods, 2);
}, "~N,~N,~B");
Clazz_overrideMethod(c$, "mouseAction", 
function(mode, time, x, y, count, buttonMods){
if (!this.vwr.getMouseEnabled()) return;
if (JU.Logger.debuggingHigh && mode != 0 && this.vwr.getBoolean(603979960)) this.vwr.showString("mouse action: " + mode + " " + buttonMods + " " + JV.binding.Binding.getMouseActionName(JV.binding.Binding.getMouseAction(count, buttonMods, mode), false), false);
switch (mode) {
case 0:
if (!this.hoverable) {
JU.Logger.info("ActionManager: mouse move detected");
this.hoverable = true;
}this.setCurrent(time, x, y, buttonMods);
this.moved.setCurrent(this.current, 0);
this.moved.keybuf = 0;
if (this.mp != null || this.hoverActive) {
this.clickAction = JV.binding.Binding.getMouseAction(this.clickedCount, buttonMods, 0);
this.checkClickAction(x, y, time, 0);
return;
}if (this.isZoomArea(x)) {
this.checkMotionRotateZoom(this.LEFT_DRAGGED, 0, 0, 0, false);
return;
}if (this.vwr.currentCursor == 8) this.vwr.setCursor(0);
return;
case 4:
this.setMouseMode();
this.pressedCount = (this.pressed.check(20, x, y, buttonMods, time, 700) ? this.pressedCount + 1 : 1);
if (this.pressedCount == 1) {
this.vwr.checkInMotion(1);
this.setCurrent(time, x, y, buttonMods);
}this.pressAction = JV.binding.Binding.getMouseAction(this.pressedCount, buttonMods, 4);
this.vwr.setCursor(12);
this.pressed.setCurrent(this.current, 1);
this.vwr.am.setSplitFrameMouse(x);
this.pressed.setModelIndex(this.vwr.am.getCurrentSplitModelIndex());
this.dragged.setCurrent(this.current, 1);
this.vwr.setFocus();
this.dragGesture.setAction(this.dragAction, time);
this.checkPressedAction(x, y, time);
return;
case 1:
this.setMouseMode();
this.setMouseActions(this.pressedCount, buttonMods, false);
var deltaX = x - this.dragged.x;
var deltaY = y - this.dragged.y;
this.setCurrent(time, x, y, buttonMods);
this.dragged.setCurrent(this.current, -1);
this.dragGesture.add(this.dragAction, x, y, time);
this.checkDragWheelAction(this.dragAction, x, y, deltaX, deltaY, time, 1);
return;
case 5:
this.pressed.setModelIndex(-1);
this.setMouseActions(this.pressedCount, buttonMods, true);
this.setCurrent(time, x, y, buttonMods);
this.vwr.spinXYBy(0, 0, 0);
var dragRelease = !this.pressed.check(10, x, y, buttonMods, time, 9223372036854775807);
this.checkReleaseAction(x, y, time, dragRelease);
return;
case 3:
if (this.vwr.isApplet && !this.vwr.hasFocus()) return;
this.setCurrent(time, this.current.x, this.current.y, buttonMods);
this.checkDragWheelAction(JV.binding.Binding.getMouseAction(0, buttonMods, 3), this.current.x, this.current.y, 0, y, time, 3);
return;
case 2:
this.setMouseMode();
this.clickedCount = (count > 1 ? count : this.clicked.check(10, 0, 0, buttonMods, time, 700) ? this.clickedCount + 1 : 1);
if (this.clickedCount == 1) {
this.setCurrent(time, x, y, buttonMods);
}this.setMouseActions(this.clickedCount, buttonMods, false);
this.clicked.setCurrent(this.current, this.clickedCount);
this.vwr.setFocus();
if (this.apm != 9 && this.bnd(JV.binding.Binding.getMouseAction(1, buttonMods, 4), [31])) return;
this.clickAction = JV.binding.Binding.getMouseAction(this.clickedCount, buttonMods, 2);
this.checkClickAction(x, y, time, this.clickedCount);
return;
}
}, "~N,~N,~N,~N,~N,~N");
Clazz_defineMethod(c$, "checkPressedAction", 
function(x, y, time){
var buttonMods = JV.binding.Binding.getButtonMods(this.pressAction);
var isDragSelectedAction = this.bnd(JV.binding.Binding.getMouseAction(1, buttonMods, 4), [31]);
if (buttonMods != 0) {
this.pressAction = this.vwr.notifyMouseClicked(x, y, this.pressAction, 4);
if (this.pressAction == 0) return;
buttonMods = JV.binding.Binding.getButtonMods(this.pressAction);
}this.setMouseActions(this.pressedCount, buttonMods, false);
if (JU.Logger.debuggingHigh && this.vwr.getBoolean(603979960)) JU.Logger.debug(JV.binding.Binding.getMouseActionName(this.pressAction, false));
if (this.isDrawOrLabelAction(this.dragAction) && this.vwr.checkObjectDragged(-2147483648, 0, x, y, this.dragAction)) return;
this.checkUserAction(this.pressAction, x, y, 0, 0, time, 4);
var isBound = false;
switch (this.apm) {
case 32:
isBound = this.bnd(this.clickAction, [0]);
break;
case 28:
isBound = this.bnd(this.dragAction, [7, 14]);
break;
case 26:
case 36:
case 37:
case 27:
case 40:
isBound = this.bnd(this.dragAction, [7, 14, 27]);
break;
case 29:
isBound = this.bnd(this.dragAction, [11, 14]);
break;
case 30:
isBound = this.bnd(this.dragAction, [11, 14, 27]);
break;
default:
isBound = (this.bondPickingMode == 34);
break;
}
if (isBound) {
this.dragAtomIndex = this.vwr.findNearestAtomIndexMovable(x, y, true);
var bi = (this.bondPickingMode == 34 ? this.vwr.getModelkit(false).getRotateBondIndex() : -1);
if (this.dragAtomIndex >= 0 && (bi >= 0 || this.apm == 32 || this.apm == 31)) {
this.enterMeasurementMode(this.dragAtomIndex);
this.mp.addPoint(this.dragAtomIndex, null, false);
if (bi >= 0) {
this.updateModelkitBranch(bi, true);
}}var xy = this.vwr.getModelkitPropertySafely("screenxy");
this.mkBondPressed = (xy != null && this.pressed.inRange(10, xy[0], xy[1]));
return;
}if (this.bnd(this.pressAction, [23])) {
this.doPopup(x, y);
return;
}if (this.dragSelectedMode) {
this.haveSelection = (!isDragSelectedAction || this.vwr.findNearestAtomIndexMovable(x, y, true) >= 0);
if (this.haveSelection && this.bnd(this.dragAction, [13, 14])) this.vwr.moveSelectedXY(-2147483648, 0, buttonMods);
return;
}this.checkMotionRotateZoom(this.dragAction, x, 0, 0, true);
}, "~N,~N,~N");
Clazz_defineMethod(c$, "checkDragWheelAction", 
function(dragWheelAction, x, y, deltaX, deltaY, time, mode){
var buttonmods = JV.binding.Binding.getButtonMods(dragWheelAction);
if (buttonmods != 0) {
var newAction = this.vwr.notifyMouseClicked(x, y, JV.binding.Binding.getMouseAction(this.pressedCount, buttonmods, mode), mode);
if (newAction == 0) return;
if (newAction > 0) dragWheelAction = newAction;
}if (this.isRubberBandSelect(dragWheelAction)) {
this.calcRectRubberBand();
this.vwr.refresh(3, "rubberBand selection");
return;
}if (this.checkUserAction(dragWheelAction, x, y, deltaX, deltaY, time, mode)) return;
var bi = (this.bondPickingMode == 34 ? this.vwr.getModelkit(false).getRotateBondIndex() : -1);
if (bi >= 0) {
if (this.dragAtomIndex >= 0 || this.mkBondPressed || this.bnd(dragWheelAction, [26])) {
if (this.dragAtomIndex >= 0) {
this.updateModelkitBranch(bi, false);
}this.vwr.moveSelected(deltaX, deltaY, -2147483648, x, y, null, null, null, false, false, this.dragAtomIndex >= 0 ? 0 : 16);
return;
}}if (this.apm == 40 || this.vwr.am.splitFrame && this.vwr.ms.isJmolDataFrame(this.pressed.modelIndex)) {
if (this.apm == 40 || this.bnd(dragWheelAction, [29])) {
this.vwr.rotateSpins(deltaX, deltaY);
return;
} else if (this.apm == 40) {
return;
}}var bs = null;
if (this.dragAtomIndex >= 0 && this.apm != 2) {
switch (this.apm) {
case 26:
this.dragSelected(dragWheelAction, deltaX, deltaY, true);
return;
case 36:
case 37:
case 27:
case 30:
bs = this.vwr.ms.getAtoms((this.apm == 37 ? 1094717454 : 1094713360), JU.BSUtil.newAndSetBit(this.dragAtomIndex));
if (this.apm == 36) bs.and(this.vwr.getAtomBitSet("ligand"));
case 28:
case 29:
if (this.dragGesture.getPointCount() == 1) this.vwr.undoMoveActionClear(this.dragAtomIndex, 2, true);
this.setMotion(13, true);
if (this.bnd(dragWheelAction, [27])) {
this.vwr.rotateSelected(this.getDegrees(deltaX, true), this.getDegrees(deltaY, false), bs);
} else {
switch (this.apm) {
case 36:
case 37:
case 27:
case 30:
this.vwr.selectStatus(bs, false, 0, true, true);
break;
}
this.vwr.moveAtomWithHydrogens(this.dragAtomIndex, deltaX, deltaY, (this.bnd(dragWheelAction, [14]) ? -deltaY : -2147483648), null, bs);
this.vwr.checkCoordinatesChanged(null);
}return;
}
}if (this.dragAtomIndex >= 0 && mode == 1 && this.bnd(this.clickAction, [0]) && this.apm == 32) {
var nearestAtomIndex = this.vwr.findNearestAtomIndexMovable(x, y, false);
if (nearestAtomIndex >= 0) {
if (this.mp != null) {
this.mp.setCount(1);
} else if (this.measuresEnabled) {
this.enterMeasurementMode(nearestAtomIndex);
}this.addToMeasurement(nearestAtomIndex, null, true);
this.mp.colix = 20;
} else if (this.mp != null) {
this.mp.setCount(1);
this.mp.colix = 23;
}if (this.mp == null) return;
if (this.vwr.antialiased) {
x <<= 1;
y <<= 1;
}this.mp.traceX = x;
this.mp.traceY = y;
this.vwr.refresh(3, "assignNew");
return;
}if (!this.drawMode && !this.labelMode && this.bnd(dragWheelAction, [45])) {
this.vwr.translateXYBy(deltaX, deltaY);
return;
}if (this.dragSelectedMode && this.haveSelection && this.bnd(dragWheelAction, [13, 27])) {
var iatom = this.vwr.bsA().nextSetBit(0);
if (iatom < 0) return;
if (this.dragGesture.getPointCount() == 1) this.vwr.undoMoveActionClear(iatom, 2, true);
 else this.vwr.moveSelected(2147483647, 0, -2147483648, -2147483648, -2147483648, null, null, null, false, false, buttonmods);
this.dragSelected(dragWheelAction, deltaX, deltaY, false);
return;
}if (this.isDrawOrLabelAction(dragWheelAction)) {
this.setMotion(13, true);
if (this.vwr.checkObjectDragged(this.dragged.x, this.dragged.y, x, y, dragWheelAction)) {
return;
}}if (this.checkMotionRotateZoom(dragWheelAction, x, deltaX, deltaY, true)) {
if (this.vwr.tm.slabEnabled && this.bnd(dragWheelAction, [39])) this.vwr.slabDepthByPixels(deltaY);
 else this.vwr.zoomBy(deltaY);
return;
}if (this.bnd(dragWheelAction, [25])) {
this.vwr.rotateXYBy(this.getDegrees(deltaX, true), this.getDegrees(deltaY, false));
return;
}if (this.bnd(dragWheelAction, [29])) {
if (deltaX == 0 && Math.abs(deltaY) > 1) {
this.setMotion(8, true);
this.vwr.zoomBy(deltaY + (deltaY > 0 ? -1 : 1));
} else if (deltaY == 0 && Math.abs(deltaX) > 1) {
this.setMotion(13, true);
this.vwr.rotateZBy(-deltaX + (deltaX > 0 ? 1 : -1), 2147483647, 2147483647);
}return;
}if (this.vwr.tm.slabEnabled) {
if (this.bnd(dragWheelAction, [6])) {
this.vwr.depthByPixels(deltaY);
return;
}if (this.bnd(dragWheelAction, [38])) {
this.vwr.slabByPixels(deltaY);
return;
}if (this.bnd(dragWheelAction, [39])) {
this.vwr.slabDepthByPixels(deltaY);
return;
}}if (this.bnd(dragWheelAction, [46])) {
this.zoomByFactor(deltaY, 2147483647, 2147483647);
return;
}if (this.bnd(dragWheelAction, [28])) {
this.setMotion(13, true);
this.vwr.rotateZBy(-deltaX, 2147483647, 2147483647);
return;
}}, "~N,~N,~N,~N,~N,~N,~N");
Clazz_defineMethod(c$, "updateModelkitBranch", 
function(bondIndex, isClick){
this.vwr.setModelkitPropertySafely(isClick ? "branchatomclicked" : "branchatomdragged", Integer.$valueOf(this.dragAtomIndex));
if (this.measurementQueued == null || this.measurementQueued.numSet == 0 || this.mp == null) {
this.vwr.setPendingMeasurement(this.vwr.getModelkit(false).setBondMeasure(bondIndex, this.measurementQueued = this.mp = this.getMP()));
} else {
this.measurementQueued.refresh(null);
}}, "~N,~B");
Clazz_defineMethod(c$, "dragSelected", 
function(a, deltaX, deltaY, isPickingDrag){
this.setMotion(13, true);
if (this.bnd(a, [27]) && this.vwr.getBoolean(603979785)) this.vwr.rotateSelected(this.getDegrees(deltaX, true), this.getDegrees(deltaY, false), null);
 else this.vwr.moveSelected(deltaX, deltaY, (isPickingDrag && this.bnd(a, [14]) ? -deltaY : -2147483648), -2147483648, -2147483648, null, null, null, true, false, this.dragged.modifiers);
}, "~N,~N,~N,~B");
Clazz_defineMethod(c$, "checkReleaseAction", 
function(x, y, time, dragRelease){
if (JU.Logger.debuggingHigh && this.vwr.getBoolean(603979960)) JU.Logger.debug(JV.binding.Binding.getMouseActionName(this.pressAction, false));
this.vwr.checkInMotion(0);
this.vwr.setInMotion(false);
this.vwr.setCursor(0);
this.dragGesture.add(this.dragAction, x, y, time);
if (this.dragAtomIndex >= 0 && !this.vwr.isModelkitPickingRotateBond()) {
if (this.apm == 29 || this.apm == 30) this.minimize(true);
}if (this.apm == 32 && this.bnd(this.clickAction, [0])) {
if (this.mp == null || this.dragAtomIndex < 0) {
this.exitMeasurementMode(null);
return;
} else if (this.bondPickingMode == 34) {
this.vwr.setModelkitPropertySafely("rotatebond", Integer.$valueOf(this.dragAtomIndex));
this.exitMeasurementMode(null);
return;
}this.assignNew(-1);
return;
}this.dragAtomIndex = -1;
this.mkBondPressed = false;
var isRbAction = this.isRubberBandSelect(this.dragAction);
if (isRbAction) this.selectRb(this.clickAction);
this.rubberbandSelectionMode = (this.b.name.equals("drag"));
this.rectRubber.x = 2147483647;
if (dragRelease) {
this.vwr.notifyMouseClicked(x, y, JV.binding.Binding.getMouseAction(this.pressedCount, 0, 5), 5);
}if (this.isDrawOrLabelAction(this.dragAction)) {
this.vwr.checkObjectDragged(2147483647, 0, x, y, this.dragAction);
return;
}if (this.haveSelection && this.dragSelectedMode && this.bnd(this.dragAction, [13])) this.vwr.moveSelectedXY(2147483647, 0, this.dragged.modifiers);
if (dragRelease && this.checkUserAction(this.pressAction, x, y, 0, 0, time, 5)) return;
if (this.vwr.getBoolean(603979780)) {
if (this.bnd(this.dragAction, [44])) {
var speed = this.getExitRate();
if (speed > 0) this.vwr.spinXYBy(this.dragGesture.getDX(4, 2), this.dragGesture.getDY(4, 2), speed * 30 * this.gestureSwipeFactor);
if (this.vwr.g.logGestures) this.vwr.log("$NOW$ swipe " + this.dragGesture + " " + speed);
return;
}}}, "~N,~N,~N,~B");
Clazz_defineMethod(c$, "checkClickAction", 
function(x, y, time, clickedCount){
if (clickedCount > 1 && (this.apm == 5 || this.apm == 6)) {
this.resetMeasurement();
this.runScript("draw ID sym* delete;spin off;");
return;
}if (clickedCount > 0) {
if (this.checkUserAction(this.clickAction, x, y, 0, 0, time, 32768)) return;
this.clickAction = this.vwr.notifyMouseClicked(x, y, this.clickAction, 32768);
if (this.clickAction == 0) return;
}if (JU.Logger.debuggingHigh && this.vwr.getBoolean(603979960)) JU.Logger.debug(JV.binding.Binding.getMouseActionName(this.clickAction, false));
if (this.bnd(this.clickAction, [2])) {
if (this.vwr.frankClicked(x, y)) {
this.vwr.popupMenu(-x, y, 'j');
return;
}if (this.vwr.frankClickedModelKit(x, y)) {
this.vwr.popupMenu(10, 0, 'm');
return;
}}var nearestPoint = null;
var isBond = false;
var isIsosurface = false;
var map = null;
if (!this.drawMode) {
map = this.vwr.checkObjectClicked(x, y, this.clickAction);
if (map != null) {
if (this.labelMode) {
this.pickLabel((map.get("atomIndex")).intValue());
return;
}isBond = "bond".equals(map.get("type"));
isIsosurface = "isosurface".equals(map.get("type"));
nearestPoint = this.getPoint(map);
if (isBond && this.vwr.isModelkitPickingRotateBond()) {
this.vwr.highlightBond((map.get("index")).intValue(), -1, x, y);
}}}if (isBond) clickedCount = 1;
if (nearestPoint != null && Float.isNaN(nearestPoint.x)) return;
var nearestAtomIndex = this.findNearestAtom(x, y, nearestPoint, clickedCount > 0);
if (this.bnd(this.clickAction, [23])) {
this.doPopup(x, y);
return;
}if (clickedCount == 0 && this.apm != 32 && !this.vwr.isModelkitPickingRotateBond()) {
if (this.mp == null) return;
if (nearestPoint != null || this.mp.getIndexOf(nearestAtomIndex) == 0) {
try {
this.mp.addPoint(nearestAtomIndex, nearestPoint, false);
} catch (e) {
if (Clazz_exceptionOf(e, Exception)){
this.exitMeasurementMode(null);
return;
} else {
throw e;
}
}
}if (this.mp.haveModified) this.vwr.setPendingMeasurement(this.mp);
this.vwr.refresh(3, "measurementPending");
return;
}this.setMouseMode();
if (this.bnd(this.clickAction, [43])) {
this.vwr.tm.stopMotion();
}if (this.vwr.getBoolean(603979889) && this.apm == 23 && this.bnd(this.clickAction, [21])) {
this.vwr.navTranslatePercent(x * 100 / this.vwr.getScreenWidth() - 50, y * 100 / this.vwr.getScreenHeight() - 50);
return;
}if (isBond) {
if (this.bnd(this.clickAction, [this.bondPickingMode == 34 || this.bondPickingMode == 33 ? 0 : 5])) {
this.bondPicked((map.get("index")).intValue());
this.vwr.refresh(1, "bondpicked");
return;
}} else if (isIsosurface) {
return;
} else {
if (this.apm != 32 && this.mp != null && this.bnd(this.clickAction, [20])) {
this.atomOrPointPicked(nearestAtomIndex, nearestPoint);
if (this.addToMeasurement(nearestAtomIndex, nearestPoint, false) == 4) this.toggleMeasurement();
return;
}if (this.bnd(this.clickAction, [37])) {
if (this.mp != null) {
this.addToMeasurement(nearestAtomIndex, nearestPoint, true);
this.toggleMeasurement();
} else if (!this.drawMode && !this.labelMode && !this.dragSelectedMode && this.measuresEnabled) {
this.enterMeasurementMode(nearestAtomIndex);
this.addToMeasurement(nearestAtomIndex, nearestPoint, true);
}this.atomOrPointPicked(nearestAtomIndex, nearestPoint);
return;
}}if (this.isSelectAction(this.clickAction)) {
if (!isIsosurface) this.atomOrPointPicked(nearestAtomIndex, nearestPoint);
return;
}if (this.bnd(this.clickAction, [24])) {
if (nearestAtomIndex < 0) this.reset();
return;
}}, "~N,~N,~N,~N");
Clazz_defineMethod(c$, "doPopup", 
function(x, y){
this.vwr.popupMenu(x, y, this.vwr.isModelKitOpen() ? 'm' : 'j');
}, "~N,~N");
Clazz_defineMethod(c$, "pickLabel", 
function(iatom){
var label = this.vwr.ms.at[iatom].atomPropertyString(this.vwr, 1825200146);
if (this.pressedCount == 2) {
label = this.vwr.prompt("Set label for atomIndex=" + iatom, label, false);
if (label != null) {
this.vwr.shm.setAtomLabel(label, iatom);
this.vwr.refresh(1, "label atom");
}} else {
this.setAtomsPicked(JU.BSUtil.newAndSetBit(iatom), "Label picked for atomIndex = " + iatom + ": " + label);
}}, "~N");
Clazz_defineMethod(c$, "checkUserAction", 
function(mouseAction, x, y, deltaX, deltaY, time, mode){
if (!this.b.isUserAction(mouseAction)) return false;
var passThrough = false;
var obj;
var ht = this.b.getBindings();
var mkey = mouseAction + "\t";
for (var key, $key = ht.keySet().iterator (); $key.hasNext()&& ((key = $key.next ()) || true);) {
if (key.indexOf(mkey) != 0 || !JU.AU.isAS(obj = ht.get(key))) continue;
var script = (obj)[1];
var nearestPoint = null;
if (script.indexOf("_ATOM") >= 0) {
var iatom = this.findNearestAtom(x, y, null, true);
script = JU.PT.rep(script, "_ATOM", "({" + (iatom >= 0 ? "" + iatom : "") + "})");
if (iatom >= 0) script = JU.PT.rep(script, "_POINT", JU.Escape.eP(this.vwr.ms.at[iatom]));
}if (!this.drawMode && (script.indexOf("_POINT") >= 0 || script.indexOf("_OBJECT") >= 0 || script.indexOf("_BOND") >= 0)) {
var t = this.vwr.checkObjectClicked(x, y, mouseAction);
if (t != null && (nearestPoint = t.get("pt")) != null) {
var isBond = t.get("type").equals("bond");
if (isBond) script = JU.PT.rep(script, "_BOND", "[{" + t.get("index") + "}]");
script = JU.PT.rep(script, "_POINT", JU.Escape.eP(nearestPoint));
script = JU.PT.rep(script, "_OBJECT", JU.Escape.escapeMap(t));
}script = JU.PT.rep(script, "_BOND", "[{}]");
script = JU.PT.rep(script, "_OBJECT", "{}");
}script = JU.PT.rep(script, "_POINT", "{}");
script = JU.PT.rep(script, "_ACTION", "" + mouseAction);
script = JU.PT.rep(script, "_X", "" + x);
script = JU.PT.rep(script, "_Y", "" + (this.vwr.getScreenHeight() - y));
script = JU.PT.rep(script, "_DELTAX", "" + deltaX);
script = JU.PT.rep(script, "_DELTAY", "" + deltaY);
script = JU.PT.rep(script, "_TIME", "" + time);
script = JU.PT.rep(script, "_MODE", "" + mode);
if (script.startsWith("+:")) {
passThrough = true;
script = script.substring(2);
}this.vwr.evalStringQuiet(script);
}
return !passThrough;
}, "~N,~N,~N,~N,~N,~N,~N");
Clazz_defineMethod(c$, "checkMotionRotateZoom", 
function(mouseAction, x, deltaX, deltaY, isDrag){
var isSlideZoom = this.bnd(mouseAction, [40]) && this.isZoomArea(this.pressed.x);
var isRotateXY = this.bnd(mouseAction, [25]);
var isRotateZorZoom = this.bnd(mouseAction, [29]);
if (!isSlideZoom && !isRotateXY && !isRotateZorZoom) return false;
var isZoom = (isRotateZorZoom && (deltaX == 0 || Math.abs(deltaY) > 5 * Math.abs(deltaX)));
var cursor = (isZoom || this.isZoomArea(this.moved.x) || this.bnd(mouseAction, [46]) ? 8 : isRotateXY || isRotateZorZoom ? 13 : this.bnd(mouseAction, [1]) ? 12 : 0);
this.setMotion(cursor, isDrag);
return (isZoom || isSlideZoom);
}, "~N,~N,~N,~N,~B");
Clazz_defineMethod(c$, "getExitRate", 
function(){
var dt = this.dragGesture.getTimeDifference(2);
return (this.isMultiTouch ? (dt > (80) ? 0 : this.dragGesture.getSpeedPixelsPerMillisecond(2, 1)) : (dt > 10 ? 0 : this.dragGesture.getSpeedPixelsPerMillisecond(4, 2)));
});
Clazz_defineMethod(c$, "isRubberBandSelect", 
function(action){
action = action & -8193 | 32768;
return (this.rubberbandSelectionMode && this.bnd(action, [35, 34, 32]));
}, "~N");
Clazz_defineMethod(c$, "getRubberBand", 
function(){
return (this.rubberbandSelectionMode && this.rectRubber.x != 2147483647 ? this.rectRubber : null);
});
Clazz_defineMethod(c$, "calcRectRubberBand", 
function(){
var factor = (this.vwr.antialiased ? 2 : 1);
if (this.current.x < this.pressed.x) {
this.rectRubber.x = this.current.x * factor;
this.rectRubber.width = (this.pressed.x - this.current.x) * factor;
} else {
this.rectRubber.x = this.pressed.x * factor;
this.rectRubber.width = (this.current.x - this.pressed.x) * factor;
}if (this.current.y < this.pressed.y) {
this.rectRubber.y = this.current.y * factor;
this.rectRubber.height = (this.pressed.y - this.current.y) * factor;
} else {
this.rectRubber.y = this.pressed.y * factor;
this.rectRubber.height = (this.current.y - this.pressed.y) * factor;
}});
Clazz_defineMethod(c$, "getDegrees", 
function(delta, isX){
return delta / Math.min(500, isX ? this.vwr.getScreenWidth() : this.vwr.getScreenHeight()) * 180 * this.mouseDragFactor;
}, "~N,~B");
Clazz_defineMethod(c$, "isZoomArea", 
function(x){
return x > this.vwr.getScreenWidth() * (this.vwr.haveTwoImages() ? 2 : 1) * 98 / 100;
}, "~N");
Clazz_defineMethod(c$, "getPoint", 
function(t){
var pt = JU.Point3fi.newPF(t.get("pt"), 0);
pt.mi = (t.get("modelIndex")).intValue();
return pt;
}, "java.util.Map");
Clazz_defineMethod(c$, "findNearestAtom", 
function(x, y, nearestPoint, isClicked){
var index = (this.drawMode || nearestPoint != null ? -1 : this.vwr.findNearestAtomIndexMovable(x, y, false));
return (index >= 0 && (isClicked || this.mp == null) && !this.vwr.slm.isInSelectionSubset(index) ? -1 : index);
}, "~N,~N,JU.Point3fi,~B");
Clazz_defineMethod(c$, "isSelectAction", 
function(action){
return (this.bnd(action, [17]) || !this.drawMode && !this.labelMode && this.apm == 1 && this.bnd(action, [1]) || this.dragSelectedMode && this.bnd(this.dragAction, [27, 13]) || this.bnd(action, [22, 35, 32, 34, 36, 30]));
}, "~N");
Clazz_defineMethod(c$, "enterMeasurementMode", 
function(iAtom){
this.vwr.setPicked(iAtom, true);
this.vwr.setCursor(1);
this.vwr.setPendingMeasurement(this.mp = this.getMP());
if (iAtom >= 0) this.mp.setModelIndex(this.vwr.ms.at[iAtom].mi);
this.measurementQueued = this.mp;
}, "~N");
Clazz_defineMethod(c$, "getMP", 
function(){
return (J.api.Interface.getInterface("JM.MeasurementPending", this.vwr, "mouse")).set(this.vwr.ms);
});
Clazz_defineMethod(c$, "addToMeasurement", 
function(atomIndex, nearestPoint, dblClick){
if (atomIndex == -1 && nearestPoint == null || this.mp == null) {
this.exitMeasurementMode(null);
return 0;
}var measurementCount = this.mp.count;
if (this.mp.traceX != -2147483648 && measurementCount == 2) this.mp.setCount(measurementCount = 1);
return (measurementCount == 4 && !dblClick ? measurementCount : this.mp.addPoint(atomIndex, nearestPoint, true));
}, "~N,JU.Point3fi,~B");
Clazz_defineMethod(c$, "resetMeasurement", 
function(){
this.exitMeasurementMode(null);
this.measurementQueued = this.getMP();
});
Clazz_defineMethod(c$, "exitMeasurementMode", 
function(refreshWhy){
if (this.mp == null) return;
this.vwr.setPendingMeasurement(this.mp = null);
this.vwr.setCursor(0);
if (refreshWhy != null) this.vwr.refresh(3, refreshWhy);
}, "~S");
Clazz_defineMethod(c$, "getSequence", 
function(){
var a1 = this.measurementQueued.getAtomIndex(1);
var a2 = this.measurementQueued.getAtomIndex(2);
if (a1 < 0 || a2 < 0) return;
try {
var sequence = this.vwr.getSmilesOpt(null, a1, a2, 1048576, null);
this.vwr.setStatusMeasuring("measureSequence", -2, sequence, 0);
} catch (e) {
if (Clazz_exceptionOf(e, Exception)){
JU.Logger.error(e.toString());
} else {
throw e;
}
}
});
Clazz_defineMethod(c$, "minimize", 
function(dragDone){
var iAtom = this.dragAtomIndex;
if (dragDone) {
this.dragAtomIndex = -1;
this.mkBondPressed = false;
}this.vwr.dragMinimizeAtom(iAtom);
}, "~B");
Clazz_defineMethod(c$, "queueAtom", 
function(atomIndex, ptClicked){
var n = this.measurementQueued.addPoint(atomIndex, ptClicked, true);
if (atomIndex >= 0) this.vwr.setStatusAtomPicked(atomIndex, "Atom #" + n + ":" + this.vwr.getAtomInfo(atomIndex), null, false);
return n;
}, "~N,JU.Point3fi");
Clazz_defineMethod(c$, "setMotion", 
function(cursor, inMotion){
switch (this.vwr.currentCursor) {
case 3:
break;
default:
this.vwr.setCursor(cursor);
}
if (inMotion) this.vwr.setInMotion(true);
}, "~N,~B");
Clazz_defineMethod(c$, "zoomByFactor", 
function(dz, x, y){
if (dz == 0) return;
this.setMotion(8, true);
this.vwr.zoomByFactor(Math.pow(this.mouseWheelFactor, dz), x, y);
this.moved.setCurrent(this.current, 0);
this.vwr.setInMotion(true);
this.zoomTrigger = true;
this.startHoverWatcher(true);
}, "~N,~N,~N");
Clazz_defineMethod(c$, "runScript", 
function(script){
this.vwr.evalStringGUI(script);
}, "~S");
Clazz_defineMethod(c$, "atomOrPointPicked", 
function(atomIndex, ptClicked){
if (atomIndex < 0) {
this.resetMeasurement();
if (this.bnd(this.clickAction, [33])) {
this.runScript("select none");
return;
}if (this.apm != 5 && this.apm != 6) return;
}var n = 2;
switch (this.apm) {
case 28:
case 29:
return;
case 0:
return;
case 25:
case 24:
case 8:
var isDelete = (this.apm == 8);
var isStruts = (this.apm == 25);
if (!this.bnd(this.clickAction, [(isDelete ? 5 : 3)])) return;
if (this.measurementQueued == null || this.measurementQueued.count == 0 || this.measurementQueued.count > 2) {
this.resetMeasurement();
this.enterMeasurementMode(atomIndex);
}this.addToMeasurement(atomIndex, ptClicked, true);
if (this.queueAtom(atomIndex, ptClicked) != 2) return;
var cAction = (isDelete || this.measurementQueued.isConnected(this.vwr.ms.at, 2) ? " DELETE" : isStruts ? "STRUTS" : "");
this.runScript("connect " + this.measurementQueued.getMeasurementScript(" ", true) + cAction);
this.resetMeasurement();
return;
case 21:
n++;
case 20:
n++;
case 18:
case 19:
case 22:
if (!this.bnd(this.clickAction, [20])) return;
if (this.measurementQueued == null || this.measurementQueued.count == 0 || this.measurementQueued.count > n) {
this.resetMeasurement();
this.enterMeasurementMode(atomIndex);
}this.addToMeasurement(atomIndex, ptClicked, true);
this.queueAtom(atomIndex, ptClicked);
var i = this.measurementQueued.count;
if (i == 1) this.vwr.setPicked(atomIndex, true);
if (i < n) return;
if (this.apm == 22) {
this.getSequence();
} else {
this.vwr.setStatusMeasuring("measurePicked", n, this.measurementQueued.getStringDetail(), this.measurementQueued.value);
if (this.apm == 18 || this.pickingStyleMeasure == 4) {
this.runScript("measure " + this.measurementQueued.getMeasurementScript(" ", true));
}}this.resetMeasurement();
return;
}
var mode = (this.mp != null && this.apm != 1 ? 1 : this.apm);
switch (mode) {
case 3:
if (!this.bnd(this.clickAction, [17])) return;
if (ptClicked == null) {
this.zoomTo(atomIndex);
} else {
this.runScript("zoomTo " + JU.Escape.eP(ptClicked));
}return;
case 5:
case 6:
if (this.bnd(this.clickAction, [17])) {
this.checkTwoAtomAction(ptClicked, atomIndex);
return;
}}
if (ptClicked != null) return;
var bs;
switch (mode) {
case 1:
if (!this.drawMode && !this.labelMode && this.bnd(this.clickAction, [1])) this.zoomTo(atomIndex);
 else if (this.bnd(this.clickAction, [17])) this.vwr.setStatusAtomPicked(atomIndex, null, null, false);
return;
case 2:
if (this.bnd(this.clickAction, [19])) {
this.runScript("set labeltoggle {atomindex=" + atomIndex + "}");
this.pickLabel(atomIndex);
}return;
case 31:
if (this.bnd(this.clickAction, [0])) {
this.vwr.invertAtomCoord(null, null, null, atomIndex, true);
this.vwr.setStatusAtomPicked(atomIndex, "invert stereo for atomIndex=" + atomIndex, null, false);
}return;
case 7:
if (this.bnd(this.clickAction, [4])) {
bs = JU.BSUtil.newAndSetBit(atomIndex);
this.vwr.deleteAtoms(bs, false);
this.vwr.setStatusAtomPicked(atomIndex, "deleted: " + JU.Escape.eBS(bs), null, false);
}return;
}
var spec = "atomindex=" + atomIndex;
switch (this.apm) {
default:
return;
case 9:
this.selectAtoms(spec);
break;
case 10:
this.selectAtoms("within(group, " + spec + ")");
break;
case 11:
this.selectAtoms("within(chain, " + spec + ")");
break;
case 13:
this.selectAtoms("within(polymer, " + spec + ")");
break;
case 14:
this.selectAtoms("within(structure, " + spec + ")");
break;
case 12:
this.selectAtoms("within(molecule, " + spec + ")");
break;
case 16:
this.selectAtoms("within(model, " + spec + ")");
break;
case 17:
this.selectAtoms("visible and within(element, " + spec + ")");
break;
case 15:
this.selectAtoms("visible and within(site, " + spec + ")");
break;
case 39:
this.selectAtoms("visible and within(vxyz, " + spec + ")");
break;
}
this.vwr.clearClickCount();
this.vwr.setStatusAtomPicked(atomIndex, null, null, false);
}, "~N,JU.Point3fi");
Clazz_defineMethod(c$, "assignNew", 
function(key){
if (key < 0) {
if (!this.vwr.getModelkit(false).handleAssignNew(this.pressed, this.dragged, this.mp, this.dragAtomIndex, key)) {
this.exitMeasurementMode("bond dropped");
}} else {
this.vwr.getModelkit(false).handleAssignNew(this.current, this.current, null, this.dragAtomIndex, key);
}this.exitMeasurementMode(null);
}, "~N");
Clazz_defineMethod(c$, "bondPicked", 
function(index){
switch (this.bondPickingMode) {
case 33:
this.vwr.undoMoveActionClear(-1, 4146, true);
this.vwr.getModelkit(false).setProperty("assignbond", Integer.$valueOf(index));
break;
case 34:
break;
case 8:
this.vwr.deleteBonds(JU.BSUtil.newAndSetBit(index));
}
}, "~N");
Clazz_defineMethod(c$, "checkTwoAtomAction", 
function(ptClicked, atomIndex){
var isSpin = (this.apm == 5);
var isSymmetry = (this.apm == 6);
if (!isSpin && !isSymmetry) return;
if (this.vwr.tm.spinOn || this.vwr.tm.navOn || this.vwr.getPendingMeasurement() != null) {
this.resetMeasurement();
if (this.vwr.tm.spinOn) this.runScript("spin off");
return;
}if (this.measurementQueued.count >= 2) this.resetMeasurement();
var queuedAtomCount = this.measurementQueued.count;
if (queuedAtomCount == 1) {
if (ptClicked == null) {
if (this.measurementQueued.getAtomIndex(1) == atomIndex) return;
} else {
if (this.measurementQueued.getAtom(1).distance(ptClicked) == 0) return;
}}if (!isSpin && !isSymmetry) return;
if (atomIndex >= 0 || ptClicked != null) queuedAtomCount = this.queueAtom(atomIndex, ptClicked);
if (queuedAtomCount < 2) {
if (isSpin) this.vwr.scriptStatus(queuedAtomCount == 1 ? J.i18n.GT.$("pick one more atom in order to spin the model around an axis") : J.i18n.GT.$("pick two atoms in order to spin the model around an axis"));
 else this.vwr.scriptStatus(queuedAtomCount == 1 ? J.i18n.GT.$("pick one more atom in order to display the symmetry relationship") : J.i18n.GT.$("pick two atoms in order to display the symmetry relationship between them"));
return;
}if (isSpin) {
var s = this.measurementQueued.getMeasurementScript(" ", false);
this.resetMeasurement();
this.runScript("spin" + s + " " + this.vwr.getInt(553648157));
} else {
var a1 = this.measurementQueued.getAtomIndex(1);
var a2 = this.measurementQueued.getAtomIndex(2);
this.resetMeasurement();
this.vwr.getModelkit(false).drawSymop(a1, a2);
}}, "JU.Point3fi,~N");
Clazz_defineMethod(c$, "reset", 
function(){
this.runScript("!reset");
});
Clazz_defineMethod(c$, "selectAtoms", 
function(item){
if (this.mp != null || this.selectionWorking) return;
this.selectionWorking = true;
var s = (this.rubberbandSelectionMode || this.bnd(this.clickAction, [35]) ? "selected and not (" + item + ") or (not selected) and " : this.bnd(this.clickAction, [32]) ? "selected and not " : this.bnd(this.clickAction, [34]) ? "selected or " : this.clickAction == 0 || this.bnd(this.clickAction, [36]) ? "selected tog " : this.bnd(this.clickAction, [30]) ? "" : null);
if (s != null) {
s += "(" + item + ")";
try {
var bs = this.vwr.getAtomBitSetEval(null, s);
this.setAtomsPicked(bs, "selected: " + JU.Escape.eBS(bs));
this.vwr.refresh(3, "selections set");
} catch (e) {
if (Clazz_exceptionOf(e, Exception)){
} else {
throw e;
}
}
}this.selectionWorking = false;
}, "~S");
Clazz_defineMethod(c$, "setAtomsPicked", 
function(bs, msg){
this.vwr.selectStatus(bs, false, 0, false, true);
this.vwr.setStatusAtomPicked(-1, msg, null, false);
}, "JU.BS,~S");
Clazz_defineMethod(c$, "selectRb", 
function(action){
var bs = this.vwr.ms.findAtomsInRectangle(this.rectRubber);
if (bs.length() > 0) {
var s = JU.Escape.eBS(bs);
if (this.bnd(action, [34])) this.runScript("selectionHalos on;select selected or " + s);
 else if (this.bnd(action, [32])) this.runScript("selectionHalos on;select selected and not " + s);
 else this.runScript("selectionHalos on;select selected tog " + s);
}this.vwr.refresh(3, "mouseReleased");
}, "~N");
Clazz_defineMethod(c$, "toggleMeasurement", 
function(){
if (this.mp == null) return;
var measurementCount = this.mp.count;
if (measurementCount >= 2 && measurementCount <= 4) this.runScript("!measure " + this.mp.getMeasurementScript(" ", true));
this.exitMeasurementMode(null);
});
Clazz_defineMethod(c$, "zoomTo", 
function(atomIndex){
this.runScript("zoomTo (atomindex=" + atomIndex + ")");
this.vwr.setStatusAtomPicked(atomIndex, null, null, false);
}, "~N");
Clazz_defineMethod(c$, "userActionEnabled", 
function(action){
return this.vwr.isFunction(JV.ActionManager.getActionName(action).toLowerCase());
}, "~N");
Clazz_defineMethod(c$, "userAction", 
function(action, params){
if (!this.userActionEnabled(action)) return false;
var result = JS.ScriptEval.runUserAction(JV.ActionManager.getActionName(action), params, this.vwr);
return !JS.SV.vF.equals(result);
}, "~N,~A");
c$.actionInfo =  new Array(47);
c$.actionNames =  new Array(47);
{
JV.ActionManager.pickingModeNames = "off identify label center draw spin symmetry deleteatom deletebond atom group chain molecule polymer structure site model element measure distance angle torsion sequence navigate connect struts dragselected dragmolecule dragatom dragminimize dragminimizemolecule invertstereo assignatom assignbond rotatebond identifybond dragligand dragmodel symop vxyz dragspin".$plit(" ");
}{
JV.ActionManager.pickingStyleNames = "toggle selectOrToggle extendedSelect drag measure measureoff".$plit(" ");
}var c$ = Clazz_decorateAsClass(function(){
this.index = 0;
this.x = 0;
this.y = 0;
this.time = 0;
Clazz_instantialize(this, arguments);}, JV, "MotionPoint", null);
Clazz_defineMethod(c$, "set", 
function(index, x, y, time){
this.index = index;
this.x = x;
this.y = y;
this.time = time;
}, "~N,~N,~N,~N");
Clazz_overrideMethod(c$, "toString", 
function(){
return "[x = " + this.x + " y = " + this.y + " time = " + this.time + " ]";
});
var c$ = Clazz_decorateAsClass(function(){
this.action = 0;
this.nodes = null;
this.ptNext = 0;
this.time0 = 0;
this.vwr = null;
Clazz_instantialize(this, arguments);}, JV, "Gesture", null);
Clazz_makeConstructor(c$, 
function(nPoints, vwr){
this.vwr = vwr;
this.nodes =  new Array(nPoints);
for (var i = 0; i < nPoints; i++) this.nodes[i] =  new JV.MotionPoint();

}, "~N,JV.Viewer");
Clazz_defineMethod(c$, "setAction", 
function(action, time){
this.action = action;
this.ptNext = 0;
this.time0 = time;
for (var i = 0; i < this.nodes.length; i++) this.nodes[i].index = -1;

}, "~N,~N");
Clazz_defineMethod(c$, "add", 
function(action, x, y, time){
this.action = action;
this.getNode(this.ptNext).set(this.ptNext, x, y, time - this.time0);
this.ptNext++;
return this.ptNext;
}, "~N,~N,~N,~N");
Clazz_defineMethod(c$, "getTimeDifference", 
function(nPoints){
nPoints = this.getPointCount2(nPoints, 0);
if (nPoints < 2) return 0;
var mp1 = this.getNode(this.ptNext - 1);
var mp0 = this.getNode(this.ptNext - nPoints);
return mp1.time - mp0.time;
}, "~N");
Clazz_defineMethod(c$, "getSpeedPixelsPerMillisecond", 
function(nPoints, nPointsPrevious){
nPoints = this.getPointCount2(nPoints, nPointsPrevious);
if (nPoints < 2) return 0;
var mp1 = this.getNode(this.ptNext - 1 - nPointsPrevious);
var mp0 = this.getNode(this.ptNext - nPoints - nPointsPrevious);
var dx = ((mp1.x - mp0.x)) / this.vwr.getScreenWidth() * 360;
var dy = ((mp1.y - mp0.y)) / this.vwr.getScreenHeight() * 360;
return Math.sqrt(dx * dx + dy * dy) / (mp1.time - mp0.time);
}, "~N,~N");
Clazz_defineMethod(c$, "getDX", 
function(nPoints, nPointsPrevious){
nPoints = this.getPointCount2(nPoints, nPointsPrevious);
if (nPoints < 2) return 0;
var mp1 = this.getNode(this.ptNext - 1 - nPointsPrevious);
var mp0 = this.getNode(this.ptNext - nPoints - nPointsPrevious);
return mp1.x - mp0.x;
}, "~N,~N");
Clazz_defineMethod(c$, "getDY", 
function(nPoints, nPointsPrevious){
nPoints = this.getPointCount2(nPoints, nPointsPrevious);
if (nPoints < 2) return 0;
var mp1 = this.getNode(this.ptNext - 1 - nPointsPrevious);
var mp0 = this.getNode(this.ptNext - nPoints - nPointsPrevious);
return mp1.y - mp0.y;
}, "~N,~N");
Clazz_defineMethod(c$, "getPointCount", 
function(){
return this.ptNext;
});
Clazz_defineMethod(c$, "getPointCount2", 
function(nPoints, nPointsPrevious){
if (nPoints > this.nodes.length - nPointsPrevious) nPoints = this.nodes.length - nPointsPrevious;
var n = nPoints + 1;
for (; --n >= 0; ) if (this.getNode(this.ptNext - n - nPointsPrevious).index >= 0) break;

return n;
}, "~N,~N");
Clazz_defineMethod(c$, "getNode", 
function(i){
return this.nodes[(i + this.nodes.length + this.nodes.length) % this.nodes.length];
}, "~N");
Clazz_overrideMethod(c$, "toString", 
function(){
if (this.nodes.length == 0) return "" + this;
return JV.binding.Binding.getMouseActionName(this.action, false) + " nPoints = " + this.ptNext + " " + this.nodes[0];
});
});
;//5.0.1-v7 Mon Aug 24 10:01:38 CDT 2026
Clazz_declarePackage("JV");
Clazz_load(["JU.BS"], "JV.AnimationManager", ["J.api.Interface", "JU.BSUtil"], function(){
var c$ = Clazz_decorateAsClass(function(){
this.animationThread = null;
this.vwr = null;
this.animationOn = false;
this.animationFps = 0;
this.firstFrameDelayMs = 0;
this.lastFrameDelayMs = 0;
this.bsVisibleModels = null;
this.animationReplayMode = 1073742070;
this.bsDisplay = null;
this.animationFrames = null;
this.isMovie = false;
this.animationPaused = false;
this.cmi = 0;
this.caf = 0;
this.morphCount = 0;
this.animationDirection = 1;
this.currentDirection = 1;
this.firstFrameIndex = 0;
this.lastFrameIndex = 0;
this.frameStep = 0;
this.backgroundModelIndex = -1;
this.currentMorphModel = 0;
this.firstFrameDelay = 0;
this.lastFrameDelay = 1;
this.lastFramePainted = 0;
this.lastModelPainted = 0;
this.intAnimThread = 0;
this.cai = -1;
this.splitFrame = false;
this.splitFrameOffsetX = 0;
this.currentSplitFrame = -1;
if (!Clazz_isClassDefined("JV.AnimationManager.SplitFrame")) {
JV.AnimationManager.$AnimationManager$SplitFrame$ ();
}
this.splitFrames = null;
Clazz_instantialize(this, arguments);}, JV, "AnimationManager", null);
Clazz_prepareFields (c$, function(){
this.bsVisibleModels =  new JU.BS();
});
Clazz_makeConstructor(c$, 
function(vwr){
this.vwr = vwr;
}, "JV.Viewer");
Clazz_defineMethod(c$, "setAnimationOn", 
function(animationOn){
if (animationOn == this.animationOn) return;
if (!animationOn || this.vwr.headless) {
this.stopThread(false);
return;
}if (!this.vwr.tm.spinOn) this.vwr.refresh(3, "Anim:setAnimationOn");
this.setAnimationRange(-1, -1);
this.resumeAnimation();
}, "~B");
Clazz_defineMethod(c$, "stopThread", 
function(isPaused){
var stopped = false;
if (this.animationThread != null) {
this.animationThread.interrupt();
this.animationThread = null;
stopped = true;
}this.animationPaused = isPaused;
if (stopped && !this.vwr.tm.spinOn) this.vwr.refresh(3, "Viewer:setAnimationOff");
this.animation(false);
this.vwr.setStatusFrameChanged(false, false);
}, "~B");
Clazz_defineMethod(c$, "setAnimationNext", 
function(){
return this.setAnimationRelative(this.animationDirection);
});
Clazz_defineMethod(c$, "currentIsLast", 
function(){
return (this.isMovie ? this.lastFramePainted == this.caf : this.lastModelPainted == this.cmi);
});
Clazz_defineMethod(c$, "currentFrameIs", 
function(f){
var i = this.cmi;
return (this.morphCount == 0 ? i == f : Math.abs(this.currentMorphModel - f) < 0.001);
}, "~N");
Clazz_defineMethod(c$, "clear", 
function(){
this.setMovie(null);
this.initializePointers(0);
this.setAnimationOn(false);
this.setModel(0, true);
this.currentDirection = 1;
this.cai = -1;
this.setAnimationDirection(1);
this.setAnimationFps(10);
this.setAnimationReplayMode(1073742070, 0, 0);
this.initializePointers(0);
this.setSplitFrame(-1, -1);
});
Clazz_defineMethod(c$, "getModelSpecial", 
function(i){
switch (i) {
case -1:
if (this.animationFrames != null) return "1";
i = this.firstFrameIndex;
break;
case 0:
if (this.morphCount > 0) return "-" + (1 + this.currentMorphModel);
i = this.cmi;
break;
case 1:
if (this.animationFrames != null) return "" + this.animationFrames.length;
i = this.lastFrameIndex;
break;
}
return this.vwr.getModelNumberDotted(i);
}, "~N");
Clazz_defineMethod(c$, "setDisplay", 
function(bs){
this.bsDisplay = (bs == null || bs.isEmpty() ? null : JU.BSUtil.copy(bs));
}, "JU.BS");
Clazz_defineMethod(c$, "setMorphCount", 
function(n){
this.morphCount = (this.isMovie ? 0 : n);
}, "~N");
Clazz_defineMethod(c$, "morph", 
function(modelIndex){
var m = Clazz_floatToInt(modelIndex);
if (Math.abs(m - modelIndex) < 0.001) modelIndex = m;
 else if (Math.abs(m - modelIndex) > 0.999) modelIndex = m = m + 1;
var f = modelIndex - m;
m -= 1;
if (f == 0) {
this.currentMorphModel = m;
this.setModel(m, true);
return;
}var m1;
this.setModel(m, true);
m1 = m + 1;
this.currentMorphModel = m + f;
if (m1 == m || m1 < 0 || m < 0) return;
this.vwr.ms.morphTrajectories(m, m1, f);
}, "~N");
Clazz_defineMethod(c$, "setModel", 
function(modelIndex, clearBackgroundModel){
if (modelIndex < 0) this.stopThread(false);
var formerModelIndex = this.cmi;
var modelSet = this.vwr.ms;
var modelCount = (modelSet == null ? 0 : modelSet.mc);
if (modelCount == 1) this.cmi = modelIndex = 0;
 else if (modelIndex < 0 || modelIndex >= modelCount) modelIndex = -1;
var ids = null;
var isSameSource = false;
if (this.cmi != modelIndex) {
if (modelCount > 0) {
var ms = this.vwr.ms;
var toDataModel = ms.isJmolDataFrame(modelIndex);
var fromDataModel = ms.isJmolDataFrame(this.cmi);
if (this.cmi != -1) this.vwr.saveModelOrientation(this.cmi);
if (fromDataModel || toDataModel) {
ids = ms.getJmolFrameType(modelIndex) + " " + modelIndex + " <-- " + " " + this.cmi + " " + ms.getJmolFrameType(this.cmi);
isSameSource = (ms.getJmolDataSourceFrame(modelIndex) == ms.getJmolDataSourceFrame(this.cmi));
}}this.cmi = modelIndex;
if (ids != null) {
if (modelIndex >= 0) this.vwr.restoreModelOrientation(modelIndex);
if (isSameSource && (ids.indexOf("quaternion") >= 0 || ids.indexOf("spin") >= 0 || ids.indexOf("plot") < 0 && ids.indexOf("ramachandran") < 0 && ids.indexOf(" property ") < 0)) {
this.vwr.restoreModelRotationOnly(formerModelIndex);
}}}this.setViewer(clearBackgroundModel);
}, "~N,~B");
Clazz_defineMethod(c$, "setBackgroundModelIndex", 
function(modelIndex){
var modelSet = this.vwr.ms;
if (modelSet == null || modelIndex < 0 || modelIndex >= modelSet.mc) modelIndex = -1;
this.backgroundModelIndex = modelIndex;
if (modelIndex >= 0) this.vwr.ms.setTrajectory(modelIndex);
this.vwr.setTainted(true);
this.setFrameRangeVisible();
}, "~N");
Clazz_defineMethod(c$, "initializePointers", 
function(frameStep){
this.firstFrameIndex = 0;
this.lastFrameIndex = (frameStep == 0 ? 0 : this.getFrameCount()) - 1;
this.frameStep = frameStep;
this.vwr.setFrameVariables();
}, "~N");
Clazz_defineMethod(c$, "setAnimationDirection", 
function(animationDirection){
this.animationDirection = animationDirection;
}, "~N");
Clazz_defineMethod(c$, "setAnimationFps", 
function(fps){
if (fps < 1) fps = 1;
if (fps > 50) fps = 50;
this.animationFps = fps;
this.vwr.setFrameVariables();
}, "~N");
Clazz_defineMethod(c$, "setAnimationReplayMode", 
function(animationReplayMode, firstFrameDelay, lastFrameDelay){
this.firstFrameDelay = firstFrameDelay > 0 ? firstFrameDelay : 0;
this.firstFrameDelayMs = Clazz_floatToInt(this.firstFrameDelay * 1000);
this.lastFrameDelay = lastFrameDelay > 0 ? lastFrameDelay : 0;
this.lastFrameDelayMs = Clazz_floatToInt(this.lastFrameDelay * 1000);
this.animationReplayMode = animationReplayMode;
this.vwr.setFrameVariables();
}, "~N,~N,~N");
Clazz_defineMethod(c$, "setAnimationRange", 
function(framePointer, framePointer2){
var frameCount = this.getFrameCount();
if (framePointer < 0) framePointer = 0;
if (framePointer2 < 0) framePointer2 = frameCount;
if (framePointer >= frameCount) framePointer = frameCount - 1;
if (framePointer2 >= frameCount) framePointer2 = frameCount - 1;
this.firstFrameIndex = framePointer;
this.currentMorphModel = this.firstFrameIndex;
this.lastFrameIndex = framePointer2;
this.frameStep = (framePointer2 < framePointer ? -1 : 1);
this.rewindAnimation();
}, "~N,~N");
Clazz_defineMethod(c$, "pauseAnimation", 
function(){
this.stopThread(true);
});
Clazz_defineMethod(c$, "reverseAnimation", 
function(){
this.currentDirection = -this.currentDirection;
if (!this.animationOn) this.resumeAnimation();
});
Clazz_defineMethod(c$, "repaintDone", 
function(){
this.lastModelPainted = this.cmi;
this.lastFramePainted = this.caf;
});
Clazz_defineMethod(c$, "resumeAnimation", 
function(){
if (this.cmi < 0) this.setAnimationRange(this.firstFrameIndex, this.lastFrameIndex);
if (this.getFrameCount() <= 1) {
this.animation(false);
return;
}this.animation(true);
this.animationPaused = false;
if (this.animationThread == null) {
this.intAnimThread++;
this.animationThread = J.api.Interface.getOption("thread.AnimationThread", this.vwr, "script");
this.animationThread.setManager(this, this.vwr,  Clazz_newIntArray(-1, [this.firstFrameIndex, this.lastFrameIndex, this.intAnimThread]));
this.animationThread.start();
}});
Clazz_defineMethod(c$, "setAnimationLast", 
function(){
this.setFrame(this.animationDirection > 0 ? this.lastFrameIndex : this.firstFrameIndex);
});
Clazz_defineMethod(c$, "rewindAnimation", 
function(){
this.setFrame(this.animationDirection > 0 ? this.firstFrameIndex : this.lastFrameIndex);
this.currentDirection = 1;
this.vwr.setFrameVariables();
});
Clazz_defineMethod(c$, "setAnimationPrevious", 
function(){
return this.setAnimationRelative(-this.animationDirection);
});
Clazz_defineMethod(c$, "getAnimRunTimeSeconds", 
function(){
var frameCount = this.getFrameCount();
if (this.firstFrameIndex == this.lastFrameIndex || this.lastFrameIndex < 0 || this.firstFrameIndex < 0 || this.lastFrameIndex >= frameCount || this.firstFrameIndex >= frameCount) return 0;
var i0 = Math.min(this.firstFrameIndex, this.lastFrameIndex);
var i1 = Math.max(this.firstFrameIndex, this.lastFrameIndex);
var nsec = 1 * (i1 - i0) / this.animationFps + this.firstFrameDelay + this.lastFrameDelay;
for (var i = i0; i <= i1; i++) nsec += this.vwr.ms.getFrameDelayMs(this.modelIndexForFrame(i)) / 1000;

return nsec;
});
Clazz_defineMethod(c$, "setMovie", 
function(info){
this.isMovie = (info != null && info.get("scripts") == null);
if (this.isMovie) {
this.animationFrames = info.get("frames");
if (this.animationFrames == null || this.animationFrames.length == 0) {
this.isMovie = false;
} else {
this.caf = (info.get("currentFrame")).intValue();
if (this.caf < 0 || this.caf >= this.animationFrames.length) this.caf = 0;
}this.setFrame(this.caf);
}if (!this.isMovie) {
this.animationFrames = null;
}this.vwr.setBooleanProperty("_ismovie", this.isMovie);
this.bsDisplay = null;
this.currentMorphModel = this.morphCount = 0;
this.vwr.setFrameVariables();
}, "java.util.Map");
Clazz_defineMethod(c$, "modelIndexForFrame", 
function(i){
return (this.isMovie ? this.animationFrames[i] - 1 : i);
}, "~N");
Clazz_defineMethod(c$, "getFrameCount", 
function(){
return (this.isMovie ? this.animationFrames.length : this.vwr.ms.mc);
});
Clazz_defineMethod(c$, "setFrame", 
function(i){
try {
if (this.isMovie) {
var iModel = this.modelIndexForFrame(i);
this.caf = i;
i = iModel;
} else {
this.caf = i;
}this.setModel(i, true);
} catch (e) {
if (Clazz_exceptionOf(e, Exception)){
} else {
throw e;
}
}
}, "~N");
Clazz_defineMethod(c$, "getUnitCellAtomIndex", 
function(){
return this.cai;
});
Clazz_defineMethod(c$, "setUnitCellAtomIndex", 
function(iAtom){
this.cai = iAtom;
}, "~N");
Clazz_defineMethod(c$, "setViewer", 
function(clearBackgroundModel){
this.vwr.ms.setTrajectory(this.cmi);
this.vwr.tm.setFrameOffset(this.cmi);
if (this.cmi == -1 && clearBackgroundModel) this.setBackgroundModelIndex(-1);
this.vwr.setTainted(true);
var nDisplay = this.setFrameRangeVisible();
if (this.vwr.tm.splitFrameCurrentlyRendering != 1) this.vwr.setStatusFrameChanged(false, false);
if (!this.vwr.g.selectAllModels) this.setSelectAllSubset(nDisplay < 2);
}, "~B");
Clazz_defineMethod(c$, "setSelectAllSubset", 
function(justOne){
if (this.vwr.ms != null) this.vwr.slm.setSelectionSubset(justOne ? this.vwr.ms.getModelAtomBitSetIncludingDeleted(this.cmi, true) : this.vwr.ms.getModelAtomBitSetIncludingDeletedBs(this.bsVisibleModels));
}, "~B");
Clazz_defineMethod(c$, "setFrameRangeVisible", 
function(){
var nDisplayed = 0;
this.bsVisibleModels.clearAll();
if (this.backgroundModelIndex >= 0) {
this.bsVisibleModels.set(this.backgroundModelIndex);
nDisplayed = 1;
}if (this.cmi >= 0) {
this.bsVisibleModels.set(this.cmi);
return ++nDisplayed;
}if (this.frameStep == 0) return nDisplayed;
var frameDisplayed = 0;
nDisplayed = 0;
for (var iframe = this.firstFrameIndex; iframe != this.lastFrameIndex; iframe += this.frameStep) {
var i = this.modelIndexForFrame(iframe);
if (!this.vwr.ms.isJmolDataFrame(i)) {
this.bsVisibleModels.set(i);
nDisplayed++;
frameDisplayed = iframe;
}}
var i = this.modelIndexForFrame(this.lastFrameIndex);
if (this.firstFrameIndex == this.lastFrameIndex || !this.vwr.ms.isJmolDataFrame(i) || nDisplayed == 0) {
this.bsVisibleModels.set(i);
if (nDisplayed == 0) this.firstFrameIndex = this.lastFrameIndex;
nDisplayed = 0;
}if (nDisplayed == 1 && this.cmi < 0) this.setFrame(frameDisplayed);
return nDisplayed;
});
Clazz_defineMethod(c$, "animation", 
function(TF){
this.animationOn = TF;
this.vwr.setBooleanProperty("_animating", TF);
}, "~B");
Clazz_defineMethod(c$, "setAnimationRelative", 
function(direction){
var frameStep = this.getFrameStep(direction);
var thisFrame = (this.isMovie ? this.caf : this.cmi);
var frameNext = thisFrame + frameStep;
var morphStep = 0;
var nextMorphFrame = 0;
var isDone;
if (this.morphCount > 0) {
morphStep = 1 / (this.morphCount + 1);
nextMorphFrame = this.currentMorphModel + frameStep * morphStep;
isDone = this.isNotInRange(nextMorphFrame);
} else {
isDone = this.isNotInRange(frameNext);
}if (isDone) {
switch (this.animationReplayMode) {
case 1073742070:
return false;
case 528411:
nextMorphFrame = frameNext = (this.animationDirection == this.currentDirection ? this.firstFrameIndex : this.lastFrameIndex);
break;
case 1073742082:
this.currentDirection = -this.currentDirection;
frameNext -= 2 * frameStep;
nextMorphFrame -= 2 * frameStep * morphStep;
}
}if (this.morphCount < 1) {
if (frameNext < 0 || frameNext >= this.getFrameCount()) return false;
this.setFrame(frameNext);
return true;
}this.morph(nextMorphFrame + 1);
return true;
}, "~N");
Clazz_defineMethod(c$, "isNotInRange", 
function(frameNext){
var f = frameNext - 0.001;
return (f > this.firstFrameIndex && f > this.lastFrameIndex || (f = frameNext + 0.001) < this.firstFrameIndex && f < this.lastFrameIndex);
}, "~N");
Clazz_defineMethod(c$, "getFrameStep", 
function(direction){
return this.frameStep * direction * this.currentDirection;
}, "~N");
Clazz_defineMethod(c$, "setSplitFrameOffsetX", 
function(x){
this.splitFrames[1].offsetX = x;
}, "~N");
Clazz_defineMethod(c$, "setSplitFrame", 
function(modelIndex1, modelIndex2){
this.splitFrame = (modelIndex1 >= 0 && modelIndex2 >= 0);
this.splitFrames = (this.splitFrame ?  Clazz_newArray(-1, [Clazz_innerTypeInstance(JV.AnimationManager.SplitFrame, this, null, 0, modelIndex1), Clazz_innerTypeInstance(JV.AnimationManager.SplitFrame, this, null, 1, modelIndex2)]) : null);
}, "~N,~N");
Clazz_defineMethod(c$, "getSplitFrameModelIndex", 
function(i){
return (this.splitFrames == null ? -1 : this.splitFrames[i].modelIndex);
}, "~N");
Clazz_defineMethod(c$, "setSplitFrameMouse", 
function(x){
if (!this.splitFrame) {
this.currentSplitFrame = -1;
return x;
}var isRight = (x >= this.splitFrames[1].offsetX);
this.currentSplitFrame = (isRight ? 1 : 0);
return x - this.splitFrames[this.currentSplitFrame].offsetX;
}, "~N");
Clazz_defineMethod(c$, "getSplitFrameModel", 
function(){
return (this.currentSplitFrame < 0 ? this.cmi : this.splitFrames[this.currentSplitFrame].modelIndex);
});
Clazz_defineMethod(c$, "isSplitFrameSelectable", 
function(atomIndex){
var m = this.getSplitFrameModel();
return (m < 0 || m == this.vwr.ms.at[atomIndex].mi);
}, "~N");
Clazz_defineMethod(c$, "getSplitFrameAtoms", 
function(active){
if (this.currentSplitFrame < 0) return null;
var m = this.splitFrames[active ? this.currentSplitFrame : 1 - this.currentSplitFrame].modelIndex;
return this.vwr.getModelUndeletedAtomsBitSet(m);
}, "~B");
Clazz_defineMethod(c$, "getCurrentSplitModelIndex", 
function(){
return this.currentSplitFrame < 0 ? this.cmi : this.splitFrames[this.currentSplitFrame].modelIndex;
});
Clazz_defineMethod(c$, "getSplitFrameModels", 
function(){
if (!this.splitFrame) return null;
var bs =  new JU.BS();
bs.set(this.splitFrames[0].modelIndex);
bs.set(this.splitFrames[1].modelIndex);
this.bsVisibleModels.clearAll();
this.bsVisibleModels.or(bs);
return bs;
});
c$.$AnimationManager$SplitFrame$ = function(){
/*if4*/;(function(){
var c$ = Clazz_decorateAsClass(function(){
Clazz_prepareCallback(this, arguments);
this.index = 0;
this.modelIndex = 0;
this.offsetX = 0;
Clazz_instantialize(this, arguments);}, JV.AnimationManager, "SplitFrame", null);
Clazz_makeConstructor(c$, 
function(index, modelIndex){
this.index = index;
this.modelIndex = modelIndex;
}, "~N,~N");
/*eoif4*/})();
};
});
;//5.0.1-v7 Mon Aug 24 10:01:38 CDT 2026
Clazz_declarePackage("JV.binding");
Clazz_load(["java.util.Hashtable"], "JV.binding.Binding", ["java.util.Arrays", "JU.AU", "$.Lst", "$.PT", "$.SB", "J.api.Interface", "JU.Escape", "$.Logger"], function(){
var c$ = Clazz_decorateAsClass(function(){
this.name = null;
this.bindings = null;
Clazz_instantialize(this, arguments);}, JV.binding, "Binding", null);
Clazz_prepareFields (c$, function(){
this.bindings =  new java.util.Hashtable();
});
Clazz_makeConstructor(c$, 
function(){
});
c$.getMouseAction = Clazz_defineMethod(c$, "getMouseAction", 
function(clickCount, modifiers, mode){
if (clickCount > 2) clickCount = 2;
switch (clickCount) {
case 0:
break;
case 1:
clickCount = 256;
break;
default:
clickCount = 512;
}
switch (mode) {
case 4:
mode = 4096;
break;
case 1:
mode = 8192;
break;
case 5:
mode = 16384;
break;
case 2:
mode = 32768;
break;
case 3:
mode = 32;
}
return (modifiers & 63) | clickCount | mode;
}, "~N,~N,~N");
c$.getMouseActionStr = Clazz_defineMethod(c$, "getMouseActionStr", 
function(desc){
if (desc == null) return 0;
var mouseAction = 0;
desc = desc.toUpperCase();
if (desc.indexOf("MIDDLE") >= 0) mouseAction = 8;
 else if (desc.indexOf("RIGHT") >= 0) mouseAction = 4;
 else if (desc.indexOf("WHEEL") >= 0) mouseAction = 32;
 else mouseAction = 16;
if (desc.indexOf("DOWN") >= 0) mouseAction |= 4096;
 else if (desc.indexOf("DRAG") >= 0) mouseAction |= 8192;
 else if (desc.indexOf("UP") >= 0) mouseAction |= 16384;
 else if (mouseAction != 32) mouseAction |= 32768;
if (mouseAction != 32 && desc.indexOf("DOUBLE") >= 0) mouseAction |= 512;
 else if (mouseAction > 0) mouseAction |= 256;
if (mouseAction != (288) && desc.indexOf("ALT") >= 0) mouseAction |= 8;
if (desc.indexOf("CTRL") >= 0) mouseAction |= 2;
if (desc.indexOf("SHIFT") >= 0) mouseAction |= 1;
return mouseAction;
}, "~S");
c$.getButtonMods = Clazz_defineMethod(c$, "getButtonMods", 
function(mouseAction){
return mouseAction & 63;
}, "~N");
c$.getClickCount = Clazz_defineMethod(c$, "getClickCount", 
function(mouseAction){
return (mouseAction & 768) >> 8;
}, "~N");
c$.getMouseActionName = Clazz_defineMethod(c$, "getMouseActionName", 
function(mouseAction, addSortCode){
var sb =  new JU.SB();
if (mouseAction == 0) return "";
var isMiddle = (JV.binding.Binding.includes(mouseAction, 8) && !JV.binding.Binding.includes(mouseAction, 16) && !JV.binding.Binding.includes(mouseAction, 4));
var code = "      ".toCharArray();
if (JV.binding.Binding.includes(mouseAction, 2)) {
sb.append("CTRL+");
code[5] = 'C';
}if (!isMiddle && JV.binding.Binding.includes(mouseAction, 8)) {
sb.append("ALT+");
code[4] = 'A';
}if (JV.binding.Binding.includes(mouseAction, 1)) {
sb.append("SHIFT+");
code[3] = 'S';
}if (JV.binding.Binding.includes(mouseAction, 16)) {
code[2] = 'L';
sb.append("LEFT");
} else if (JV.binding.Binding.includes(mouseAction, 4)) {
code[2] = 'R';
sb.append("RIGHT");
} else if (isMiddle) {
code[2] = 'M';
sb.append("MIDDLE");
} else if (JV.binding.Binding.includes(mouseAction, 32)) {
code[2] = 'W';
sb.append("WHEEL");
}if (JV.binding.Binding.includes(mouseAction, 512)) {
sb.append("+double");
code[1] = '2';
}if (JV.binding.Binding.includes(mouseAction, 4096)) {
sb.append("+down");
code[0] = '1';
} else if (JV.binding.Binding.includes(mouseAction, 8192)) {
sb.append("+drag");
code[0] = '2';
} else if (JV.binding.Binding.includes(mouseAction, 16384)) {
sb.append("+up");
code[0] = '3';
} else if (JV.binding.Binding.includes(mouseAction, 32768)) {
sb.append("+click");
code[0] = '4';
}return (addSortCode ?  String.instantialize(code) + ":" + sb.toString() : sb.toString());
}, "~N,~B");
Clazz_defineMethod(c$, "getBindings", 
function(){
return this.bindings;
});
Clazz_defineMethod(c$, "bindAction", 
function(mouseAction, jmolAction){
this.addBinding(mouseAction + "\t" + jmolAction,  Clazz_newIntArray(-1, [mouseAction, jmolAction]));
}, "~N,~N");
Clazz_defineMethod(c$, "bindName", 
function(mouseAction, name){
this.addBinding(mouseAction + "\t", Boolean.TRUE);
this.addBinding(mouseAction + "\t" + name,  Clazz_newArray(-1, [JV.binding.Binding.getMouseActionName(mouseAction, false), name]));
}, "~N,~S");
Clazz_defineMethod(c$, "unbindAction", 
function(mouseAction, jmolAction){
if (mouseAction == 0) this.unbindJmolAction(jmolAction);
 else this.removeBinding(null, mouseAction + "\t" + jmolAction);
}, "~N,~N");
Clazz_defineMethod(c$, "unbindName", 
function(mouseAction, name){
if (name == null) this.unbindMouseAction(mouseAction);
 else this.removeBinding(null, mouseAction + "\t" + name);
}, "~N,~S");
Clazz_defineMethod(c$, "unbindJmolAction", 
function(jmolAction){
var e = this.bindings.keySet().iterator();
var skey = "\t" + jmolAction;
while (e.hasNext()) {
var key = e.next();
if (key.endsWith(skey)) this.removeBinding(e, key);
}
}, "~N");
Clazz_defineMethod(c$, "addBinding", 
function(key, value){
if (JU.Logger.debugging) JU.Logger.debug("adding binding " + key + "\t==\t" + JU.Escape.e(value));
this.bindings.put(key, value);
}, "~S,~O");
Clazz_defineMethod(c$, "removeBinding", 
function(e, key){
if (JU.Logger.debugging) JU.Logger.debug("removing binding " + key);
if (e == null) this.bindings.remove(key);
 else e.remove();
}, "java.util.Iterator,~S");
Clazz_defineMethod(c$, "unbindUserAction", 
function(script){
var e = this.bindings.keySet().iterator();
var skey = "\t" + script;
while (e.hasNext()) {
var key = e.next();
if (key.endsWith(skey)) this.removeBinding(e, key);
}
}, "~S");
Clazz_defineMethod(c$, "unbindMouseAction", 
function(mouseAction){
var e = this.bindings.keySet().iterator();
var skey = mouseAction + "\t";
while (e.hasNext()) {
var key = e.next();
if (key.startsWith(skey)) this.removeBinding(e, key);
}
}, "~N");
Clazz_defineMethod(c$, "isBound", 
function(mouseAction, jmolAction){
return this.bindings.containsKey(mouseAction + "\t" + jmolAction);
}, "~N,~N");
Clazz_defineMethod(c$, "isUserAction", 
function(mouseAction){
return this.bindings.containsKey(mouseAction + "\t");
}, "~N");
Clazz_defineMethod(c$, "getBindingInfo", 
function(actionInfo, actionNames, qualifiers){
var sb =  new JU.SB();
var qlow = (qualifiers == null || qualifiers.equalsIgnoreCase("all") ? null : qualifiers.toLowerCase());
var names =  new Array(actionInfo.length);
var user =  new JU.Lst();
for (var obj, $obj = this.bindings.values().iterator (); $obj.hasNext()&& ((obj = $obj.next ()) || true);) {
if (Clazz_instanceOf(obj, Boolean)) {
} else if (JU.AU.isAS(obj)) {
var action = (obj)[0];
var script = (obj)[1];
if (qlow == null || qlow.indexOf("user") >= 0 || action.indexOf(qlow) >= 0 || script.indexOf(qlow) >= 0) user.addLast(obj);
} else {
var info = obj;
var i = info[1];
if (names[i] == null) names[i] =  new JU.Lst();
var name = JV.binding.Binding.getMouseActionName(info[0], true);
if (qlow == null || (actionNames[i] + ";" + actionInfo[i] + ";" + name).toLowerCase().indexOf(qlow) >= 0) names[i].addLast(name);
}}
for (var i = 0; i < actionInfo.length; i++) {
var n;
if (names[i] == null || (n = names[i].size()) == 0) continue;
this.addInfo(sb, names[i].toArray( new Array(n)), actionNames[i], actionInfo[i]);
}
for (var i = 0; i < user.size(); i++) {
var info = user.get(i);
this.addInfo(sb,  Clazz_newArray(-1, ["USER:::" + info[0]]), "user-defined", info[1]);
}
return sb.toString();
}, "~A,~A,~S");
Clazz_defineMethod(c$, "addInfo", 
function(sb, list, name, info){
java.util.Arrays.sort(list);
JU.PT.leftJustify(sb, "                      ", name);
sb.append("\t");
var sep = "";
var len = sb.length();
for (var j = 0; j < list.length; j++) {
sb.append(sep).append(list[j].substring(7));
sep = ", ";
}
len = sb.length() - len;
if (len < 20) sb.append("                 ".substring(0, 20 - len));
sb.append("\t").append(info).appendC('\n');
}, "JU.SB,~A,~S,~S");
c$.includes = Clazz_defineMethod(c$, "includes", 
function(mouseAction, mod){
return ((mouseAction & mod) == mod);
}, "~N,~N");
c$.newBinding = Clazz_defineMethod(c$, "newBinding", 
function(vwr, name){
return J.api.Interface.getInterface("JV.binding." + name + "Binding", vwr, "script");
}, "JV.Viewer,~S");
});
;//5.0.1-v7 Mon Aug 24 10:01:38 CDT 2026
Clazz_declarePackage("JV.binding");
Clazz_load(["JV.binding.JmolBinding"], "JV.binding.DragBinding", null, function(){
var c$ = Clazz_declareType(JV.binding, "DragBinding", JV.binding.JmolBinding);
Clazz_makeConstructor(c$, 
function(){
Clazz_superConstructor (this, JV.binding.DragBinding, []);
this.set("drag");
});
Clazz_overrideMethod(c$, "setSelectBindings", 
function(){
this.bindAction(33040, 30);
this.bindAction(33041, 35);
this.bindAction(33048, 34);
this.bindAction(33049, 32);
this.bindAction(4368, 31);
this.bindAction(8464, 13);
this.bindAction(33040, 17);
});
});
;//5.0.1-v7 Mon Aug 17 10:07:10 MDT 2026
Clazz_declarePackage("JV.binding");
Clazz_load(["JV.binding.Binding"], "JV.binding.JmolBinding", null, function(){
var c$ = Clazz_declareType(JV.binding, "JmolBinding", JV.binding.Binding);
Clazz_makeConstructor(c$, 
function(){
Clazz_superConstructor (this, JV.binding.JmolBinding, []);
this.set("toggle");
});
Clazz_defineMethod(c$, "set", 
function(name){
this.name = name;
this.setGeneralBindings();
this.setSelectBindings();
}, "~S");
Clazz_defineMethod(c$, "setSelectBindings", 
function(){
this.bindAction(33296, 30);
this.bindAction(33040, 36);
});
Clazz_defineMethod(c$, "setGeneralBindings", 
function(){
this.bindAction(8474, 45);
this.bindAction(8454, 45);
this.bindAction(8721, 45);
this.bindAction(8712, 45);
this.bindAction(8464, 25);
this.bindAction(8720, 25);
this.bindAction(8472, 28);
this.bindAction(8453, 28);
this.bindAction(8465, 29);
this.bindAction(8456, 29);
this.bindAction(288, 46);
this.bindAction(8464, 40);
this.bindAction(8464, 16);
this.bindAction(4370, 23);
this.bindAction(4356, 23);
this.bindAction(33040, 2);
this.bindAction(8467, 38);
this.bindAction(8723, 6);
this.bindAction(8475, 39);
this.bindAction(290, 46);
this.bindAction(289, 46);
this.bindAction(291, 46);
this.bindAction(290, 38);
this.bindAction(289, 6);
this.bindAction(291, 39);
this.bindAction(8464, 44);
this.bindAction(8464, 41);
this.bindAction(8465, 42);
this.bindAction(8473, 13);
this.bindAction(8465, 14);
this.bindAction(8472, 27);
this.bindAction(8465, 26);
this.bindAction(8464, 10);
this.bindAction(8472, 9);
this.bindAction(8465, 8);
this.bindAction(33297, 24);
this.bindAction(33288, 24);
this.bindAction(33296, 43);
this.bindAction(8464, 7);
this.bindAction(8464, 11);
this.bindAction(8464, 12);
this.bindAction(33040, 17);
this.bindAction(33040, 22);
this.bindAction(33040, 19);
this.bindAction(33040, 20);
this.bindAction(33296, 37);
this.bindAction(33040, 18);
this.bindAction(33043, 21);
this.bindAction(33040, 4);
this.bindAction(33040, 5);
this.bindAction(33040, 3);
this.bindAction(33040, 0);
this.bindAction(33043, 1);
});
});
;//5.0.1-v7 Mon Aug 17 10:07:10 MDT 2026
Clazz_declarePackage("JV");
Clazz_load(null, "JV.ColorManager", ["JU.AU", "J.c.PAL", "JU.C", "$.ColorEncoder", "$.Elements", "$.Logger", "JV.JC"], function(){
var c$ = Clazz_decorateAsClass(function(){
this.ce = null;
this.vwr = null;
this.g3d = null;
this.argbsCpk = null;
this.altArgbsCpk = null;
this.colorData = null;
this.isDefaultColorRasmol = false;
this.colixRubberband = 22;
this.colixBackgroundContrast = 0;
Clazz_instantialize(this, arguments);}, JV, "ColorManager", null);
Clazz_makeConstructor(c$, 
function(vwr, gdata){
this.vwr = vwr;
this.ce =  new JU.ColorEncoder(null, vwr);
this.g3d = gdata;
this.argbsCpk = J.c.PAL.argbsCpk;
this.altArgbsCpk = JU.AU.arrayCopyRangeI(JV.JC.altArgbsCpk, 0, -1);
}, "JV.Viewer,JU.GData");
Clazz_defineMethod(c$, "setDefaultColors", 
function(isRasmol){
if (isRasmol) {
this.isDefaultColorRasmol = true;
this.argbsCpk = JU.AU.arrayCopyI(JU.ColorEncoder.getRasmolScale(), -1);
} else {
this.isDefaultColorRasmol = false;
this.argbsCpk = J.c.PAL.argbsCpk;
}this.altArgbsCpk = JU.AU.arrayCopyRangeI(JV.JC.altArgbsCpk, 0, -1);
this.ce.createColorScheme((isRasmol ? "Rasmol=" : "Jmol="), true, true);
for (var i = J.c.PAL.argbsCpk.length; --i >= 0; ) this.g3d.changeColixArgb(i, this.argbsCpk[i]);

for (var i = JV.JC.altArgbsCpk.length; --i >= 0; ) this.g3d.changeColixArgb(JU.Elements.elementNumberMax + i, this.altArgbsCpk[i]);

}, "~B");
Clazz_defineMethod(c$, "setRubberbandArgb", 
function(argb){
this.colixRubberband = (argb == 0 ? 0 : JU.C.getColix(argb));
}, "~N");
Clazz_defineMethod(c$, "setColixBackgroundContrast", 
function(argb){
this.colixBackgroundContrast = JU.C.getBgContrast(argb);
}, "~N");
Clazz_defineMethod(c$, "getColixBondPalette", 
function(bond, pid){
var argb = 0;
switch (pid) {
case 20:
return this.ce.getColorIndexFromPalette(bond.getEnergy(), -2.5, -0.5, 7, false);
}
return (argb == 0 ? 10 : JU.C.getColix(argb));
}, "JM.Bond,~N");
Clazz_defineMethod(c$, "getColixAtomPalette", 
function(atom, pid){
var argb = 0;
var index;
var id;
var modelSet = this.vwr.ms;
var modelIndex;
var lo;
var hi;
switch (pid) {
case 85:
return (this.colorData == null || atom.i >= this.colorData.length || Float.isNaN(this.colorData[atom.i]) ? 12 : this.ce.getColorIndex(this.colorData[atom.i]));
case 0:
case 1:
var a = this.argbsCpk;
var i = id = atom.getAtomicAndIsotopeNumber();
if (i >= JU.Elements.elementNumberMax) {
id = JU.Elements.altElementIndexFromNumber(i);
if (id > 0) {
i = id;
id += JU.Elements.elementNumberMax;
a = this.altArgbsCpk;
} else {
i = id = JU.Elements.getElementNumber(i);
}}return this.g3d.getChangeableColix(id, a[i]);
case 2:
index = JU.ColorEncoder.quantize4(atom.getPartialCharge(), -1, 1, JV.JC.PARTIAL_CHARGE_RANGE_SIZE);
return this.g3d.getChangeableColix(JV.JC.PARTIAL_CHARGE_COLIX_RED + index, JV.JC.argbsRwbScale[index]);
case 3:
index = atom.getFormalCharge() - -4;
return this.g3d.getChangeableColix(JV.JC.FORMAL_CHARGE_COLIX_RED + index, JV.JC.argbsFormalCharge[index]);
case 68:
case 5:
if (pid == 68) {
lo = this.vwr.ms.getBfactor100Lo();
hi = this.vwr.ms.getBfactor100Hi();
} else {
lo = 0;
hi = 10000;
}return this.ce.getColorIndexFromPalette(atom.getBfactor100(), lo, hi, 7, false);
case 87:
return this.ce.getColorIndexFromPalette(atom.group.getGroupParameter(1111490574), -1, 1, 7, false);
case 70:
hi = this.vwr.ms.getSurfaceDistanceMax();
return this.ce.getColorIndexFromPalette(atom.getSurfaceDistance100(), 0, hi, 7, false);
case 25:
id = atom.group.groupID;
if (id >= 42) id = 24 + "PGCATU".indexOf(Character.toUpperCase(atom.group.group1)) - 1;
return this.ce.getColorIndexFromPalette(id, 0, 0, 17, false);
case 9:
return this.ce.getColorIndexFromPalette(atom.group.groupID, 0, 0, 5, false);
case 10:
return this.ce.getColorIndexFromPalette(atom.group.groupID, 0, 0, 4, false);
case 76:
return this.ce.getColorIndexFromPalette(atom.group.selectedIndex, 0, atom.group.chain.selectedGroupCount - 1, 1, false);
case 88:
var m = this.vwr.ms.am[atom.mi];
return this.ce.getColorIndexFromPalette(atom.group.getBioPolymerIndexInModel(), 0, (m.isBioModel ? (m).getBioPolymerCount() : 0) - 1, 1, false);
case 77:
return this.ce.getColorIndexFromPalette(atom.group.getSelectedMonomerIndex(), 0, atom.group.getSelectedMonomerCount() - 1, 1, false);
case 78:
return this.ce.getColorIndexFromPalette(modelSet.getMoleculeIndex(atom.i, true), 0, modelSet.getMoleculeCountInModel(atom.mi) - 1, 0, false);
case 15:
modelIndex = atom.mi;
return this.ce.getColorIndexFromPalette(modelSet.getAltLocIndexInModel(modelIndex, atom.altloc), 0, modelSet.getAltLocCountInModel(modelIndex), 0, false);
case 16:
modelIndex = atom.mi;
return this.ce.getColorIndexFromPalette(modelSet.getInsertionCodeIndexInModel(modelIndex, atom.group.getInsertionCode()), 0, modelSet.getInsertionCountInModel(modelIndex), 0, false);
case 17:
id = atom.getAtomicAndIsotopeNumber();
argb = this.getJmolOrRasmolArgb(id, 1073741991);
break;
case 18:
id = atom.getAtomicAndIsotopeNumber();
argb = this.getJmolOrRasmolArgb(id, 1073742116);
break;
case 7:
argb = atom.group.getBioStructureSubType(1111490651).getColor();
break;
case 11:
var chain = atom.getChainID();
if (JU.ColorEncoder.argbsChainAtom == null) {
JU.ColorEncoder.argbsChainAtom = this.getArgbs(1153433601);
JU.ColorEncoder.argbsChainHetero = this.getArgbs(1612709894);
}chain = ((chain < 0 ? 0 : chain >= 256 ? chain - 256 : chain) & 0x1F) % JU.ColorEncoder.argbsChainAtom.length;
argb = (atom.isHetero() ? JU.ColorEncoder.argbsChainHetero : JU.ColorEncoder.argbsChainAtom)[chain];
break;
}
return (argb == 0 ? 22 : JU.C.getColix(argb));
}, "JM.Atom,~N");
Clazz_defineMethod(c$, "getArgbs", 
function(tok){
return this.vwr.getJBR().getArgbs(tok);
}, "~N");
Clazz_defineMethod(c$, "getJmolOrRasmolArgb", 
function(id, argb){
switch (argb) {
case 1073741991:
if (id >= JU.Elements.elementNumberMax) break;
return this.ce.getArgbFromPalette(id, 0, 0, 2);
case 1073742116:
if (id >= JU.Elements.elementNumberMax) break;
return this.ce.getArgbFromPalette(id, 0, 0, 3);
default:
return argb;
}
return JV.JC.altArgbsCpk[JU.Elements.altElementIndexFromNumber(id)];
}, "~N,~N");
Clazz_defineMethod(c$, "getElementColix", 
function(elemNo){
var a = this.argbsCpk;
var i = elemNo;
if (i > JU.Elements.elementNumberMax) {
var ialt = JU.Elements.altElementIndexFromNumber(i);
if (ialt > 0) {
i = ialt;
a = this.altArgbsCpk;
} else {
i = JU.Elements.getElementNumber(i);
}}return JU.C.getColix(a[i]);
}, "~N");
Clazz_defineMethod(c$, "setElementArgb", 
function(elemNo, argb){
if (argb == 1073741991 && this.argbsCpk === J.c.PAL.argbsCpk) return;
argb = this.getJmolOrRasmolArgb(elemNo, argb);
if (this.argbsCpk === J.c.PAL.argbsCpk) {
this.argbsCpk = JU.AU.arrayCopyRangeI(J.c.PAL.argbsCpk, 0, -1);
this.altArgbsCpk = JU.AU.arrayCopyRangeI(JV.JC.altArgbsCpk, 0, -1);
}var id = elemNo;
if (id < JU.Elements.elementNumberMax) {
this.argbsCpk[id] = argb;
} else {
id = JU.Elements.altElementIndexFromNumber(elemNo);
this.altArgbsCpk[id] = argb;
id += JU.Elements.elementNumberMax;
}this.g3d.changeColixArgb(id, argb);
this.vwr.setModelkitPropertySafely("updatemodelkeys", null);
}, "~N,~N");
Clazz_defineMethod(c$, "getPropertyColorRange", 
function(){
return (this.ce.isReversed ?  Clazz_newFloatArray(-1, [this.ce.hi, this.ce.lo]) :  Clazz_newFloatArray(-1, [this.ce.lo, this.ce.hi]));
});
Clazz_defineMethod(c$, "setPropertyColorRangeData", 
function(data, bs){
this.colorData = data;
this.ce.currentPalette = this.ce.createColorScheme(this.vwr.g.propertyColorScheme, true, false);
this.ce.hi = -3.4028235E38;
this.ce.lo = 3.4028235E38;
if (data == null) return;
var isAll = (bs == null);
var d;
var i0 = (isAll ? data.length - 1 : bs.nextSetBit(0));
for (var i = i0; i >= 0; i = (isAll ? i - 1 : bs.nextSetBit(i + 1))) {
if (i >= data.length || Float.isNaN(d = data[i])) continue;
this.ce.hi = Math.max(this.ce.hi, d);
this.ce.lo = Math.min(this.ce.lo, d);
}
this.setPropertyColorRange(this.ce.lo, this.ce.hi);
}, "~A,JU.BS");
Clazz_defineMethod(c$, "setPropertyColorRange", 
function(min, max){
this.ce.setRange(min, max, min > max);
if (JU.Logger.debugging) JU.Logger.debug("ColorManager: color \"" + this.ce.getCurrentColorSchemeName() + "\" range " + min + " " + max);
}, "~N,~N");
Clazz_defineMethod(c$, "setPropertyColorScheme", 
function(colorScheme, isTranslucent, isOverloaded){
var isReset = (colorScheme.length == 0);
if (isReset) colorScheme = "=";
var range = this.getPropertyColorRange();
this.ce.currentPalette = this.ce.createColorScheme(colorScheme, true, isOverloaded);
if (!isReset) this.setPropertyColorRange(range[0], range[1]);
this.ce.isTranslucent = isTranslucent;
}, "~S,~B,~B");
Clazz_defineMethod(c$, "getColorSchemeList", 
function(colorScheme){
var iPt = (colorScheme == null || colorScheme.length == 0) ? this.ce.currentPalette : this.ce.createColorScheme(colorScheme, true, false);
return JU.ColorEncoder.getColorSchemeList(this.ce.getColorSchemeArray(iPt));
}, "~S");
Clazz_defineMethod(c$, "getColorEncoder", 
function(colorScheme){
if (colorScheme == null || colorScheme.length == 0) return this.ce;
var c =  new JU.ColorEncoder(this.ce, this.vwr);
c.currentPalette = c.createColorScheme(colorScheme, false, true);
return (c.currentPalette == 2147483647 ? null : c);
}, "~S");
});
;//5.0.1-v7 Mon Aug 24 10:01:38 CDT 2026
Clazz_declarePackage("JV");
Clazz_load(["javajs.api.BytePoster", "java.util.Hashtable"], "JV.FileManager", ["java.net.URL", "$.URLEncoder", "JU.AU", "$.Base64", "$.LimitedLineReader", "$.Lst", "$.OC", "$.PT", "$.Rdr", "$.SB", "J.adapter.smarter.Resolver", "J.api.Interface", "J.i18n.GT", "J.io.FileReader", "JU.Escape", "$.Logger", "JV.JC", "$.JmolAsyncException", "$.Viewer"], function(){
var c$ = Clazz_decorateAsClass(function(){
this.vwr = null;
this.spartanDoc = null;
this.jzu = null;
this.pathForAllFiles = "";
this.nameAsGiven = "zapped";
this.fullPathName = null;
this.lastFullPathName = null;
this.lastNameAsGiven = "zapped";
this.fileName = null;
this.lastFileType = null;
this.appletDocumentBaseURL = null;
this.appletProxy = null;
this.cache = null;
this.pngjCache = null;
this.spardirCache = null;
this.staticJmolDataReader = null;
Clazz_instantialize(this, arguments);}, JV, "FileManager", null, javajs.api.BytePoster);
Clazz_prepareFields (c$, function(){
this.cache =  new java.util.Hashtable();
});
Clazz_makeConstructor(c$, 
function(vwr){
this.vwr = vwr;
this.clear();
}, "JV.Viewer");
Clazz_defineMethod(c$, "spartanUtil", 
function(){
return (this.spartanDoc == null ? this.spartanDoc = (J.api.Interface.getInterface("J.adapter.readers.spartan.SpartanUtil", this.vwr, "fm getSpartanUtil()")).set(this) : this.spartanDoc);
});
Clazz_defineMethod(c$, "getJzu", 
function(){
return (this.jzu == null ? this.jzu = J.api.Interface.getOption("io.JmolUtil", this.vwr, "file") : this.jzu);
});
Clazz_defineMethod(c$, "clear", 
function(){
this.setFileInfo( Clazz_newArray(-1, [this.vwr.getZapName()]));
this.spardirCache = null;
});
Clazz_defineMethod(c$, "setLoadState", 
function(htParams){
if (this.vwr.getPreserveState()) {
htParams.put("loadState", this.vwr.g.getLoadState(htParams));
}}, "java.util.Map");
Clazz_defineMethod(c$, "getPathForAllFiles", 
function(){
return this.pathForAllFiles;
});
Clazz_defineMethod(c$, "setPathForAllFiles", 
function(value){
if (value.length > 0 && !value.endsWith("/") && !value.endsWith("|")) value += "/";
return this.pathForAllFiles = value;
}, "~S");
Clazz_defineMethod(c$, "setFileInfo", 
function(fileInfo){
if (fileInfo == null) {
this.fullPathName = this.lastFullPathName;
this.nameAsGiven = this.lastNameAsGiven;
return;
}this.fullPathName = fileInfo[0];
this.fileName = fileInfo[Math.min(1, fileInfo.length - 1)];
this.nameAsGiven = fileInfo[Math.min(2, fileInfo.length - 1)];
if (!this.nameAsGiven.equals("zapped")) {
this.lastNameAsGiven = this.nameAsGiven;
this.lastFullPathName = this.fullPathName;
}}, "~A");
Clazz_defineMethod(c$, "getFileInfo", 
function(){
return  Clazz_newArray(-1, [this.fullPathName, this.fileName, this.nameAsGiven]);
});
Clazz_defineMethod(c$, "getFullPathName", 
function(orPrevious){
var f = (this.fullPathName != null ? this.fullPathName : this.nameAsGiven);
return (!orPrevious || !f.equals("zapped") && !f.equals("string") ? f : this.lastFullPathName != null ? this.lastFullPathName : this.lastNameAsGiven);
}, "~B");
Clazz_defineMethod(c$, "getLastReadFileType", 
function(){
return this.lastFileType;
});
Clazz_defineMethod(c$, "setFileType", 
function(fileType){
if (!"JmolData".equals(fileType)) this.lastFileType = fileType;
}, "~S");
Clazz_defineMethod(c$, "getFileName", 
function(){
return this.fileName != null ? this.fileName : this.nameAsGiven;
});
Clazz_defineMethod(c$, "getAppletDocumentBase", 
function(){
return (this.appletDocumentBaseURL == null ? "" : this.appletDocumentBaseURL.toString());
});
Clazz_defineMethod(c$, "setAppletContext", 
function(documentBase){
try {
System.out.println("setting document base to \"" + documentBase + "\"");
this.appletDocumentBaseURL = (documentBase.length == 0 ? null :  new java.net.URL(Clazz_castNullAs("java.net.URL"), documentBase, null));
} catch (e) {
if (Clazz_exceptionOf(e,"java.net.MalformedURLException")){
System.out.println("error setting document base to " + documentBase);
} else {
throw e;
}
}
}, "~S");
Clazz_defineMethod(c$, "setAppletProxy", 
function(appletProxy){
this.appletProxy = (appletProxy == null || appletProxy.length == 0 ? null : appletProxy);
}, "~S");
Clazz_defineMethod(c$, "createAtomSetCollectionFromFile", 
function(name, htParams, isAppend){
if (htParams.get("atomDataOnly") == null) this.setLoadState(htParams);
var name0 = name;
var pt = name.indexOf("::");
if (pt < 0) name = this.vwr.resolveDatabaseFormat(name);
if (!name0.equals(name) && name0.indexOf("/") < 0 && JV.Viewer.hasDatabasePrefix(name0)) {
htParams.put("dbName", name0);
}if (name.endsWith("%2D%")) {
var filter = htParams.get("filter");
htParams.put("filter", (filter == null ? "" : filter) + "2D");
name = name.substring(0, name.length - 4);
}var nameAsGiven = (pt >= 0 ? name.substring(pt + 2) : name);
var fileType = (pt >= 0 ? name.substring(0, pt) : null);
JU.Logger.info("\nFileManager.getAtomSetCollectionFromFile(" + nameAsGiven + ")" + (name.equals(nameAsGiven) ? "" : " //" + name));
var names = this.getClassifiedName(nameAsGiven, true);
if (names.length == 1) return names[0];
var fullPathName = names[0];
var fileName = names[1];
this.setFileType(fileType);
htParams.put("fullPathName", (fileType == null ? "" : fileType + "::") + JV.FileManager.fixDOSName(fullPathName));
if (this.vwr.getBoolean(603979879) && this.vwr.getBoolean(603979825)) this.vwr.getChimeMessenger().update(fullPathName);
var fileReader =  new J.io.FileReader(this.vwr, fileName, fullPathName, nameAsGiven, fileType, null, htParams, isAppend);
fileReader.run();
return fileReader.getAtomSetCollection();
}, "~S,java.util.Map,~B");
Clazz_defineMethod(c$, "createAtomSetCollectionFromFiles", 
function(fileNames, htParams, isAppend){
this.setLoadState(htParams);
var fullPathNames =  new Array(fileNames.length);
var namesAsGiven =  new Array(fileNames.length);
var fileTypes =  new Array(fileNames.length);
for (var i = 0; i < fileNames.length; i++) {
var pt = fileNames[i].indexOf("::");
var nameAsGiven = (pt >= 0 ? fileNames[i].substring(pt + 2) : fileNames[i]);
var fileType = (pt >= 0 ? fileNames[i].substring(0, pt) : null);
var names = this.getClassifiedName(nameAsGiven, true);
if (names.length == 1) return names[0];
fullPathNames[i] = names[0];
fileNames[i] = JV.FileManager.fixDOSName(names[0]);
fileTypes[i] = fileType;
namesAsGiven[i] = nameAsGiven;
}
htParams.put("fullPathNames", fullPathNames);
htParams.put("fileTypes", fileTypes);
var filesReader = this.newFilesReader(fullPathNames, namesAsGiven, fileTypes, null, htParams, isAppend);
filesReader.run();
return filesReader.getAtomSetCollection();
}, "~A,java.util.Map,~B");
Clazz_defineMethod(c$, "createAtomSetCollectionFromString", 
function(strModel, htParams, isAppend){
this.setLoadState(htParams);
var isAddH = (strModel.indexOf("Viewer.AddHydrogens") >= 0);
var fnames = (isAddH ? this.getFileInfo() : null);
var fileReader =  new J.io.FileReader(this.vwr, "string", null, null, null, (strModel.startsWith(";base64,") ? JU.Base64.decodeBase64(strModel) : JU.Rdr.getBR(strModel)), htParams, isAppend);
fileReader.run();
if (fnames != null) this.setFileInfo(fnames);
if (!isAppend && !((typeof(fileReader.getAtomSetCollection())=='string'))) {
this.setFileInfo( Clazz_newArray(-1, [strModel === "5\n\nC 0 0 0\nH .63 .63 .63\nH -.63 -.63 .63\nH -.63 .63 -.63\nH .63 -.63 -.63" ? "Jmol Model Kit" : "string"]));
}return fileReader.getAtomSetCollection();
}, "~S,java.util.Map,~B");
Clazz_defineMethod(c$, "createAtomSeCollectionFromStrings", 
function(arrayModels, loadScript, htParams, isAppend){
if (!htParams.containsKey("isData")) {
var oldSep = "\"" + this.vwr.getDataSeparator() + "\"";
var tag = "\"" + (isAppend ? "append" : "model") + " inline\"";
var sb =  new JU.SB();
sb.append("set dataSeparator \"~~~next file~~~\";\ndata ").append(tag);
for (var i = 0; i < arrayModels.length; i++) {
if (i > 0) sb.append("~~~next file~~~");
sb.append(arrayModels[i]);
}
sb.append("end ").append(tag).append(";set dataSeparator ").append(oldSep);
loadScript.appendSB(sb);
}this.setLoadState(htParams);
JU.Logger.info("FileManager.getAtomSetCollectionFromStrings(string[])");
var fullPathNames =  new Array(arrayModels.length);
var readers =  new Array(arrayModels.length);
for (var i = 0; i < arrayModels.length; i++) {
fullPathNames[i] = "string[" + i + "]";
readers[i] = JV.FileManager.newDataReader(this.vwr, arrayModels[i]);
}
var filesReader = this.newFilesReader(fullPathNames, fullPathNames, null, readers, htParams, isAppend);
filesReader.run();
return filesReader.getAtomSetCollection();
}, "~A,JU.SB,java.util.Map,~B");
Clazz_defineMethod(c$, "createAtomSeCollectionFromArrayData", 
function(arrayData, htParams, isAppend){
JU.Logger.info("FileManager.getAtomSetCollectionFromArrayData(Vector)");
var nModels = arrayData.size();
var fullPathNames =  new Array(nModels);
var readers =  new Array(nModels);
for (var i = 0; i < nModels; i++) {
fullPathNames[i] = "String[" + i + "]";
readers[i] = JV.FileManager.newDataReader(this.vwr, arrayData.get(i));
}
var filesReader = this.newFilesReader(fullPathNames, fullPathNames, null, readers, htParams, isAppend);
filesReader.run();
return filesReader.getAtomSetCollection();
}, "JU.Lst,java.util.Map,~B");
c$.newDataReader = Clazz_defineMethod(c$, "newDataReader", 
function(vwr, data){
var reader = ((typeof(data)=='string') ? "String" : JU.AU.isAS(data) ? "Array" : Clazz_instanceOf(data,"JU.Lst") ? "List" : null);
if (reader == null) return null;
var dr = J.api.Interface.getInterface("JU." + reader + "DataReader", vwr, "file");
return dr.setData(data);
}, "JV.Viewer,~O");
Clazz_defineMethod(c$, "newFilesReader", 
function(fullPathNames, namesAsGiven, fileTypes, readers, htParams, isAppend){
var fr = J.api.Interface.getOption("io.FilesReader", this.vwr, "file");
fr.set(this, this.vwr, fullPathNames, namesAsGiven, fileTypes, readers, htParams, isAppend);
return fr;
}, "~A,~A,~A,~A,java.util.Map,~B");
Clazz_defineMethod(c$, "createAtomSetCollectionFromReader", 
function(fullPathName, name, reader, htParams){
var fileReader =  new J.io.FileReader(this.vwr, name, fullPathName, null, null, reader, htParams, false);
fileReader.run();
return fileReader.getAtomSetCollection();
}, "~S,~S,~O,java.util.Map");
Clazz_defineMethod(c$, "getBufferedInputStream", 
function(fullPathName){
var ret = this.getBufferedReaderOrErrorMessageFromName(fullPathName,  new Array(2), true, true);
return (Clazz_instanceOf(ret,"java.io.BufferedInputStream") ? ret : null);
}, "~S");
Clazz_defineMethod(c$, "getBufferedInputStreamOrErrorMessageFromName", 
function(name, fullName, showMsg, checkOnly, outputBytes, allowReader, allowCached){
var bis = null;
var ret = null;
var errorMessage = null;
allowCached = allowCached || name.startsWith("cache://");
var cacheBytes = (allowCached && outputBytes == null ? cacheBytes = this.getPngjOrDroppedBytes(fullName, name) : null);
try {
if (allowCached && name.indexOf(".png") >= 0 && this.pngjCache == null && !this.vwr.getBoolean(603979960)) this.pngjCache =  new java.util.Hashtable();
if (cacheBytes == null) {
var isPngjBinaryPost = (name.indexOf("?POST?_PNGJBIN_") >= 0);
var isPngjPost = (isPngjBinaryPost || name.indexOf("?POST?_PNGJ_") >= 0);
if (name.indexOf("?POST?_PNG_") > 0 || isPngjPost) {
var errMsg =  new Array(1);
var bytes = this.vwr.getImageAsBytes(isPngjPost ? "PNGJ" : "PNG", 0, 0, -1, errMsg);
if (errMsg[0] != null) return errMsg[0];
if (isPngjBinaryPost) {
outputBytes = bytes;
name = JU.PT.rep(name, "?_", "=_");
} else {
name =  new JU.SB().append(name).append("=").appendSB(JU.Base64.getBase64(bytes)).toString();
}}var iurl = JU.OC.urlTypeIndex(name);
var isURL = (iurl >= 0);
var post = null;
if (isURL && (iurl = name.indexOf("?POST?")) >= 0) {
post = name.substring(iurl + 6);
name = name.substring(0, iurl);
}var isApplet = (this.appletDocumentBaseURL != null);
if (isApplet || isURL) {
if (isApplet && isURL && this.appletProxy != null) name = this.appletProxy + "?url=" + this.urlEncode(name);
var url = (isApplet ?  new java.net.URL(this.appletDocumentBaseURL, name, null) :  new java.net.URL(Clazz_castNullAs("java.net.URL"), name, null));
if (checkOnly) return null;
name = url.toString();
if (showMsg && name.toLowerCase().indexOf("password") < 0) JU.Logger.info("FileManager opening url " + name);
ret = this.vwr.apiPlatform.getURLContents(url, outputBytes, post, false);
var bytes = null;
if (Clazz_instanceOf(ret,"JU.SB")) {
var sb = ret;
if (allowReader && !JU.Rdr.isBase64(sb)) return JU.Rdr.getBR(sb.toString());
bytes = JU.Rdr.getBytesFromSB(sb);
} else if (JU.AU.isAB(ret)) {
bytes = ret;
}if (bytes != null) ret = JU.Rdr.getBIS(bytes);
} else if (!allowCached || (cacheBytes = this.cacheGet(name, true)) == null) {
if (showMsg) JU.Logger.info("FileManager opening file " + name);
ret = this.vwr.apiPlatform.getBufferedFileInputStream(name);
}if ((typeof(ret)=='string')) return ret;
}bis = (cacheBytes == null ? ret : JU.Rdr.getBIS(cacheBytes));
if (checkOnly) {
bis.close();
bis = null;
}return bis;
} catch (e) {
if (Clazz_exceptionOf(e, Exception)){
try {
if (bis != null) bis.close();
} catch (e1) {
if (Clazz_exceptionOf(e1,"java.io.IOException")){
} else {
throw e1;
}
}
errorMessage = "" + e;
} else {
throw e;
}
}
return errorMessage;
}, "~S,~S,~B,~B,~A,~B,~B");
c$.getBufferedReaderForResource = Clazz_defineMethod(c$, "getBufferedReaderForResource", 
function(vwr, resourceClass, classPath, resourceName){
var url;
{
}resourceName = (url == null ? vwr.vwrOptions.get("codePath") + classPath + resourceName : url.getFile());
if (vwr.async) {
var bytes = vwr.fm.cacheGet(resourceName, false);
if (bytes == null) throw  new JV.JmolAsyncException(resourceName);
return JU.Rdr.getBufferedReader(JU.Rdr.getBIS(bytes), null);
}return vwr.fm.getBufferedReaderOrErrorMessageFromName(resourceName,  Clazz_newArray(-1, [null, null]), false, true);
}, "JV.Viewer,Class,~S,~S");
Clazz_defineMethod(c$, "urlEncode", 
function(name){
try {
return java.net.URLEncoder.encode(name, "utf-8");
} catch (e) {
if (Clazz_exceptionOf(e,"java.io.UnsupportedEncodingException")){
return name;
} else {
throw e;
}
}
}, "~S");
Clazz_defineMethod(c$, "getFullPathNameOrError", 
function(filename, getStream, ret){
var names = this.getClassifiedName(JV.JC.fixProtocol(filename), true);
if (names == null || names[0] == null || names.length < 2) return  Clazz_newArray(-1, [null, "cannot read file name: " + filename]);
var name = names[0];
var fullPath = JV.FileManager.fixDOSName(names[0]);
name = JU.Rdr.getZipRoot(name);
if (name.endsWith("#_DOCACHE_")) name = name.substring(0, name.length - "#_DOCACHE_".length);
var errMsg = this.getBufferedInputStreamOrErrorMessageFromName(name, fullPath, false, !getStream, null, false, !getStream);
ret[0] = fullPath;
if ((typeof(errMsg)=='string')) ret[1] = errMsg;
return errMsg;
}, "~S,~B,~A");
Clazz_defineMethod(c$, "getBufferedReaderOrErrorMessageFromName", 
function(name, fullPathNameReturn, isBinary, doSpecialLoad){
name = JV.JC.fixProtocol(name);
var data = this.cacheGet(name, false);
var isBytes = JU.AU.isAB(data);
var bytes = (isBytes ? data : null);
if (name.startsWith("cache://")) {
if (data == null) return "cannot read " + name;
if (isBytes) {
bytes = data;
} else {
return JU.Rdr.getBR(data);
}}var names = this.getClassifiedName(name, true);
if (names == null) return "cannot read file name: " + name;
if (fullPathNameReturn != null) fullPathNameReturn[0] = JV.FileManager.fixDOSName(names[0]);
return this.getUnzippedReaderOrStreamFromName(names[0], bytes, false, isBinary, false, doSpecialLoad, null);
}, "~S,~A,~B,~B");
Clazz_defineMethod(c$, "getUnzippedReaderOrStreamFromName", 
function(name, bytesOrStream, allowZipStream, forceInputStream, isTypeCheckOnly, doSpecialLoad, htParams){
if (doSpecialLoad && bytesOrStream == null) {
var o = (name.endsWith(".spt") ?  Clazz_newArray(-1, [null, null, null]) : name.indexOf(".spardir") < 0 ? null : this.spartanUtil().getFileList(name, isTypeCheckOnly));
if (o != null) return o;
}name = JV.JC.fixProtocol(name);
if (bytesOrStream == null && (bytesOrStream = this.getCachedPngjBytes(name)) != null && htParams != null) htParams.put("sourcePNGJ", Boolean.TRUE);
name = name.$replace("#_DOCACHE_", "");
var fullName = name;
var subFileList = null;
if (name.indexOf("|") >= 0) {
subFileList = JU.PT.split(name.$replace('\\', '/'), "|");
if (bytesOrStream == null) JU.Logger.info("FileManager opening zip " + name);
name = subFileList[0];
}var t = (bytesOrStream == null ? this.getBufferedInputStreamOrErrorMessageFromName(name, fullName, true, false, null, !forceInputStream, true) : JU.AU.isAB(bytesOrStream) ? JU.Rdr.getBIS(bytesOrStream) : bytesOrStream);
try {
if ((typeof(t)=='string') || Clazz_instanceOf(t,"java.io.BufferedReader")) return t;
var bis = t;
if (JU.Rdr.isGzipS(bis)) bis = JU.Rdr.getUnzippedInputStream(this.vwr.getJzt(), bis);
 else if (JU.Rdr.isBZip2S(bis)) bis = JU.Rdr.getUnzippedInputStreamBZip2(this.vwr.getJzt(), bis);
if (forceInputStream && subFileList == null) return bis;
if (JU.Rdr.isCompoundDocumentS(bis)) {
var doc = J.api.Interface.getInterface("JU.CompoundDocument", this.vwr, "file");
doc.setDocStream(this.vwr.getJzt(), bis);
var s = doc.getAllDataFiles("Molecule", "Input").toString();
return (forceInputStream ? JU.Rdr.getBIS(s.getBytes()) : JU.Rdr.getBR(s));
}if (JU.Rdr.isMessagePackS(bis) || JU.Rdr.isPickleS(bis)) return bis;
bis = JU.Rdr.getPngZipStream(bis, true);
var o = null;
if (JU.Rdr.isZipS(bis)) {
if (allowZipStream) return this.vwr.getJzt().newZipInputStream(bis);
o = this.vwr.getJzt().getZipFileDirectory(bis, subFileList, 1, forceInputStream);
} else if (JU.Rdr.isTar(bis)) {
o = this.vwr.getJzt().getZipFileDirectory(bis, subFileList, 1, forceInputStream);
} else if (JU.Rdr.isBinary(bis, 32)) {
return bis;
}if (o != null) {
if (!(Clazz_instanceOf(o,"java.io.BufferedInputStream"))) return ((typeof(o)=='string') ? JU.Rdr.getBR(o) : o);
bis = JU.Rdr.getUnzippedInputStream(this.vwr.getJzt(), o);
}return (forceInputStream ? bis : JU.Rdr.getBufferedReader(bis, null));
} catch (ioe) {
if (Clazz_exceptionOf(ioe, Exception)){
return ioe.toString();
} else {
throw ioe;
}
}
}, "~S,~O,~B,~B,~B,~B,java.util.Map");
Clazz_defineMethod(c$, "getZipDirectory", 
function(fileName, addManifest, allowCached){
var t = this.getBufferedInputStreamOrErrorMessageFromName(fileName, fileName, false, false, null, false, allowCached);
return this.vwr.getJzt().getZipDirectoryAndClose(t, addManifest ? "JmolManifest" : null);
}, "~S,~B,~B");
Clazz_defineMethod(c$, "getFileAsBytes", 
function(name, out){
if (name == null) return null;
var fullName = name;
var subFileList = null;
if (name.indexOf("|") >= 0) {
subFileList = JU.PT.split(name, "|");
name = subFileList[0];
}var bytes = (subFileList != null ? null : this.getPngjOrDroppedBytes(fullName, name));
if (bytes == null) {
var t = this.getBufferedInputStreamOrErrorMessageFromName(name, fullName, false, false, null, false, true);
if ((typeof(t)=='string')) return "Error:" + t;
try {
var bis = t;
bytes = (out != null || subFileList == null || subFileList.length <= 1 || !JU.Rdr.isZipS(bis) && !JU.Rdr.isPngZipStream(bis) && !JU.Rdr.isTar(bis) ? JU.Rdr.getStreamAsBytes(bis, out) : this.vwr.getJzt().getZipFileContentsAsBytes(bis, subFileList, 1));
bis.close();
} catch (ioe) {
if (Clazz_exceptionOf(ioe, Exception)){
return ioe.toString();
} else {
throw ioe;
}
}
}if (out == null || !JU.AU.isAB(bytes)) return bytes;
out.write(bytes, 0, -1);
return (bytes).length + " bytes";
}, "~S,JU.OC");
Clazz_defineMethod(c$, "getFileAsMap", 
function(name, type, asBytes){
var bdata = (asBytes ? null :  new java.util.Hashtable());
var t;
if (name == null) {
var errMsg =  new Array(1);
var bytes = this.vwr.getImageAsBytes(type, -1, -1, -1, errMsg);
if (errMsg[0] != null) {
if (asBytes) return  Clazz_newByteArray (0, 0);
bdata.put("_ERROR_", errMsg[0]);
return bdata;
}if (asBytes) return bytes;
t = JU.Rdr.getBIS(bytes);
} else {
var data =  new Array(2);
t = this.getFullPathNameOrError(name, true, data);
if ((typeof(t)=='string')) {
if (asBytes) return  Clazz_newByteArray (0, 0);
bdata.put("_ERROR_", t);
return bdata;
}if (!this.checkSecurity(data[0])) {
if (asBytes) return  Clazz_newByteArray (0, 0);
bdata.put("_ERROR_", "java.io. Security exception: cannot read file " + data[0]);
return bdata;
}}try {
if (asBytes) {
return JU.Rdr.streamToBytes(t);
}this.vwr.getJzt().readFileAsMap(t, bdata, name);
} catch (e) {
if (Clazz_exceptionOf(e, Exception)){
if (asBytes) return  Clazz_newByteArray (0, 0);
bdata.clear();
bdata.put("_ERROR_", "" + e);
} else {
throw e;
}
}
return bdata;
}, "~S,~S,~B");
Clazz_defineMethod(c$, "getFileDataAsString", 
function(data, nBytesMax, doSpecialLoad, allowBinary, checkProtected){
data[1] = "";
var name = data[0];
if (name == null) return false;
var t = this.getBufferedReaderOrErrorMessageFromName(name, data, false, doSpecialLoad);
if ((typeof(t)=='string')) {
data[1] = t;
return false;
}if (checkProtected && !this.checkSecurity(data[0])) {
data[1] = "java.io. Security exception: cannot read file " + data[0];
return false;
}try {
if (Clazz_instanceOf(t,"java.io.BufferedInputStream")) {
if (name.toUpperCase().endsWith(".PNG") || JV.FileManager.isEmbeddable(name)) t = JU.Rdr.getBufferedReader(t, null);
}return JU.Rdr.readAllAsString(t, nBytesMax, allowBinary, data, 1);
} catch (e) {
if (Clazz_exceptionOf(e, Exception)){
return false;
} else {
throw e;
}
}
}, "~A,~N,~B,~B,~B");
Clazz_defineMethod(c$, "checkSecurity", 
function(f){
if (!f.startsWith("file:")) return true;
var pt = f.lastIndexOf('/');
if (f.lastIndexOf(":/") == pt - 1 || f.indexOf("/.") >= 0 || f.lastIndexOf('.') < f.lastIndexOf('/')) return false;
return true;
}, "~S");
Clazz_defineMethod(c$, "loadImage", 
function(nameOrBytes, echoName, forceSync){
var image = null;
var nameOrError = null;
var bytes = null;
var isPopupImage = (echoName != null && echoName.startsWith("\1"));
if (isPopupImage) {
if (echoName.equals("\1closeall\1null")) return this.vwr.loadImageData(Boolean.TRUE, "\1closeall", "\1closeall", null);
if ("\1close".equals(nameOrBytes)) return this.vwr.loadImageData(Boolean.FALSE, "\1close", echoName, null);
}if (Clazz_instanceOf(nameOrBytes,"java.util.Map")) {
nameOrBytes = ((nameOrBytes).containsKey("_DATA_") ? (nameOrBytes).get("_DATA_") : (nameOrBytes).get("_IMAGE_"));
}if (Clazz_instanceOf(nameOrBytes,"JS.SV")) nameOrBytes = (nameOrBytes).value;
var name = ((typeof(nameOrBytes)=='string') ? nameOrBytes : null);
var isAsynchronous = false;
if (name != null && name.startsWith(";base64,")) {
bytes = JU.Base64.decodeBase64(name);
} else if (Clazz_instanceOf(nameOrBytes,"JU.BArray")) {
bytes = (nameOrBytes).data;
} else if (JU.AU.isAB(nameOrBytes)) {
bytes = nameOrBytes;
} else if (echoName == null || (typeof(nameOrBytes)=='string')) {
var names = this.getClassifiedName(nameOrBytes, true);
nameOrError = (names == null ? "cannot read file name: " + nameOrBytes : JV.FileManager.fixDOSName(names[0]));
if (names != null) image = this.getImage(nameOrError, echoName, forceSync);
isAsynchronous = (image == null);
} else {
image = nameOrBytes;
}if (bytes != null) {
image = this.getImage(bytes, echoName, true);
isAsynchronous = false;
}if ((typeof(image)=='string')) {
nameOrError = image;
image = null;
}if (!JV.Viewer.isJS && image != null && bytes != null) nameOrError = ";base64," + JU.Base64.getBase64(bytes).toString();
if (!JV.Viewer.isJS || isPopupImage && nameOrError == null || !isPopupImage && image != null) return this.vwr.loadImageData(image, nameOrError, echoName, null);
return isAsynchronous;
}, "~O,~S,~B");
Clazz_defineMethod(c$, "getImage", 
function(nameOrBytes, echoName, forceSync){
return this.getJzu().getImage(this.vwr, nameOrBytes, echoName, forceSync);
}, "~O,~S,~B");
Clazz_defineMethod(c$, "getClassifiedName", 
function(name, isFullLoad){
if (name == null) return  Clazz_newArray(-1, [null]);
var doSetPathForAllFiles = (this.pathForAllFiles.length > 0);
if (name.startsWith("?") || name.startsWith("http://?") || name.startsWith("https://?")) {
if (!JV.Viewer.isJS && (name = this.vwr.dialogAsk("Load", name, null)) == null) return  Clazz_newArray(-1, [isFullLoad ? "#CANCELED#" : null]);
doSetPathForAllFiles = false;
}var file = null;
var url = null;
var names = null;
if (name.startsWith("cache://")) {
names =  new Array(3);
names[0] = names[2] = name;
names[1] = JV.FileManager.stripPath(names[0]);
return names;
}name = this.vwr.resolveDatabaseFormat(name);
if (name == null) return  Clazz_newArray(-1, [null]);
if (name.startsWith("file:///") && name.indexOf('|') == 9) name = name.substring(0, 9) + ':' + name.substring(10);
if (name.indexOf(":") < 0 && name.indexOf('/') != 0 && name.indexOf('\\') != 0) name = JV.FileManager.addDirectory(this.vwr.getDefaultDirectory(), name);
if (this.appletDocumentBaseURL == null) {
if (JU.OC.urlTypeIndex(name) >= 0 || this.vwr.haveAccess(JV.Viewer.ACCESS.NONE) || this.vwr.haveAccess(JV.Viewer.ACCESS.READSPT) && !name.endsWith(".spt") && !name.endsWith("/") || !this.vwr.haveAccessInternal(name)) {
try {
url =  new java.net.URL(Clazz_castNullAs("java.net.URL"), name, null);
} catch (e) {
if (Clazz_exceptionOf(e,"java.net.MalformedURLException")){
return  Clazz_newArray(-1, [isFullLoad ? e.toString() : null]);
} else {
throw e;
}
}
} else {
file = this.vwr.apiPlatform.newFile(name);
var s = file.getFullPath();
var fname = file.getName();
names =  Clazz_newArray(-1, [(s == null ? fname : s), fname, (s == null ? fname : "file:/" + s.$replace('\\', '/'))]);
}} else {
try {
if (name.indexOf(":\\") == 1 || name.indexOf(":/") == 1) name = "file:/" + name;
url =  new java.net.URL(this.appletDocumentBaseURL, name, null);
} catch (e) {
if (Clazz_exceptionOf(e,"java.net.MalformedURLException")){
return  Clazz_newArray(-1, [isFullLoad ? e.toString() : null]);
} else {
throw e;
}
}
}if (url != null) {
names =  new Array(3);
names[0] = names[2] = url.toString();
names[1] = JV.FileManager.stripPath(names[0]);
}if (doSetPathForAllFiles) {
var name0 = names[0];
names[0] = this.pathForAllFiles + names[1];
JU.Logger.info("FileManager substituting " + name0 + " --> " + names[0]);
}var path = names[0];
if (isFullLoad && JU.OC.isLocal(path) && !path.startsWith("file:/")) {
if (file == null) path = JU.PT.trim(path.substring(path.indexOf(":") + 1), "/");
var pt = path.length - names[1].length - 1;
if (pt > 0) {
path = path.substring(0, pt).$replace('|', ':');
JV.FileManager.setLocalPath(this.vwr, path, true);
}}return names;
}, "~S,~B");
c$.addDirectory = Clazz_defineMethod(c$, "addDirectory", 
function(defaultDirectory, name){
if (defaultDirectory.length == 0 || defaultDirectory.equals(".")) return name;
var ch = (name.length > 0 ? name.charAt(0) : ' ');
var s = defaultDirectory.toLowerCase();
if ((s.endsWith(".zip") || s.endsWith(".tar")) && ch != '|' && ch != '/') defaultDirectory += "|";
return defaultDirectory + (ch == '/' || ch == '/' || (ch = defaultDirectory.charAt(defaultDirectory.length - 1)) == '|' || ch == '/' ? "" : "/") + name;
}, "~S,~S");
Clazz_defineMethod(c$, "getDefaultDirectory", 
function(name){
var names = this.getClassifiedName(name, true);
if (names == null) return "";
name = JV.FileManager.fixPath(names[0]);
return (name == null ? "" : name.substring(0, name.lastIndexOf("/")));
}, "~S");
c$.fixPath = Clazz_defineMethod(c$, "fixPath", 
function(path){
path = JV.FileManager.fixDOSName(path);
path = JU.PT.rep(path, "/./", "/");
var pt = path.lastIndexOf("//") + 1;
if (pt < 1) pt = path.indexOf(":/") + 1;
if (pt < 1) pt = path.indexOf("/");
if (pt < 0) return null;
var protocol = path.substring(0, pt);
path = path.substring(pt);
while ((pt = path.lastIndexOf("/../")) >= 0) {
var pt0 = path.substring(0, pt).lastIndexOf("/");
if (pt0 < 0) return JU.PT.rep(protocol + path, "/../", "/");
path = path.substring(0, pt0) + path.substring(pt + 3);
}
if (path.length == 0) path = "/";
return protocol + path;
}, "~S");
Clazz_defineMethod(c$, "getFilePath", 
function(name, addUrlPrefix, asShortName){
var names = this.getClassifiedName(name, false);
return (names == null || names.length == 1 ? "" : asShortName ? names[1] : addUrlPrefix ? names[2] : names[0] == null ? "" : JV.FileManager.fixDOSName(names[0]));
}, "~S,~B,~B");
c$.getLocalDirectory = Clazz_defineMethod(c$, "getLocalDirectory", 
function(vwr, forDialog){
var localDir = vwr.getP(forDialog ? "currentLocalPath" : "defaultDirectoryLocal");
if (forDialog && localDir.length == 0) localDir = vwr.getP("defaultDirectoryLocal");
if (localDir.length == 0) return (JV.Viewer.isJS ? null : vwr.apiPlatform.newFile(System.getProperty("user.dir", ".")));
if (vwr.isApplet && localDir.indexOf("file:/") == 0) localDir = localDir.substring(6);
var f = vwr.apiPlatform.newFile(localDir);
try {
return f.isDirectory() ? f : f.getParentAsFile();
} catch (e) {
if (Clazz_exceptionOf(e, Exception)){
return null;
} else {
throw e;
}
}
}, "JV.Viewer,~B");
c$.setLocalPath = Clazz_defineMethod(c$, "setLocalPath", 
function(vwr, path, forDialog){
while (path.endsWith("/") || path.endsWith("\\")) path = path.substring(0, path.length - 1);

vwr.setStringProperty("currentLocalPath", path);
if (!forDialog) vwr.setStringProperty("defaultDirectoryLocal", path);
}, "JV.Viewer,~S,~B");
c$.getLocalPathForWritingFile = Clazz_defineMethod(c$, "getLocalPathForWritingFile", 
function(vwr, file, forDialog){
if (file.startsWith("http://") || file.startsWith("https://")) return file;
file = JU.PT.rep(file, "?", "");
if (file.indexOf("file:/") == 0) {
var pt = file.indexOf('|');
if (pt > 5 && pt < 10) file = file.substring(0, pt) + ':' + file.substring(pt + 1);
pt = file.indexOf(':', 5);
return file.substring(pt > 0 ? pt - 1 : 5);
}if (file.indexOf('/') == 0 || file.indexOf('\\') == 0 || file.indexOf(":") >= 0) return file;
var dir = null;
try {
dir = JV.FileManager.getLocalDirectory(vwr, forDialog);
} catch (e) {
if (Clazz_exceptionOf(e, Exception)){
} else {
throw e;
}
}
return (dir == null ? file : JV.FileManager.fixPath(dir.toString() + "/" + file));
}, "JV.Viewer,~S,~B");
c$.fixDOSName = Clazz_defineMethod(c$, "fixDOSName", 
function(fileName){
return (fileName.indexOf(":\\") >= 0 ? fileName.$replace('\\', '/') : fileName);
}, "~S");
c$.stripPath = Clazz_defineMethod(c$, "stripPath", 
function(name){
var pt = Math.max(name.lastIndexOf("|"), name.lastIndexOf("/"));
return name.substring(pt + 1);
}, "~S");
c$.isScriptType = Clazz_defineMethod(c$, "isScriptType", 
function(fname){
return JU.PT.isOneOf(fname.toLowerCase().substring(fname.lastIndexOf(".") + 1), ";pse;spt;png;pngj;jmol;zip;");
}, "~S");
c$.determineSurfaceFileType = Clazz_defineMethod(c$, "determineSurfaceFileType", 
function(bufferedReader){
var line = null;
if (Clazz_instanceOf(bufferedReader,"JU.Rdr.StreamReader")) {
var is = (bufferedReader).getStream();
if (is.markSupported()) {
try {
is.mark(300);
var buf =  Clazz_newByteArray (300, 0);
is.read(buf, 0, 300);
is.reset();
if ((buf[0] & 0xFF) == 0x83) {
return (J.adapter.smarter.Resolver.checkBCIF(buf, false) ? "BCifDensity" : null);
}if (buf[0] == 80 && buf[1] == 77 && buf[2] == 1 && buf[3] == 0) return "Pmesh";
if (buf[208] == 77 && buf[209] == 65 && buf[210] == 80) return "Mrc";
if (buf[0] == 20 && buf[1] == 0 && buf[2] == 0 && buf[3] == 0) return "DelPhi";
if (buf[36] == 0 && buf[37] == 100) return "Dsn6";
} catch (e) {
if (Clazz_exceptionOf(e,"java.io.IOException")){
} else {
throw e;
}
}
}}var br = null;
try {
br =  new JU.LimitedLineReader(bufferedReader, 16000);
line = br.getHeader(0);
} catch (e) {
if (Clazz_exceptionOf(e, Exception)){
} else {
throw e;
}
}
if (br == null || line == null || line.length == 0) return null;
var pt0 = line.indexOf('\0');
if (pt0 >= 0) {
if ((line.charAt(0)).charCodeAt(0) == 0x83) {
return (line.charAt(10) == 'D' && line.charAt(11) == 'e' && line.charAt(12) == 'n' ? "BCifDensity" : null);
}if (line.indexOf("PM\u0001\u0000") == 0) return "Pmesh";
if (line.indexOf("MAP ") == 208) return "Mrc";
if (line.indexOf("\u0014\u0000\u0000\u0000") == 0) return "DelPhi";
if (line.length > 37 && ((line.charAt(36)).charCodeAt(0) == 0 && (line.charAt(37)).charCodeAt(0) == 100 || (line.charAt(36)).charCodeAt(0) == 0 && (line.charAt(37)).charCodeAt(0) == 100)) {
return "Dsn6";
}}switch ((line.charAt(0)).charCodeAt(0)) {
case 64:
if (line.indexOf("@text") == 0) return "Kinemage";
break;
case 35:
if (line.indexOf(".obj") >= 0) return "Obj";
if (line.indexOf("MSMS") >= 0) return "Msms";
if (line.indexOf("Menu") >= 0) return "MENU";
break;
case 60:
if (line.startsWith("<?xml") && line.indexOf("<jvxl ") > 0) return "JvxlXml";
if (line.indexOf("<efvet ") >= 0) return "Efvet";
break;
case 38:
if (line.indexOf("&plot") == 0) return "Jaguar";
break;
case 13:
case 10:
if (line.indexOf("ZYX") >= 0) return "Xplor";
break;
}
if (line.indexOf("Here is your gzipped map") >= 0) return "UPPSALA" + line;
if (line.startsWith("data_SERVER")) return "CifDensity";
if (line.startsWith("4MESHC")) return "Pmesh4";
if (line.indexOf("! nspins") >= 0) return "CastepDensity";
if (line.indexOf("#JVXL+") >= 0) return "Jvxl+";
if (line.indexOf("#JVXL") >= 0) return "Jvxl";
if (line.indexOf("#JmolPmesh") >= 0) return "Pmesh";
if (line.indexOf("#obj") >= 0) return "Obj";
if (line.indexOf("#pmesh") >= 0) return "Obj";
if (line.indexOf("usemtl") >= 0) return "Obj";
if (line.indexOf("# object with") == 0) return "Nff";
if (line.indexOf("PRIMVEC") >= 0 || line.indexOf("BEGIN_DATAGRID_3D") >= 0 || line.indexOf("BEGIN_BANDGRID_3D") >= 0) return "Xsf";
if (line.indexOf("tiles in x, y") >= 0) return "Ras3D";
if (line.indexOf(" 0.00000e+00 0.00000e+00      0      0\n") >= 0) return "Uhbd";
line = br.readLineWithNewline();
if (line.indexOf("object 1 class gridpositions counts") == 0) return "Apbs";
var tokens = JU.PT.getTokens(line);
var line2 = br.readLineWithNewline();
if (tokens.length == 2 && JU.PT.parseInt(tokens[0]) == 3 && JU.PT.parseInt(tokens[1]) != -2147483648) {
tokens = JU.PT.getTokens(line2);
if (tokens.length == 3 && JU.PT.parseInt(tokens[0]) != -2147483648 && JU.PT.parseInt(tokens[1]) != -2147483648 && JU.PT.parseInt(tokens[2]) != -2147483648) return "PltFormatted";
}var line3 = br.readLineWithNewline();
if (line.startsWith("v ") && line2.startsWith("v ") && line3.startsWith("v ")) return "Obj";
var nAtoms = JU.PT.parseInt(line3);
if (nAtoms == -2147483648) return (line3.indexOf("+") == 0 ? "Jvxl+" : null);
tokens = JU.PT.getTokens(line3);
if (tokens[0].indexOf(".") > 0) return (line3.length >= 60 || tokens.length != 3 ? null : "VaspChgcar");
if (nAtoms >= 0) return (tokens.length == 4 || tokens.length == 5 && tokens[4].equals("1") ? "Cube" : null);
nAtoms = -nAtoms;
for (var i = 4 + nAtoms; --i >= 0; ) if ((line = br.readLineWithNewline()) == null) return null;

var nSurfaces = JU.PT.parseInt(line);
if (nSurfaces == -2147483648) return null;
return (nSurfaces < 0 ? "Jvxl" : "Cube");
}, "java.io.BufferedReader");
c$.getManifestScriptPath = Clazz_defineMethod(c$, "getManifestScriptPath", 
function(manifest){
if (manifest.indexOf("$SCRIPT_PATH$") >= 0) return "";
var ch = (manifest.indexOf('\n') >= 0 ? "\n" : "\r");
if (manifest.indexOf(".spt") >= 0) {
var s = JU.PT.split(manifest, ch);
for (var i = s.length; --i >= 0; ) if (s[i].indexOf(".spt") >= 0) return "|" + JU.PT.trim(s[i], "\r\n \t");

}return null;
}, "~S");
c$.getFileReferences = Clazz_defineMethod(c$, "getFileReferences", 
function(script, fileList, fileListUTF){
for (var ipt = 0; ipt < JV.FileManager.scriptFilePrefixes.length; ipt++) {
var tag = JV.FileManager.scriptFilePrefixes[ipt];
var i = -1;
while ((i = script.indexOf(tag, i + 1)) >= 0) {
var s = JU.PT.getQuotedStringAt(script, i);
if (s.indexOf("\\u") >= 0) s = JU.Escape.unescapeUnicode(s);
fileList.addLast(s);
if (fileListUTF != null) {
if (s.indexOf("\\u") >= 0) s = JU.Escape.unescapeUnicode(s);
fileListUTF.addLast(s);
}}
}
}, "~S,JU.Lst,JU.Lst");
c$.setScriptFileReferences = Clazz_defineMethod(c$, "setScriptFileReferences", 
function(script, localPath, remotePath, scriptPath){
if (localPath != null) script = JV.FileManager.setScriptFileRefs(script, localPath, true);
if (remotePath != null) script = JV.FileManager.setScriptFileRefs(script, remotePath, false);
script = JU.PT.rep(script, "\1\"", "\"");
if (scriptPath != null) {
while (scriptPath.endsWith("/")) scriptPath = scriptPath.substring(0, scriptPath.length - 1);

for (var ipt = 0; ipt < JV.FileManager.scriptFilePrefixes.length; ipt++) {
var tag = JV.FileManager.scriptFilePrefixes[ipt];
script = JU.PT.rep(script, tag + ".", tag + scriptPath);
}
}return script;
}, "~S,~S,~S,~S");
c$.setScriptFileRefs = Clazz_defineMethod(c$, "setScriptFileRefs", 
function(script, dataPath, isLocal){
if (dataPath == null) return script;
var noPath = (dataPath.length == 0);
var fileNames =  new JU.Lst();
JV.FileManager.getFileReferences(script, fileNames, null);
var oldFileNames =  new JU.Lst();
var newFileNames =  new JU.Lst();
var nFiles = fileNames.size();
for (var iFile = 0; iFile < nFiles; iFile++) {
var name0 = fileNames.get(iFile);
var name = name0;
var pt = name.indexOf("::");
var type = "";
if (pt >= 0) {
type = name.substring(pt + 2);
name = name.substring(pt + 2);
}if (isLocal == JU.OC.isLocal(name)) {
pt = (noPath ? -1 : name.indexOf("/" + dataPath + "/"));
if (pt >= 0) {
name = name.substring(pt + 1);
} else {
pt = name.lastIndexOf("/");
if (pt < 0 && !noPath) name = "/" + name;
if (pt < 0 || noPath) pt++;
name = dataPath + name.substring(pt);
}}name = type + name;
JU.Logger.info("FileManager substituting " + name0 + " --> " + name);
oldFileNames.addLast("\"" + name0 + "\"");
newFileNames.addLast("\1\"" + name + "\"");
}
return JU.PT.replaceStrings(script, oldFileNames, newFileNames);
}, "~S,~S,~B");
Clazz_defineMethod(c$, "cachePut", 
function(key, data){
key = JV.FileManager.fixDOSName(key);
if (JU.Logger.debugging) JU.Logger.debug("cachePut " + key);
if (data == null || "".equals(data)) {
this.cache.remove(key);
return;
}this.cache.put(key, data);
this.getCachedPngjBytes(key);
}, "~S,~O");
Clazz_defineMethod(c$, "cacheGet", 
function(key, bytesOnly){
key = JV.FileManager.fixDOSName(key);
var pt = key.indexOf("|");
if (pt >= 0 && !key.endsWith("##JmolSurfaceInfo##")) key = key.substring(0, pt);
key = this.getFilePath(key, true, false);
var data = null;
{
(data = Jmol.Cache.get(key)) || (data = this.cache.get(key));
}return (bytesOnly && ((typeof(data)=='string')) ? null : data);
}, "~S,~B");
Clazz_defineMethod(c$, "cacheClear", 
function(){
JU.Logger.info("cache cleared");
this.cache.clear();
if (this.pngjCache == null) return;
this.pngjCache = null;
JU.Logger.info("PNGJ cache cleared");
});
Clazz_defineMethod(c$, "cacheFileByNameAdd", 
function(fileName, isAdd){
if (fileName == null || !isAdd && fileName.equalsIgnoreCase("")) {
this.cacheClear();
return -1;
}var data;
if (isAdd) {
fileName = JV.JC.fixProtocol(this.vwr.resolveDatabaseFormat(fileName));
data = this.getFileAsBytes(fileName, null);
if ((typeof(data)=='string')) return 0;
this.cachePut(fileName, data);
} else {
if (fileName.endsWith("*")) return JU.AU.removeMapKeys(this.cache, fileName.substring(0, fileName.length - 1));
data = this.cache.remove(JV.FileManager.fixDOSName(fileName));
}return (data == null ? 0 : (typeof(data)=='string') ? (data).length : (data).length);
}, "~S,~B");
Clazz_defineMethod(c$, "cacheList", 
function(){
var map =  new java.util.Hashtable();
for (var entry, $entry = this.cache.entrySet().iterator (); $entry.hasNext()&& ((entry = $entry.next ()) || true);) map.put(entry.getKey(), Integer.$valueOf(JU.AU.isAB(entry.getValue()) ? (entry.getValue()).length : entry.getValue().toString().length));

return map;
});
Clazz_defineMethod(c$, "getCanonicalName", 
function(pathName){
var names = this.getClassifiedName(pathName, true);
return (names == null ? pathName : names[2]);
}, "~S");
Clazz_defineMethod(c$, "recachePngjBytes", 
function(fileName, bytes){
if (this.pngjCache == null || !this.pngjCache.containsKey(fileName)) return;
this.pngjCache.put(fileName, bytes);
JU.Logger.info("PNGJ recaching " + fileName + " (" + bytes.length + ")");
}, "~S,~A");
Clazz_defineMethod(c$, "getPngjOrDroppedBytes", 
function(fullName, name){
var bytes = this.getCachedPngjBytes(fullName);
return (bytes == null ? this.cacheGet(name, true) : bytes);
}, "~S,~S");
Clazz_defineMethod(c$, "getCachedPngjBytes", 
function(pathName){
return (pathName == null || this.pngjCache == null || pathName.indexOf(".png") < 0 ? null : this.getJzu().getCachedPngjBytes(this, pathName));
}, "~S");
Clazz_overrideMethod(c$, "postByteArray", 
function(fileName, bytes){
if (fileName.startsWith("cache://")) {
this.cachePut(fileName, bytes);
return "OK " + bytes.length + "cached";
}var ret = this.getBufferedInputStreamOrErrorMessageFromName(fileName, null, false, false, bytes, false, true);
if ((typeof(ret)=='string')) return ret;
try {
ret = JU.Rdr.getStreamAsBytes(ret, null);
} catch (e) {
if (Clazz_exceptionOf(e,"java.io.IOException")){
try {
(ret).close();
} catch (e1) {
if (Clazz_exceptionOf(e1,"java.io.IOException")){
} else {
throw e1;
}
}
} else {
throw e;
}
}
return (ret == null ? "" : JU.Rdr.fixUTF(ret));
}, "~S,~A");
c$.isJmolType = Clazz_defineMethod(c$, "isJmolType", 
function(type){
return (type.equals("PNG") || type.equals("PNGJ") || type.equals("JMOL") || type.equals("ZIP") || type.equals("ZIPALL"));
}, "~S");
c$.isEmbeddable = Clazz_defineMethod(c$, "isEmbeddable", 
function(type){
var pt = type.lastIndexOf('.');
if (pt >= 0) type = type.substring(pt + 1);
type = type.toUpperCase();
return (JV.FileManager.isJmolType(type) || JU.PT.isOneOf(type, ";JPG;JPEG;POV;IDTF;"));
}, "~S");
Clazz_defineMethod(c$, "getEmbeddedFileState", 
function(fileName, allowCached, sptName){
if (!JV.FileManager.isEmbeddable(fileName)) return "";
var dir = this.getZipDirectory(fileName, false, allowCached);
if (dir.length == 0) {
var state = this.vwr.getFileAsString4(fileName, -1, false, true, false, "file");
return (state.indexOf("**** Jmol Embedded Script ****") < 0 ? "" : JV.FileManager.getEmbeddedScript(state));
}for (var i = 0; i < dir.length; i++) if (dir[i].indexOf(sptName) >= 0) {
var data =  Clazz_newArray(-1, [fileName + "|" + dir[i], null]);
this.getFileDataAsString(data, -1, false, false, false);
return data[1];
}
return "";
}, "~S,~B,~S");
c$.stripTypePrefix = Clazz_defineMethod(c$, "stripTypePrefix", 
function(fileName){
var pt = fileName.indexOf("::");
return (pt < 0 || pt >= 20 ? fileName : fileName.substring(pt + 2));
}, "~S");
c$.getEmbeddedScript = Clazz_defineMethod(c$, "getEmbeddedScript", 
function(s){
if (s == null) return s;
var pt = s.indexOf("**** Jmol Embedded Script ****");
if (pt < 0) return s;
var pt1 = s.lastIndexOf("/*", pt);
var pt2 = s.indexOf((s.charAt(pt1 + 2) == '*' ? "*" : "") + "*/", pt);
if (pt1 >= 0 && pt2 >= pt) s = s.substring(pt + "**** Jmol Embedded Script ****".length, pt2) + "\n";
while ((pt1 = s.indexOf(" #Jmol...\u0000")) >= 0) s = s.substring(0, pt1) + s.substring(pt1 + " #Jmol...\u0000".length + 4);

if (JU.Logger.debugging) JU.Logger.debug(s);
return s;
}, "~S");
Clazz_defineMethod(c$, "isZipStream", 
function(br){
return this.vwr.getJzt().isZipStream(br);
}, "~O");
Clazz_defineMethod(c$, "openFileAsync", 
function(fname, flags, type){
var scriptOnly = ((flags & 32) != 0);
if (!scriptOnly && (flags & 64) != 0 && JV.FileManager.isEmbeddable(fname)) this.checkResize(fname);
var noScript = ((flags & 2) != 0);
var noAutoPlay = ((flags & 8) != 0);
var cmd = null;
fname = fname.trim().$replace('\\', '/');
var isCached = fname.startsWith("cache://");
if (this.vwr.isApplet && fname.indexOf("://") < 0) fname = "file://" + (fname.startsWith("/") ? "" : "/") + fname;
try {
if (scriptOnly) {
cmd = "script " + JU.PT.esc(fname);
return;
}if (fname.endsWith(".pse")) {
cmd = (isCached ? "" : "zap;") + "load SYNC " + JU.PT.esc(fname) + (this.vwr.isApplet ? "" : " filter 'DORESIZE'");
return;
}if (fname.endsWith(".jvxl")) {
cmd = "isosurface ";
} else if (!fname.toLowerCase().endsWith(".spt")) {
if (type == null) type = this.getDragDropFileTypeName(fname);
 else if (!type.endsWith("::")) type += "::";
if (type == null) {
try {
var bis = this.vwr.getBufferedInputStream(fname);
type = JV.FileManager.determineSurfaceFileType(JU.Rdr.getBufferedReader(bis, "ISO-8859-1"));
if (type == null) {
cmd = "script " + JU.PT.esc(fname);
return;
}} catch (e) {
if (Clazz_exceptionOf(e,"java.io.IOException")){
return;
} else {
throw e;
}
}
if (type === "MENU") {
cmd = "load MENU " + JU.PT.esc(fname);
} else {
cmd = "if (_filetype == 'Pdb') { isosurface sigma 1.0 within 2.0 {*} " + JU.PT.esc(fname) + " mesh nofill }; else; { isosurface " + JU.PT.esc(fname) + "}";
}return;
}if (type.equals("spt::")) {
cmd = "script " + JU.PT.esc((fname.startsWith("spt::") ? fname.substring(5) : fname));
return;
}if (type.equals("dssr")) {
cmd = "model {visible} property dssr ";
} else if (type.equals("Jmol")) {
cmd = "script ";
} else if (type.equals("Cube::")) {
cmd = (this.vwr.ms.ac == 0 ? "load " + JU.PT.esc(fname) + ";" : "");
cmd += "isosurface sign red blue ";
} else if (!type.equals("spt")) {
if ((flags & 16) != 0) {
flags = (flags & -17) | 1;
switch (this.vwr.ms.ac == 0 ? 0 : this.vwr.confirm(J.i18n.GT.$("Would you like to replace the current model with the selected model?"), J.i18n.GT.$("Would you like to append?"))) {
case 2:
return;
case 0:
break;
default:
flags |= 4;
break;
}
}var isAppend = ((flags & 4) != 0);
var pdbCartoons = ((flags & 1) != 0 && !isAppend);
if (type.endsWith("::")) {
var pt = type.indexOf("|");
if (pt >= 0) {
fname += type.substring(pt, type.length - 2);
type = "";
}fname = type + fname;
}cmd = this.vwr.g.defaultDropScript;
if (cmd.equals("zap; load SYNC \"%FILE\";if (%ALLOWCARTOONS && _loadScript == \'\' && defaultLoadScript == \'\' && _filetype == \'Pdb\') {if ({(protein or nucleic)&*/1.1} && {*/1.1}[1].groupindex != {*/1.1}[0].groupindex){select protein or nucleic;cartoons only;}if ({visible && cartoons > 0}){color structure}else{wireframe -0.1};if (!{visible}){select !visible;wireframe 0.15;color none;select !visible;spacefill 23%};select *}")) {
if (!JV.JC.isLikelyPDB(type) || !pdbCartoons) {
var pt = cmd.indexOf("if (");
if (pt >= 0) {
cmd = cmd.substring(0, pt).trim();
}}}cmd = JU.PT.rep(cmd, "%FILE", fname);
cmd = JU.PT.rep(cmd, "%ALLOWCARTOONS", "" + pdbCartoons);
if (cmd.toLowerCase().startsWith("zap") && (isCached || isAppend)) cmd = cmd.substring(3);
if (isAppend) {
cmd = JU.PT.rep(cmd, "load SYNC", "load append");
}return;
}}if (cmd == null && !noScript && this.vwr.scriptEditorVisible) this.vwr.showEditor( Clazz_newArray(-1, [fname, this.vwr.getFileAsString3(fname, true, null)]));
 else cmd = (cmd == null ? "script " : cmd) + JU.PT.esc(fname);
} finally {
if (cmd != null) this.vwr.evalString(cmd + (noAutoPlay ? "#!NOAUTOPLAY" : ""));
}
}, "~S,~N,~S");
Clazz_defineMethod(c$, "getDragDropFileTypeName", 
function(fileName){
var pt = fileName.indexOf("::");
if (pt >= 0) return fileName.substring(0, pt + 2);
if (fileName.startsWith("=")) return "pdb";
if (fileName.endsWith(".dssr")) return "dssr";
var br = this.getUnzippedReaderOrStreamFromName(fileName, null, true, false, true, true, null);
var modelType = null;
if (this.isZipStream(br)) {
var zipDirectory = this.vwr.getZipDirectoryAsString(fileName);
if (zipDirectory.indexOf("JmolManifest") >= 0) return "Jmol";
modelType = this.getFileTypeName(JU.Rdr.getBR(zipDirectory));
} else if (Clazz_instanceOf(br,"java.io.BufferedReader") || Clazz_instanceOf(br,"java.io.BufferedInputStream")) {
modelType = this.getFileTypeName(br);
}if (modelType != null) return modelType + "::";
if (JU.AU.isAS(br)) {
return (br)[0];
}return null;
}, "~S");
Clazz_defineMethod(c$, "checkResize", 
function(fname){
try {
var data = this.getEmbeddedFileState(fname, false, "state.spt");
if (data.indexOf("preferredWidthHeight") >= 0) this.vwr.sm.resizeInnerPanelString(data);
} catch (e) {
}
}, "~S");
Clazz_defineMethod(c$, "getJmolDataReader", 
function(){
if (this.staticJmolDataReader == null) {
this.staticJmolDataReader = J.adapter.smarter.Resolver.getReader("JmolData", null);
this.staticJmolDataReader.vwr = this.vwr;
}return this.staticJmolDataReader;
});
Clazz_defineMethod(c$, "readCifData", 
function(fnameOrCifData, type){
var isData = (fnameOrCifData != null && fnameOrCifData.indexOf("#CIF") >= 0);
var keys = null;
var pt = (fnameOrCifData == null ? -1 : fnameOrCifData.indexOf(";keys="));
if (pt >= 0) {
keys = fnameOrCifData.substring(pt + 6).$plit(",");
fnameOrCifData = fnameOrCifData.substring(0, pt);
}if (type == null && fnameOrCifData != null && fnameOrCifData.toUpperCase().indexOf("BCIF") >= 0) {
var is = this.getBufferedInputStream(fnameOrCifData);
try {
return (J.api.Interface.getInterface("JU.MessagePackReader", this.vwr, "script")).getMapForStream(is);
} catch (e) {
if (Clazz_exceptionOf(e, Exception)){
e.printStackTrace();
return  new java.util.Hashtable();
} else {
throw e;
}
}
}var data = (isData ? fnameOrCifData : fnameOrCifData == null || fnameOrCifData.length == 0 ? this.vwr.getCurrentFileAsString("script") : this.getAsciiFileOrNull(fnameOrCifData));
if (data == null || data.length < 2) return null;
var rdr = JU.Rdr.getBR(data);
if (type == null) type = this.getFileTypeName(rdr);
return (type == null ? null : this.readCifDataKey(rdr, type, keys));
}, "~S,~S");
Clazz_defineMethod(c$, "readCifDataKey", 
function(rdrOrStringData, type, keys){
var rdr = (Clazz_instanceOf(rdrOrStringData,"java.io.BufferedReader") ? rdrOrStringData : JU.Rdr.getBR(rdrOrStringData));
return JU.Rdr.readCifData(J.api.Interface.getInterface(("Cif2".equals(type) ? "J.adapter.readers.cif.Cif2DataParser" : "JU.CifDataParser"), this.vwr, "script"), rdr, keys);
}, "~O,~S,~A");
Clazz_defineMethod(c$, "getAsciiFileOrNull", 
function(name){
var data =  Clazz_newArray(-1, [name, null]);
return (this.getFileDataAsString(data, -1, false, false, false) ? data[1] : null);
}, "~S");
Clazz_defineMethod(c$, "getFileTypeName", 
function(br){
return this.vwr.getModelAdapter().getFileTypeName(br);
}, "~O");
c$.SIMULATION_PROTOCOL = "http://SIMULATION/";
c$.scriptFilePrefixes =  Clazz_newArray(-1, ["/*file*/\"", "FILE0=\"", "FILE1=\""]);
});
;//5.0.1-v7 Mon Aug 24 10:01:38 CDT 2026
Clazz_declarePackage("JV");
Clazz_load(["java.util.Hashtable", "JU.P3", "J.c.CBK"], "JV.GlobalSettings", ["JU.DF", "$.PT", "$.SB", "J.c.STR", "JS.SV", "JU.Escape", "$.Logger", "JV.JC", "$.StateManager", "$.Viewer"], function(){
var c$ = Clazz_decorateAsClass(function(){
this.vwr = null;
this.htNonbooleanParameterValues = null;
this.htBooleanParameterFlags = null;
this.htPropertyFlagsRemoved = null;
this.htUserVariables = null;
this.zDepth = 0;
this.zShadePower = 3;
this.zSlab = 50;
this.slabByMolecule = false;
this.slabByAtom = false;
this.allowEmbeddedScripts = true;
this.appendNew = true;
this.appletProxy = "";
this.applySymmetryToBonds = false;
this.atomTypes = "";
this.autoBond = true;
this.axesOrientationRasmol = false;
this.bondRadiusMilliAngstroms = 150;
this.bondTolerance = 0.45;
this.defaultDirectory = "";
this.defaultStructureDSSP = true;
this.ptDefaultLattice = null;
this.defaultLoadScript = "";
this.defaultLoadFilter = "";
this.defaultDropScript = "zap; load SYNC \"%FILE\";if (%ALLOWCARTOONS && _loadScript == \'\' && defaultLoadScript == \'\' && _filetype == \'Pdb\') {if ({(protein or nucleic)&*/1.1} && {*/1.1}[1].groupindex != {*/1.1}[0].groupindex){select protein or nucleic;cartoons only;}if ({visible && cartoons > 0}){color structure}else{wireframe -0.1};if (!{visible}){select !visible;wireframe 0.15;color none;select !visible;spacefill 23%};select *}";
this.forceAutoBond = false;
this.fractionalRelative = true;
this.inlineNewlineChar = '|';
this.loadFormat = null;
this.pdbLoadFormat = null;
this.pdbLoadLigandFormat = null;
this.nmrUrlFormat = null;
this.nmrPredictFormat = null;
this.smilesUrlFormat = null;
this.nihResolverFormat = null;
this.pubChemFormat = null;
this.macroDirectory = null;
this.resolverResolver = null;
this.checkCIR = false;
this.minBondDistance = 0.4;
this.minPixelSelRadius = 6;
this.pdbAddHydrogens = false;
this.pdbGetHeader = false;
this.pdbSequential = false;
this.percentVdwAtom = 23;
this.smallMoleculeMaxAtoms = 40000;
this.smartAromatic = true;
this.zeroBasedXyzRasmol = false;
this.legacyAutoBonding = false;
this.legacyHAddition = false;
this.legacyJavaFloat = false;
this.doublePrecision = false;
this.jmolInJSpecView = true;
this.modulateOccupancy = true;
this.allowRotateSelected = false;
this.allowMoveAtoms = false;
this.dotSolvent = false;
this.defaultAngleLabel = "%VALUE %UNITS";
this.defaultDistanceLabel = "%VALUE %UNITS";
this.defaultTorsionLabel = "%VALUE %UNITS";
this.justifyMeasurements = false;
this.measureAllModels = false;
this.minimizationSteps = 100;
this.minimizationRefresh = true;
this.minimizationSilent = false;
this.minimizationCriterion = 0.001;
this.minimizationMaxAtoms = 200;
this.minimizationReportSteps = 10;
this.infoFontSize = 20;
this.antialiasDisplay = false;
this.antialiasImages = true;
this.imageState = true;
this.antialiasTranslucent = true;
this.displayCellParameters = true;
this.dotsSelectedOnly = false;
this.dotSurface = true;
this.dotDensity = 3;
this.dotScale = 1;
this.meshScale = 1;
this.mode2d = false;
this.greyscaleRendering = false;
this.isosurfaceKey = false;
this.isosurfacePropertySmoothing = true;
this.isosurfacePropertySmoothingPower = 7;
this.platformSpeed = 10;
this.repaintWaitMs = 1000;
this.showHiddenSelectionHalos = false;
this.showKeyStrokes = true;
this.showMeasurements = true;
this.showTiming = false;
this.zoomLarge = true;
this.zoomHeight = false;
this.backgroundImageFileName = null;
this.occupancyThreshold = 50;
this.partialDots = false;
this.bondModeOr = false;
this.hbondsBackbone = false;
this.hbondsAngleMinimum = 90;
this.hbondNODistanceMaximum = 3.25;
this.hbondHXDistanceMaximum = 2.5;
this.hbondsRasmol = true;
this.hbondsSolid = false;
this.modeMultipleBond = 2;
this.showHydrogens = true;
this.showMultipleBonds = true;
this.ssbondsBackbone = false;
this.multipleBondSpacing = -1;
this.multipleBondRadiusFactor = 0;
this.multipleBondBananas = false;
this.nboCharges = true;
this.cartoonBaseEdges = false;
this.cartoonRockets = false;
this.cartoonBlockHeight = 0.5;
this.cartoonBlocks = false;
this.cartoonSteps = false;
this.cartoonFancy = false;
this.cartoonLadders = false;
this.cartoonRibose = false;
this.chainCaseSensitive = false;
this.cipRule6Full = false;
this.hermiteLevel = 0;
this.highResolutionFlag = false;
this.rangeSelected = false;
this.rasmolHydrogenSetting = true;
this.rasmolHeteroSetting = true;
this.ribbonAspectRatio = 16;
this.ribbonBorder = false;
this.rocketBarrels = false;
this.sheetSmoothing = 1;
this.traceAlpha = true;
this.translucent = true;
this.twistedSheets = false;
this.autoplayMovie = true;
this.allowAudio = true;
this.allowGestures = false;
this.allowModelkit = true;
this.allowMultiTouch = true;
this.allowKeyStrokes = false;
this.hiddenLinesDashed = false;
this.animationFps = 10;
this.atomPicking = true;
this.autoFps = false;
this.axesMode = 603979809;
this.axesScale = 2;
this.axesOffset = 0;
this.starWidth = 0.05;
this.bondPicking = false;
this.dataSeparator = "~~~";
this.debugScript = false;
this.defaultDrawArrowScale = 0.5;
this.defaultLabelXYZ = "%a";
this.defaultLabelPDB = "%m%r";
this.defaultTranslucent = 0.5;
this.delayMaximumMs = 0;
this.dipoleScale = 1;
this.drawFontSize = 16.0;
this.disablePopupMenu = false;
this.dragSelected = false;
this.drawHover = false;
this.drawPicking = false;
this.dsspCalcHydrogen = true;
this.elementKey = false;
this.labelKey = false;
this.energyUnits = "kJ";
this.exportScale = 0;
this.helpPath = "https://chemapps.stolaf.edu/jmol/docs/index.htm";
this.fontScaling = false;
this.fontCaching = true;
this.forceField = "MMFF";
this.helixStep = 1;
this.hideNameInPopup = false;
this.hoverDelayMs = 500;
this.labelPointerWidth = 2;
this.loadAtomDataTolerance = 0.01;
this.logCommands = false;
this.logGestures = false;
this.measureDistanceUnits = "nanometers";
this.measurementLabels = true;
this.messageStyleChime = false;
this.monitorEnergy = false;
this.modulationScale = 1;
this.multiProcessor = true;
this.particleRadius = 20;
this.pickingSpinRate = 10;
this.pickLabel = "";
this.pointGroupDistanceTolerance = 0.2;
this.pointGroupLinearTolerance = 8.0;
this.preserveState = true;
this.propertyColorScheme = "roygb";
this.quaternionFrame = "p";
this.saveProteinStructureState = true;
this.showModVecs = false;
this.showUnitCellDetails = true;
this.solventProbeRadius = 1.2;
this.scriptDelay = 0;
this.selectAllModels = true;
this.statusReporting = true;
this.strandCountForStrands = 5;
this.strandCountForMeshRibbon = 7;
this.strutSpacing = 6;
this.strutLengthMaximum = 7.0;
this.strutDefaultRadius = 0.3;
this.strutsMultiple = false;
this.symmetryHermannMauguin = false;
this.useMinimizationThread = true;
this.useNumberLocalization = true;
this.useScriptQueue = true;
this.waitForMoveTo = true;
this.noDelay = false;
this.vectorScale = 1;
this.vectorSymmetry = false;
this.vectorsCentered = false;
this.vectorTrail = 0;
this.vibrationPeriod = 1;
this.vibrationScale = 1;
this.wireframeRotation = false;
this.hideNavigationPoint = false;
this.navigationMode = false;
this.navigationPeriodic = false;
this.navigationSpeed = 5;
this.showNavigationPointAlways = false;
this.stereoState = null;
this.modelKitMode = false;
this.objColors = null;
this.objStateOn = null;
this.objMad10 = null;
this.ellipsoidAxes = false;
this.ellipsoidDots = false;
this.ellipsoidArcs = false;
this.ellipsoidArrows = false;
this.ellipsoidFill = false;
this.ellipsoidBall = true;
this.ellipsoidDotCount = 200;
this.ellipsoidAxisDiameter = 0.02;
this.testFlag1 = false;
this.testFlag2 = false;
this.testFlag3 = false;
this.testFlag4 = false;
this.structureList = null;
this.haveSetStructureList = false;
this.bondingVersion = 0;
Clazz_instantialize(this, arguments);}, JV, "GlobalSettings", null);
Clazz_prepareFields (c$, function(){
this.htUserVariables =  new java.util.Hashtable();
this.ptDefaultLattice =  new JU.P3();
this.objColors =  Clazz_newIntArray (7, 0);
this.objStateOn =  Clazz_newBooleanArray(7, false);
this.objMad10 =  Clazz_newIntArray (7, 0);
this.structureList =  new java.util.Hashtable();
{
this.structureList.put(J.c.STR.TURN,  Clazz_newFloatArray(-1, [30, 90, -15, 95]));
this.structureList.put(J.c.STR.SHEET,  Clazz_newFloatArray(-1, [-180, -10, 70, 180, -180, -45, -180, -130, 140, 180, 90, 180]));
this.structureList.put(J.c.STR.HELIX,  Clazz_newFloatArray(-1, [-160, 0, -100, 45]));
}});
Clazz_makeConstructor(c$, 
function(vwr, g, clearUserVariables){
this.vwr = vwr;
this.htNonbooleanParameterValues =  new java.util.Hashtable();
this.htBooleanParameterFlags =  new java.util.Hashtable();
this.htPropertyFlagsRemoved =  new java.util.Hashtable();
this.loadFormat = this.pdbLoadFormat = JV.JC.databases.get("pdb");
this.pdbLoadLigandFormat = JV.JC.databases.get("ligand");
this.nmrUrlFormat = JV.JC.databases.get("nmr");
this.nmrPredictFormat = JV.JC.databases.get("nmrdb");
this.pubChemFormat = JV.JC.databases.get("pubchem");
this.resolverResolver = JV.JC.databases.get("resolverresolver");
this.macroDirectory = "https://chemapps.stolaf.edu/jmol/macros";
if (g == null) {
this.setB("undoAuto", !vwr.isApplet);
} else {
this.setB("undoAuto", vwr.getBooleanProperty("undoAuto"));
if (!clearUserVariables) {
this.setO("_pngjFile", g.getParameter("_pngjFile", false));
this.htUserVariables = g.htUserVariables;
}this.debugScript = g.debugScript;
this.disablePopupMenu = g.disablePopupMenu;
this.messageStyleChime = g.messageStyleChime;
this.measureDistanceUnits = g.measureDistanceUnits;
this.defaultDirectory = g.defaultDirectory;
this.autoplayMovie = g.autoplayMovie;
this.allowAudio = g.allowAudio;
this.allowGestures = g.allowGestures;
this.allowModelkit = g.allowModelkit;
this.allowMultiTouch = g.allowMultiTouch;
this.allowKeyStrokes = g.allowKeyStrokes;
this.legacyAutoBonding = g.legacyAutoBonding;
this.legacyHAddition = g.legacyHAddition;
this.legacyJavaFloat = g.legacyJavaFloat;
this.minimizationReportSteps = g.minimizationReportSteps;
this.doublePrecision = g.doublePrecision;
this.bondingVersion = g.bondingVersion;
this.platformSpeed = g.platformSpeed;
this.useScriptQueue = g.useScriptQueue;
this.showTiming = g.showTiming;
this.wireframeRotation = g.wireframeRotation;
this.testFlag1 = g.testFlag1;
this.testFlag2 = g.testFlag2;
this.testFlag3 = g.testFlag3;
this.testFlag4 = g.testFlag4;
this.nihResolverFormat = g.nihResolverFormat;
}if (this.nihResolverFormat == null) this.nihResolverFormat = JV.JC.databases.get("nci");
this.setCIR(this.nihResolverFormat, false);
for (var item, $item = 0, $$item = J.c.CBK.values(); $item < $$item.length && ((item = $$item[$item]) || true); $item++) this.resetValue(item.name() + "Callback", g);

this.setF("cameraDepth", 3.0);
this.setI("undoMax", vwr.stm.getUndoMax());
this.setI("contextDepthMax", 100);
this.setI("depth", 0);
this.setF("gestureSwipeFactor", 1.0);
this.setB("hideNotSelected", false);
this.setI("historyLevel", 0);
this.setO("hoverLabel", "");
this.setB("isKiosk", vwr.isKiosk());
this.setO("logFile", vwr.getLogFileName());
this.setI("logLevel", JU.Logger.getLogLevel());
this.setF("mouseWheelFactor", 1.15);
this.setF("mouseDragFactor", 1.0);
this.setI("navFps", 10);
this.setI("navigationDepth", 0);
this.setI("navigationSlab", 0);
this.setI("navX", 0);
this.setI("navY", 0);
this.setI("navZ", 0);
this.setO("pathForAllFiles", "");
this.setB("perspectiveDepth", true);
this.setI("perspectiveModel", 11);
this.setO("picking", "identify");
this.setO("pickingStyle", "toggle");
this.setB("refreshing", true);
this.setI("rotationRadius", 0);
this.setI("scaleAngstromsPerInch", 0);
this.setI("scriptReportingLevel", 0);
this.setB("selectionHalos", false);
this.setB("showaxes", false);
this.setB("showboundbox", false);
this.setB("showfrank", false);
this.setB("showUnitcell", false);
this.setI("slab", 100);
this.setB("slabEnabled", false);
this.setF("slabrange", 0);
this.setI("spinX", 0);
this.setI("spinY", 30);
this.setI("spinZ", 0);
this.setI("spinFps", 30);
this.setF("visualRange", 5.0);
this.setI("stereoDegrees", -5);
this.setB("syncScript", vwr.sm.syncingScripts);
this.setB("syncMouse", vwr.sm.syncingMouse);
this.setB("syncStereo", vwr.sm.stereoSync);
this.setB("windowCentered", true);
this.setB("zoomEnabled", true);
this.setI("_version", JV.JC.versionInt);
this.setO("_versionDate", JV.Viewer.getJmolVersion());
this.setB("axesWindow", true);
this.setB("axesMolecular", false);
this.setB("axesPosition", false);
this.setB("axesUnitcell", false);
this.setI("backgroundModel", 0);
this.setB("colorRasmol", false);
this.setO("currentLocalPath", "");
this.setO("defaultLattice", "{0 0 0}");
this.setO("defaultColorScheme", "Jmol");
this.setO("defaultDirectoryLocal", "");
this.setO("defaults", "Jmol");
this.setO("defaultVDW", "Jmol");
this.setO("exportDrivers", "Idtf;Maya;Povray;Vrml;X3d;Stl;Tachyon;Obj");
this.setI("propertyAtomNumberColumnCount", 0);
this.setI("propertyAtomNumberField", 0);
this.setI("propertyDataColumnCount", 0);
this.setI("propertyDataField", 0);
this.setI("undoMax", vwr.stm.getUndoMax());
this.setB("allowEmbeddedScripts", this.allowEmbeddedScripts);
this.setB("allowGestures", this.allowGestures);
this.setB("allowKeyStrokes", this.allowKeyStrokes);
this.setB("allowModelkit", this.allowModelkit);
this.setB("allowMultiTouch", this.allowMultiTouch);
this.setB("allowRotateSelected", this.allowRotateSelected);
this.setB("allowMoveAtoms", this.allowMoveAtoms);
this.setI("animationFps", this.animationFps);
this.setB("antialiasImages", this.antialiasImages);
this.setB("antialiasDisplay", this.antialiasDisplay);
this.setB("antialiasTranslucent", this.antialiasTranslucent);
this.setB("appendNew", this.appendNew);
this.setO("appletProxy", this.appletProxy);
this.setB("applySymmetryToBonds", this.applySymmetryToBonds);
this.setB("atomPicking", this.atomPicking);
this.setO("atomTypes", this.atomTypes);
this.setB("autoBond", this.autoBond);
this.setB("autoFps", this.autoFps);
this.setI("axesMode", this.axesMode == 603979808 ? 2 : this.axesMode == 603979804 ? 1 : 0);
this.setF("axesScale", this.axesScale);
this.setF("axesOffset", this.axesOffset);
this.setB("axesOrientationRasmol", this.axesOrientationRasmol);
this.setF("cartoonBlockHeight", this.cartoonBlockHeight);
this.setB("cartoonBlocks", this.cartoonBlocks);
this.setB("cartoonSteps", this.cartoonSteps);
this.setB("bondModeOr", this.bondModeOr);
this.setB("bondPicking", this.bondPicking);
this.setI("bondRadiusMilliAngstroms", this.bondRadiusMilliAngstroms);
this.setF("bondTolerance", this.bondTolerance);
this.setB("cartoonBaseEdges", this.cartoonBaseEdges);
this.setB("cartoonFancy", this.cartoonFancy);
this.setB("cartoonLadders", this.cartoonLadders);
this.setB("cartoonLadders", this.cartoonRibose);
this.setB("cartoonRockets", this.cartoonRockets);
this.setB("chainCaseSensitive", this.chainCaseSensitive);
this.setB("cipRule6Full", this.cipRule6Full);
this.setI("bondingVersion", this.bondingVersion);
this.setO("dataSeparator", this.dataSeparator);
this.setB("debugScript", this.debugScript);
this.setO("defaultAngleLabel", this.defaultAngleLabel);
this.setF("defaultDrawArrowScale", this.defaultDrawArrowScale);
this.setO("defaultDirectory", this.defaultDirectory);
this.setO("defaultDistanceLabel", this.defaultDistanceLabel);
this.setO("defaultDropScript", this.defaultDropScript);
this.setO("defaultLabelPDB", this.defaultLabelPDB);
this.setO("defaultLabelXYZ", this.defaultLabelXYZ);
this.setO("defaultLoadFilter", this.defaultLoadFilter);
this.setO("defaultLoadScript", this.defaultLoadScript);
this.setB("defaultStructureDSSP", this.defaultStructureDSSP);
this.setO("defaultTorsionLabel", this.defaultTorsionLabel);
this.setF("defaultTranslucent", this.defaultTranslucent);
this.setI("delayMaximumMs", this.delayMaximumMs);
this.setF("dipoleScale", this.dipoleScale);
this.setB("disablePopupMenu", this.disablePopupMenu);
this.setB("displayCellParameters", this.displayCellParameters);
this.setI("dotDensity", this.dotDensity);
this.setI("dotScale", this.dotScale);
this.setB("dotsSelectedOnly", this.dotsSelectedOnly);
this.setB("dotSurface", this.dotSurface);
this.setB("dragSelected", this.dragSelected);
this.setB("drawHover", this.drawHover);
this.setF("drawFontSize", this.drawFontSize);
this.setB("drawPicking", this.drawPicking);
this.setB("dsspCalculateHydrogenAlways", this.dsspCalcHydrogen);
this.setB("elementkey", this.elementKey);
this.setB("labelkey", this.labelKey);
this.setB("ellipsoidArcs", this.ellipsoidArcs);
this.setB("ellipsoidArrows", this.ellipsoidArrows);
this.setB("ellipsoidAxes", this.ellipsoidAxes);
this.setF("ellipsoidAxisDiameter", this.ellipsoidAxisDiameter);
this.setB("ellipsoidBall", this.ellipsoidBall);
this.setI("ellipsoidDotCount", this.ellipsoidDotCount);
this.setB("ellipsoidDots", this.ellipsoidDots);
this.setB("ellipsoidFill", this.ellipsoidFill);
this.setO("energyUnits", this.energyUnits);
this.setF("exportScale", this.exportScale);
this.setB("doublePrecision", this.doublePrecision);
this.setB("fontScaling", this.fontScaling);
this.setB("fontCaching", this.fontCaching);
this.setB("forceAutoBond", this.forceAutoBond);
this.setO("forceField", this.forceField);
this.setB("fractionalRelative", this.fractionalRelative);
this.setF("particleRadius", this.particleRadius);
this.setB("greyscaleRendering", this.greyscaleRendering);
this.setF("hbondsAngleMinimum", this.hbondsAngleMinimum);
this.setF("hbondHXDistanceMaximum", this.hbondHXDistanceMaximum);
this.setF("hbondsDistanceMaximum", this.hbondNODistanceMaximum);
this.setB("hbondsBackbone", this.hbondsBackbone);
this.setB("hbondsRasmol", this.hbondsRasmol);
this.setB("hbondsSolid", this.hbondsSolid);
this.setI("helixStep", this.helixStep);
this.setO("helpPath", this.helpPath);
this.setI("hermiteLevel", this.hermiteLevel);
this.setB("hideNameInPopup", this.hideNameInPopup);
this.setB("hideNavigationPoint", this.hideNavigationPoint);
this.setB("hiddenLinesDashed", this.hiddenLinesDashed);
this.setB("highResolution", this.highResolutionFlag);
this.setF("hoverDelay", this.hoverDelayMs / 1000);
this.setB("imageState", this.imageState);
this.setI("infoFontSize", this.infoFontSize);
this.setB("isosurfaceKey", this.isosurfaceKey);
this.setB("isosurfacePropertySmoothing", this.isosurfacePropertySmoothing);
this.setI("isosurfacePropertySmoothingPower", this.isosurfacePropertySmoothingPower);
this.setB("jmolInJSpecView", this.jmolInJSpecView);
this.setI("labelPointerWidth", this.labelPointerWidth);
this.setB("justifyMeasurements", this.justifyMeasurements);
this.setB("legacyAutoBonding", this.legacyAutoBonding);
this.setB("legacyHAddition", this.legacyHAddition);
this.setB("legacyJavaFloat", this.legacyJavaFloat);
this.setF("loadAtomDataTolerance", this.loadAtomDataTolerance);
this.setO("loadFormat", this.loadFormat);
this.setO("loadLigandFormat", this.pdbLoadLigandFormat);
this.setB("logCommands", this.logCommands);
this.setB("logGestures", this.logGestures);
this.setB("measureAllModels", this.measureAllModels);
this.setB("measurementLabels", this.measurementLabels);
this.setO("measurementUnits", this.measureDistanceUnits);
this.setI("meshScale", this.meshScale);
this.setB("messageStyleChime", this.messageStyleChime);
this.setF("minBondDistance", this.minBondDistance);
this.setI("minPixelSelRadius", this.minPixelSelRadius);
this.setI("minimizationReportSteps", this.minimizationReportSteps);
this.setI("minimizationSteps", this.minimizationSteps);
this.setB("minimizationRefresh", this.minimizationRefresh);
this.setB("minimizationSilent", this.minimizationSilent);
this.setF("minimizationCriterion", this.minimizationCriterion);
this.setB("mode2d", this.mode2d);
this.setB("modelKitMode", this.modelKitMode);
this.setF("modulationScale", this.modulationScale);
this.setB("monitorEnergy", this.monitorEnergy);
this.setF("multipleBondRadiusFactor", this.multipleBondRadiusFactor);
this.setB("multipleBondBananas", this.multipleBondBananas);
this.setF("multipleBondSpacing", this.multipleBondSpacing);
this.setB("multiProcessor", this.multiProcessor && (JV.Viewer.nProcessors > 1));
this.setB("navigationMode", this.navigationMode);
this.setB("navigationPeriodic", this.navigationPeriodic);
this.setF("navigationSpeed", this.navigationSpeed);
this.setB("nboCharges", this.nboCharges);
this.setB("noDelay", this.noDelay);
this.setO("nmrPredictFormat", this.nmrPredictFormat);
this.setO("nmrUrlFormat", this.nmrUrlFormat);
this.setI("occupancyThreshold", this.occupancyThreshold);
this.setB("partialDots", this.partialDots);
this.setB("pdbAddHydrogens", this.pdbAddHydrogens);
this.setB("pdbGetHeader", this.pdbGetHeader);
this.setB("pdbSequential", this.pdbSequential);
this.setI("percentVdwAtom", this.percentVdwAtom);
this.setI("pickingSpinRate", this.pickingSpinRate);
this.setO("pickLabel", this.pickLabel);
this.setI("platformSpeed", this.platformSpeed);
this.setF("pointGroupLinearTolerance", this.pointGroupLinearTolerance);
this.setF("pointGroupDistanceTolerance", this.pointGroupDistanceTolerance);
this.setB("preserveState", this.preserveState);
this.setO("propertyColorScheme", this.propertyColorScheme);
this.setO("quaternionFrame", this.quaternionFrame);
this.setB("rangeSelected", this.rangeSelected);
this.setI("repaintWaitMs", this.repaintWaitMs);
this.setI("ribbonAspectRatio", this.ribbonAspectRatio);
this.setB("ribbonBorder", this.ribbonBorder);
this.setB("rocketBarrels", this.rocketBarrels);
this.setB("saveProteinStructureState", this.saveProteinStructureState);
this.setB("scriptqueue", this.useScriptQueue);
this.setB("selectAllModels", this.selectAllModels);
this.setB("selectHetero", this.rasmolHeteroSetting);
this.setB("selectHydrogen", this.rasmolHydrogenSetting);
this.setF("sheetSmoothing", this.sheetSmoothing);
this.setB("showHiddenSelectionHalos", this.showHiddenSelectionHalos);
this.setB("showHydrogens", this.showHydrogens);
this.setB("showKeyStrokes", this.showKeyStrokes);
this.setB("showMeasurements", this.showMeasurements);
this.setB("showModulationVectors", this.showModVecs);
this.setB("showMultipleBonds", this.showMultipleBonds);
this.setB("showNavigationPointAlways", this.showNavigationPointAlways);
this.setI("showScript", this.scriptDelay);
this.setB("showtiming", this.showTiming);
this.setB("slabByMolecule", this.slabByMolecule);
this.setB("slabByAtom", this.slabByAtom);
this.setB("smartAromatic", this.smartAromatic);
this.setI("minimizationMaxAtoms", this.minimizationMaxAtoms);
this.setI("smallMoleculeMaxAtoms", this.smallMoleculeMaxAtoms);
this.setO("smilesUrlFormat", this.smilesUrlFormat);
this.setO("macroDirectory", this.macroDirectory);
this.setO("nihResolverFormat", this.nihResolverFormat);
this.setO("pubChemFormat", this.pubChemFormat);
this.setB("showUnitCellDetails", this.showUnitCellDetails);
this.setB("solventProbe", this.dotSolvent);
this.setF("solventProbeRadius", this.solventProbeRadius);
this.setB("ssbondsBackbone", this.ssbondsBackbone);
this.setF("starWidth", this.starWidth);
this.setB("statusReporting", this.statusReporting);
this.setI("strandCount", this.strandCountForStrands);
this.setI("strandCountForStrands", this.strandCountForStrands);
this.setI("strandCountForMeshRibbon", this.strandCountForMeshRibbon);
this.setF("strutDefaultRadius", this.strutDefaultRadius);
this.setF("strutLengthMaximum", this.strutLengthMaximum);
this.setI("strutSpacing", this.strutSpacing);
this.setB("strutsMultiple", this.strutsMultiple);
this.setB("symmetryhermannmauguin", this.symmetryHermannMauguin);
this.setB("testFlag1", this.testFlag1);
this.setB("testFlag2", this.testFlag2);
this.setB("testFlag3", this.testFlag3);
this.setB("testFlag4", this.testFlag4);
this.setB("traceAlpha", this.traceAlpha);
this.setB("translucent", this.translucent);
this.setB("twistedSheets", this.twistedSheets);
this.setB("useMinimizationThread", this.useMinimizationThread);
this.setB("useNumberLocalization", this.useNumberLocalization);
this.setB("vectorsCentered", this.vectorsCentered);
this.setF("vectorScale", this.vectorScale);
this.setB("vectorSymmetry", this.vectorSymmetry);
this.setI("vectorTrail", this.vectorTrail);
this.setF("vibrationPeriod", this.vibrationPeriod);
this.setF("vibrationScale", this.vibrationScale);
this.setB("waitForMoveTo", this.waitForMoveTo);
this.setB("wireframeRotation", this.wireframeRotation);
this.setI("zDepth", this.zDepth);
this.setB("zeroBasedXyzRasmol", this.zeroBasedXyzRasmol);
this.setB("zoomHeight", this.zoomHeight);
this.setB("zoomLarge", this.zoomLarge);
this.setI("zShadePower", this.zShadePower);
this.setI("zSlab", this.zSlab);
}, "JV.Viewer,JV.GlobalSettings,~B");
Clazz_defineMethod(c$, "clear", 
function(){
var e = this.htUserVariables.keySet().iterator();
while (e.hasNext()) {
var key = e.next();
if (key.charAt(0) == '@' || key.startsWith("site_")) e.remove();
}
this.vwr.setPicked(-1, false);
this.setI("_atomhovered", -1);
this.setO("_pickinfo", "");
this.setB("selectionhalos", false);
this.setB("hidenotselected", false);
this.setB("measurementlabels", this.measurementLabels = true);
this.setB("drawHover", this.drawHover = false);
this.vwr.stm.saveScene("DELETE", null);
});
Clazz_defineMethod(c$, "setUnits", 
function(units){
var mu = this.measureDistanceUnits;
var eu = this.energyUnits;
if (units.equalsIgnoreCase("angstroms")) this.measureDistanceUnits = "angstroms";
 else if (units.equalsIgnoreCase("nanometers") || units.equalsIgnoreCase("nm")) this.measureDistanceUnits = "nanometers";
 else if (units.equalsIgnoreCase("picometers") || units.equalsIgnoreCase("pm")) this.measureDistanceUnits = "picometers";
 else if (units.equalsIgnoreCase("bohr") || units.equalsIgnoreCase("au")) this.measureDistanceUnits = "au";
 else if (units.equalsIgnoreCase("vanderwaals") || units.equalsIgnoreCase("vdw")) this.measureDistanceUnits = "vdw";
 else if (units.toLowerCase().endsWith("hz") || units.toLowerCase().endsWith("khz")) this.measureDistanceUnits = units.toLowerCase();
 else if (units.equalsIgnoreCase("kj")) this.energyUnits = "kJ";
 else if (units.equalsIgnoreCase("kcal")) this.energyUnits = "kcal";
if (!mu.equalsIgnoreCase(this.measureDistanceUnits)) this.setO("measurementUnits", this.measureDistanceUnits);
 else if (!eu.equalsIgnoreCase(this.energyUnits)) this.setO("energyUnits", this.energyUnits);
}, "~S");
Clazz_defineMethod(c$, "isJmolVariable", 
function(key){
return key.charAt(0) == '_' || this.htNonbooleanParameterValues.containsKey(key = key.toLowerCase()) || this.htBooleanParameterFlags.containsKey(key) || JV.GlobalSettings.unreportedProperties.indexOf(";" + key + ";") >= 0;
}, "~S");
Clazz_defineMethod(c$, "resetValue", 
function(name, g){
this.setO(name, g == null ? "" : g.getParameter(name, true));
}, "~S,JV.GlobalSettings");
Clazz_defineMethod(c$, "setB", 
function(name, value){
name = name.toLowerCase();
if (this.htNonbooleanParameterValues.containsKey(name)) return;
this.htBooleanParameterFlags.put(name, value ? Boolean.TRUE : Boolean.FALSE);
}, "~S,~B");
Clazz_defineMethod(c$, "setI", 
function(name, value){
if (value != 2147483647) this.setO(name, Integer.$valueOf(value));
}, "~S,~N");
Clazz_defineMethod(c$, "setF", 
function(name, value){
if (!Float.isNaN(value)) this.setO(name, Float.$valueOf(value));
}, "~S,~N");
Clazz_defineMethod(c$, "setOrRemoveO", 
function(name, value){
if (value == null) this.removeParam(name);
 else this.setO(name, value);
}, "~S,~O");
Clazz_defineMethod(c$, "setO", 
function(name, value){
name = name.toLowerCase();
if (value == null || this.htBooleanParameterFlags.containsKey(name)) return;
this.htNonbooleanParameterValues.put(name, value);
}, "~S,~O");
Clazz_defineMethod(c$, "removeParam", 
function(key){
key = key.toLowerCase();
if (this.htBooleanParameterFlags.containsKey(key)) {
this.htBooleanParameterFlags.remove(key);
if (!this.htPropertyFlagsRemoved.containsKey(key)) this.htPropertyFlagsRemoved.put(key, Boolean.FALSE);
return;
}if (this.htNonbooleanParameterValues.containsKey(key)) this.htNonbooleanParameterValues.remove(key);
}, "~S");
Clazz_defineMethod(c$, "setUserVariable", 
function(key, $var){
if ($var != null) {
key = key.toLowerCase();
this.htUserVariables.put(key, $var.setName(key));
}return $var;
}, "~S,JS.SV");
Clazz_defineMethod(c$, "unsetUserVariable", 
function(key){
if (key.equals("all") || key.equals("variables")) {
this.htUserVariables.clear();
JU.Logger.info("all user-defined variables deleted");
} else if (this.htUserVariables.containsKey(key)) {
JU.Logger.info("variable " + key + " deleted");
this.htUserVariables.remove(key);
}}, "~S");
Clazz_defineMethod(c$, "removeUserVariable", 
function(key){
this.htUserVariables.remove(key);
}, "~S");
Clazz_defineMethod(c$, "getUserVariable", 
function(name){
if (name == null) return null;
name = name.toLowerCase();
return this.htUserVariables.get(name);
}, "~S");
Clazz_defineMethod(c$, "getParameterEscaped", 
function(name, nMax){
name = name.toLowerCase();
if (this.htNonbooleanParameterValues.containsKey(name)) {
var v = this.htNonbooleanParameterValues.get(name);
return JV.StateManager.varClip(name, JU.Escape.e(v), nMax);
}if (this.htBooleanParameterFlags.containsKey(name)) return this.htBooleanParameterFlags.get(name).toString();
if (this.htUserVariables.containsKey(name)) return this.htUserVariables.get(name).escape();
if (this.htPropertyFlagsRemoved.containsKey(name)) return "false";
return "<not defined>";
}, "~S,~N");
Clazz_defineMethod(c$, "getParameter", 
function(name, nullAsString){
var v = this.getParam(name, false);
return (v == null && nullAsString ? "" : v);
}, "~S,~B");
Clazz_defineMethod(c$, "getAndSetNewVariable", 
function(name, doSet){
if (name == null || name.length == 0) name = "x";
var v = this.getParam(name, true);
return (v == null && doSet && name.charAt(0) != '_' ? this.setUserVariable(name, JS.SV.newV(4, "")) : JS.SV.getVariable(v));
}, "~S,~B");
Clazz_defineMethod(c$, "getParam", 
function(name, asVariable){
name = name.toLowerCase();
if (name.equals("_memory")) {
var bTotal = 0;
var bFree = 0;
{
}var value = JU.DF.formatDecimal(bTotal - bFree, 1) + "/" + JU.DF.formatDecimal(bTotal, 1);
this.htNonbooleanParameterValues.put("_memory", value);
}if (this.htNonbooleanParameterValues.containsKey(name)) return this.htNonbooleanParameterValues.get(name);
if (this.htBooleanParameterFlags.containsKey(name)) return this.htBooleanParameterFlags.get(name);
if (this.htPropertyFlagsRemoved.containsKey(name)) return Boolean.FALSE;
if (this.htUserVariables.containsKey(name)) {
var v = this.htUserVariables.get(name);
return (asVariable ? v : JS.SV.oValue(v));
}return null;
}, "~S,~B");
Clazz_defineMethod(c$, "getVariableList", 
function(){
return JV.StateManager.getVariableList(this.htUserVariables, 0, true, false);
});
Clazz_defineMethod(c$, "setStructureList", 
function(list, type){
this.haveSetStructureList = true;
this.structureList.put(type, list);
}, "~A,J.c.STR");
Clazz_defineMethod(c$, "getStructureList", 
function(){
return this.structureList;
});
c$.doReportProperty = Clazz_defineMethod(c$, "doReportProperty", 
function(name){
return (name.charAt(0) != '_' && JV.GlobalSettings.unreportedProperties.indexOf(";" + name + ";") < 0);
}, "~S");
Clazz_defineMethod(c$, "getAllVariables", 
function(){
var map =  new java.util.Hashtable();
map.putAll(this.htBooleanParameterFlags);
map.putAll(this.htNonbooleanParameterValues);
map.putAll(this.htUserVariables);
return map;
});
Clazz_defineMethod(c$, "getLoadState", 
function(htParams){
var str =  new JU.SB();
this.app(str, "set allowEmbeddedScripts false");
if (this.allowEmbeddedScripts) this.setB("allowEmbeddedScripts", true);
this.app(str, "set appendNew " + this.appendNew);
this.app(str, "set appletProxy " + JU.PT.esc(this.appletProxy));
this.app(str, "set applySymmetryToBonds " + this.applySymmetryToBonds);
if (this.atomTypes.length > 0) this.app(str, "set atomTypes " + JU.PT.esc(this.atomTypes));
this.app(str, "set autoBond " + this.autoBond);
if (this.axesOrientationRasmol) this.app(str, "set axesOrientationRasmol true");
this.app(str, "set bondRadiusMilliAngstroms " + this.bondRadiusMilliAngstroms);
this.app(str, "set bondTolerance " + this.bondTolerance);
this.app(str, "set defaultLattice " + JU.Escape.eP(this.ptDefaultLattice));
this.app(str, "set defaultLoadFilter " + JU.PT.esc(this.defaultLoadFilter));
this.app(str, "set defaultLoadScript \"\"");
if (this.defaultLoadScript.length > 0) this.setO("defaultLoadScript", this.defaultLoadScript);
this.app(str, "set defaultStructureDssp " + this.defaultStructureDSSP);
var sMode = this.vwr.getDefaultVdwNameOrData(-2147483648, null, null);
this.app(str, "set defaultVDW " + sMode);
if (sMode.equals("User")) this.app(str, this.vwr.getDefaultVdwNameOrData(2147483647, null, null));
this.app(str, "set forceAutoBond " + this.forceAutoBond);
this.app(str, "#set defaultDirectory " + JU.PT.esc(this.defaultDirectory));
this.app(str, "#set loadFormat " + JU.PT.esc(this.loadFormat));
this.app(str, "#set loadLigandFormat " + JU.PT.esc(this.pdbLoadLigandFormat));
this.app(str, "#set smilesUrlFormat " + JU.PT.esc(this.smilesUrlFormat));
this.app(str, "#set nihResolverFormat " + JU.PT.esc(this.nihResolverFormat));
this.app(str, "#set pubChemFormat " + JU.PT.esc(this.pubChemFormat));
this.app(str, "set bondingVersion " + this.bondingVersion);
this.app(str, "set legacyAutoBonding " + this.legacyAutoBonding);
this.app(str, "set legacyAutoBonding " + this.legacyAutoBonding);
this.app(str, "set legacyHAddition " + this.legacyHAddition);
this.app(str, "set legacyJavaFloat " + this.legacyJavaFloat);
this.app(str, "set minBondDistance " + this.minBondDistance);
this.app(str, "set minimizationCriterion  " + this.minimizationCriterion);
this.app(str, "set minimizationSteps  " + this.minimizationSteps);
this.app(str, "set multipleBondBananas false");
this.app(str, "set pdbAddHydrogens " + (htParams != null && htParams.get("pdbNoHydrogens") !== Boolean.TRUE ? this.pdbAddHydrogens : false));
this.app(str, "set pdbGetHeader " + this.pdbGetHeader);
this.app(str, "set pdbSequential " + this.pdbSequential);
this.app(str, "set percentVdwAtom " + this.percentVdwAtom);
this.app(str, "set smallMoleculeMaxAtoms " + this.smallMoleculeMaxAtoms);
this.app(str, "set smartAromatic " + this.smartAromatic);
if (this.zeroBasedXyzRasmol) this.app(str, "set zeroBasedXyzRasmol true");
return str.toString();
}, "java.util.Map");
Clazz_defineMethod(c$, "app", 
function(s, cmd){
if (cmd.length == 0) return;
s.append("  ").append(cmd).append(";\n");
}, "JU.SB,~S");
Clazz_defineMethod(c$, "setCIR", 
function(template, notify){
if (template == null || template.equals(this.nihResolverFormat) && this.smilesUrlFormat != null) return;
var pt = template.indexOf("/structure");
if (pt > 0) {
this.nihResolverFormat = template.substring(0, pt + 10);
this.smilesUrlFormat = this.nihResolverFormat + "/%FILE/file?format=sdf&get3d=true";
if (notify) JU.Logger.info("CIR resolver set to " + this.nihResolverFormat + " template=" + template);
}}, "~S,~B");
c$.unreportedProperties = (";ambientpercent;animationfps;antialiasdisplay;antialiasimages;antialiastranslucent;appendnew;axescolor;axesposition;axesmolecular;axesorientationrasmol;axesunitcell;axeswindow;axis1color;axis2color;axis3color;backgroundcolor;backgroundmodel;bondsymmetryatoms;boundboxcolor;cameradepth;bondingversion;ciprule6full;contextdepthmax;debug;debugscript;defaultlatttice;defaults;defaultdropscript;diffusepercent;;exportdrivers;exportscale;_filecaching;_filecache;fontcaching;fontscaling;forcefield;language;hbondsDistanceMaximum;hbondsangleminimum;jmolinJSV;legacyautobonding;legacyhaddition;legacyjavafloat;loglevel;logfile;loggestures;logcommands;measurestylechime;loadformat;loadligandformat;macrodirectory;mkaddhydrogens;minimizationmaxatoms;smilesurlformat;pubchemformat;nihresolverformat;edsurlformat;edsurlcutoff;multiprocessor;navigationmode;;nodelay;pathforallfiles;perspectivedepth;phongexponent;perspectivemodel;platformspeed;preservestate;refreshing;repaintwaitms;rotationradius;selectallmodels;showaxes;showaxis1;showaxis2;showaxis3;showboundbox;showfrank;showtiming;showunitcell;slabenabled;slab;slabrange;depth;zshade;zshadepower;specular;specularexponent;specularpercent;celshading;celshadingpower;specularpower;stateversion;statusreporting;stereo;stereostate;vibrationperiod;unitcellcolor;visualrange;windowcentered;zerobasedxyzrasmol;zoomenabled;mousedragfactor;mousewheelfactor;scriptqueue;scriptreportinglevel;syncscript;syncmouse;syncstereo;defaultdirectory;currentlocalpath;defaultdirectorylocal;ambient;bonds;colorrasmol;diffuse;fractionalrelative;frank;hetero;hidenotselected;hoverlabel;hydrogen;languagetranslation;measurementunits;navigationdepth;navigationslab;picking;pickingstyle;propertycolorscheme;radius;rgbblue;rgbgreen;rgbred;scaleangstromsperinch;selectionhalos;showscript;showselections;solvent;strandcount;spinx;spiny;spinz;spinfps;navx;navy;navz;navfps;" + J.c.CBK.getNameList() + ";undo;undoauto;undomax;atompicking;drawpicking;bondpicking;pickspinrate;picklabel" + ";modelkitmode;autoplaymovie;allowaudio;allowgestures;allowkeystrokes;allowmultitouch;allowmodelkit" + ";dodrop;hovered;historylevel;imagestate;iskiosk;useminimizationthread" + ";checkcir;resolverresolver;showkeystrokes;saveproteinstructurestate;testflag1;testflag2;testflag3;testflag4" + ";selecthetero;selecthydrogen" + ";pointgrouplineartolerance;pointgroupdistancetolerance" + ";minimizationreportsteps;labelkey;elementkey;symmetryhermannmauguin;mode2d" + ";percentVdwAtom;").toLowerCase();
});
;//5.0.1-v7 Mon Aug 24 10:01:38 CDT 2026
Clazz_declarePackage("JV");
Clazz_load(["java.util.Hashtable", "JU.SB", "$.V3", "JU.Elements"], "JV.JC", ["JU.PT", "J.i18n.GT", "JU.Logger"], function(){
var c$ = Clazz_declareType(JV, "JC", null);
c$.getNBOTypeFromName = Clazz_defineMethod(c$, "getNBOTypeFromName", 
function(nboType){
var pt = ";AO;;;;PNAO;;NAO;;;PNHO;;NHO;;;PNBO;;NBO;;;PNLMO;NLMO;;MO;;;;NO;;;;;;;;;;PRNBO;RNBO;;;;;;;;".indexOf(";" + nboType + ";");
return (pt < 0 ? pt : Clazz_doubleToInt(pt / 6) + 31);
}, "~S");
c$.getCIPChiralityName = Clazz_defineMethod(c$, "getCIPChiralityName", 
function(flags){
switch (flags) {
case 13:
return "Z";
case 5:
return "z";
case 14:
return "E";
case 6:
return "e";
case 17:
return "M";
case 18:
return "P";
case 1:
return "R";
case 2:
return "S";
case 9:
return "r";
case 10:
return "s";
case 25:
return "m";
case 26:
return "p";
case 7:
return "?";
case 3:
case 0:
default:
return "";
}
}, "~N");
c$.getCIPRuleName = Clazz_defineMethod(c$, "getCIPRuleName", 
function(i){
return JV.JC.ruleNames[i];
}, "~N");
c$.getCIPChiralityCode = Clazz_defineMethod(c$, "getCIPChiralityCode", 
function(c){
switch ((c).charCodeAt(0)) {
case 90:
return 13;
case 122:
return 5;
case 69:
return 14;
case 101:
return 6;
case 82:
return 1;
case 83:
return 2;
case 114:
return 9;
case 115:
return 10;
case 63:
return 7;
default:
return 0;
}
}, "~S");
c$.isLikelyPDB = Clazz_defineMethod(c$, "isLikelyPDB", 
function(type){
var pt = type.indexOf(":");
if (pt > 0) type = type.substring(0, pt);
return JU.PT.isOneOf(type, ";MMCif;MMTF;BCIF;Pdb;Pqr;P2n;JmolData;PyMOL;");
}, "~S");
c$.fixOptimadeCall = Clazz_defineMethod(c$, "fixOptimadeCall", 
function(url){
var pt = url.indexOf("response_fields=") + 16;
var a = ",chemical_formula_descriptive,dimension_types,lattice_vectors,cartesian_site_positions,species_at_sites,species,";
if (pt < 16) {
var ptQ = url.indexOf("?");
url += (ptQ < 0 ? "?" : "&") + "response_fields=" + a.substring(1, a.length - 1);
} else {
var fields = "," + url.substring(pt, (url + "&").indexOf('&', pt)) + ",";
var flen = fields.length;
for (var i = 0, b = 0; i >= 0; i = b) {
b = a.indexOf(',', i + 1);
if (b < 0) break;
var k = a.substring(i, b + 1);
if (fields.indexOf(k) < 0) {
fields += k.substring(1);
}}
url = url.substring(0, pt) + fields.substring(1, fields.length - 1) + url.substring(pt + flen - 2);
}return url;
}, "~S");
c$.resolveDataBase = Clazz_defineMethod(c$, "resolveDataBase", 
function(database, id, format){
if (format == null) {
if ((format = JV.JC.databases.get(database.toLowerCase())) == null) return null;
var pt = id.indexOf("/");
if (pt < 0) {
if (database.equals("pubchem")) id = "name/" + id;
 else if (database.equals("nci")) id += "/file?format=sdf&get3d=true";
}if (format.startsWith("'")) {
pt = id.indexOf(".");
var n = (pt > 0 ? JU.PT.parseInt(id.substring(pt + 1)) : 0);
if (pt > 0) id = id.substring(0, pt);
format = JU.PT.rep(format, "%n", "" + n);
}} else if (id.indexOf(".") >= 0 && format.indexOf("%FILE.") >= 0) {
format = format.substring(0, format.indexOf("%FILE"));
}if (format.indexOf("%c") >= 0) for (var i = 1, n = id.length; i <= n; i++) if (format.indexOf("%c" + i) >= 0) format = JU.PT.rep(format, "%c" + i, id.substring(i - 1, i).toLowerCase());

return (format.indexOf("%FILE") >= 0 ? JU.PT.rep(format, "%FILE", id) : format.indexOf("%file") >= 0 ? JU.PT.rep(format, "%file", id.toLowerCase()) : format + id);
}, "~S,~S,~S");
c$.fixProtocol = Clazz_defineMethod(c$, "fixProtocol", 
function(name){
var isHttp = (name != null && name.indexOf("http") >= 0);
var newname = (name == null || !isHttp ? name : name.indexOf("http://www.rcsb.org/pdb/files/") == 0 ? JV.JC.resolveDataBase(name.indexOf("/ligand/") >= 0 ? "ligand" : "pdb", name.substring(name.lastIndexOf("/") + 1), null) : name.indexOf("http://www.ebi") == 0 || name.indexOf("http://rruff") == 0 || name.indexOf("http://pubchem") == 0 || name.indexOf("http://cactus") == 0 || name.indexOf("http://www.materialsproject") == 0 ? "https://" + name.substring(7) : name.indexOf("optimade") > 0 ? JV.JC.fixOptimadeCall(name) : name);
if (newname !== name) JU.Logger.info("JC.fixProtocol " + name + " --> " + newname);
return newname;
}, "~S");
c$.embedScript = Clazz_defineMethod(c$, "embedScript", 
function(s){
return "\n/**" + "**** Jmol Embedded Script ****" + " \n" + s + "\n**/";
}, "~S");
c$.getShapeVisibilityFlag = Clazz_defineMethod(c$, "getShapeVisibilityFlag", 
function(shapeID){
return 16 << Math.min(shapeID, 26);
}, "~N");
c$.shapeTokenIndex = Clazz_defineMethod(c$, "shapeTokenIndex", 
function(tok){
switch (tok) {
case 1153433601:
case 1073741859:
return 0;
case 1677721602:
case 659488:
return 1;
case 1613238294:
return 2;
case 1611141176:
return 3;
case 659482:
return 4;
case 1825200146:
return 5;
case 1745489939:
case 537006096:
return 6;
case 1112152076:
return 7;
case 1112152070:
return 8;
case 1114249217:
return 9;
case 1112152078:
return 10;
case 1112152066:
return 11;
case 1649022989:
return 12;
case 1112152071:
return 13;
case 1112152073:
return 14;
case 1112152074:
return 15;
case 1112150019:
return 16;
case 135175:
return 17;
case 135198:
return 18;
case 1112150021:
return 19;
case 1112150020:
return 20;
case 1275203608:
return 21;
case 135174:
return 23;
case 135176:
return 22;
case 135180:
return 24;
case 134353926:
return 25;
case 135182:
return 26;
case 1073877010:
return 27;
case 1073877011:
return 28;
case 135188:
return 29;
case 135190:
return 30;
case 537022465:
return 31;
case 1611272194:
return 34;
case 1812599299:
return 32;
case 1814695966:
return 33;
case 544771:
return 35;
case 1611272202:
return 36;
}
return -1;
}, "~N");
c$.getShapeClassName = Clazz_defineMethod(c$, "getShapeClassName", 
function(shapeID, isRenderer){
if (shapeID < 0) return JV.JC.shapeClassBases[~shapeID];
return "J." + (isRenderer ? "render" : "shape") + (shapeID >= 9 && shapeID < 16 ? "bio." : shapeID >= 16 && shapeID < 23 ? "special." : shapeID >= 24 && shapeID < 30 ? "surface." : shapeID == 23 ? "cgo." : ".") + JV.JC.shapeClassBases[shapeID];
}, "~N,~B");
c$.getEchoName = Clazz_defineMethod(c$, "getEchoName", 
function(type){
return JV.JC.echoNames[type];
}, "~N");
c$.setZPosition = Clazz_defineMethod(c$, "setZPosition", 
function(offset, pos){
return (offset & -49) | pos;
}, "~N,~N");
c$.setPointer = Clazz_defineMethod(c$, "setPointer", 
function(offset, pointer){
return (offset & -4) | pointer;
}, "~N,~N");
c$.getPointer = Clazz_defineMethod(c$, "getPointer", 
function(offset){
return offset & 3;
}, "~N");
c$.getPointerName = Clazz_defineMethod(c$, "getPointerName", 
function(pointer){
return ((pointer & 1) == 0 ? "" : (pointer & 2) > 0 ? "background" : "on");
}, "~N");
c$.isOffsetAbsolute = Clazz_defineMethod(c$, "isOffsetAbsolute", 
function(offset){
return ((offset & 64) != 0);
}, "~N");
c$.getOffset = Clazz_defineMethod(c$, "getOffset", 
function(xOffset, yOffset, isAbsolute){
xOffset = Math.min(Math.max(xOffset, -500), 500);
yOffset = (Math.min(Math.max(yOffset, -500), 500));
var offset = ((xOffset & 1023) << 21) | ((yOffset & 1023) << 11) | (isAbsolute ? 64 : 0);
if (offset == 8396800) offset = 0;
 else if (!isAbsolute && (xOffset == 0 || yOffset == 0)) offset |= 256;
return offset;
}, "~N,~N,~B");
c$.getXOffset = Clazz_defineMethod(c$, "getXOffset", 
function(offset){
if (offset == 0) return 4;
var x = (offset >> 21) & 1023;
x = (x > 500 ? x - 1023 - 1 : x);
return x;
}, "~N");
c$.getYOffset = Clazz_defineMethod(c$, "getYOffset", 
function(offset){
if (offset == 0) return 4;
var y = (offset >> 11) & 1023;
return (y > 500 ? y - 1023 - 1 : y);
}, "~N");
c$.getAlignment = Clazz_defineMethod(c$, "getAlignment", 
function(offset){
return (offset & 12);
}, "~N");
c$.setHorizAlignment = Clazz_defineMethod(c$, "setHorizAlignment", 
function(offset, hAlign){
return (offset & -13) | hAlign;
}, "~N,~N");
c$.getHorizAlignmentName = Clazz_defineMethod(c$, "getHorizAlignmentName", 
function(align){
return JV.JC.hAlignNames[(align >> 2) & 3];
}, "~N");
c$.isSmilesCanonical = Clazz_defineMethod(c$, "isSmilesCanonical", 
function(options){
return (options != null && JU.PT.isOneOf(options.toLowerCase(), ";/cactvs///;/cactus///;/nci///;/canonical///;"));
}, "~S");
c$.getServiceCommand = Clazz_defineMethod(c$, "getServiceCommand", 
function(script){
return (script.length < 7 ? -1 : ("JSPECVIPEAKS: SELECT:JSVSTR:H1SIMULC13SIMUNBO:MODNBO:RUNNBO:VIENBO:SEANBO:CONNONESIM").indexOf(script.substring(0, 7).toUpperCase()));
}, "~S");
c$.getUnitIDFlags = Clazz_defineMethod(c$, "getUnitIDFlags", 
function(type){
var i = 14;
if (type.indexOf("-") == 0) {
if (type.indexOf("m") > 0) i |= 1;
if (type.indexOf("a") < 0) i ^= 4;
if (type.indexOf("t") > 0) i |= 16;
}return i;
}, "~S");
c$.getBoolName = Clazz_defineMethod(c$, "getBoolName", 
function(g){
return JV.JC.globalBooleans[g];
}, "~N");
c$.isSpaceGroupInfoKey = Clazz_defineMethod(c$, "isSpaceGroupInfoKey", 
function(key){
key = key.toLowerCase();
return (key.indexOf("nitcell") >= 0 || key.equals("coordinatesarerractional") || key.startsWith("spacegroup") || key.startsWith("ssg") || key.indexOf("ymmet") >= 0 || key.startsWith("f2c") || key.startsWith("lattice") || key.startsWith("intltable"));
}, "~S");
c$.getMenuScript = Clazz_defineMethod(c$, "getMenuScript", 
function(type){
if (type === "openPDB") {
return "var x__id__ = _modelTitle; if (x__id__.length != 4) { x__id__ = '1crn'};x__id__ = prompt('" + J.i18n.GT.$("Enter a four-digit PDB model ID or \"=\" and a three-digit ligand ID") + "',x__id__);if (!x__id__ || x__id__=='null') { quit }; load @{'=' + x__id__}";
}if (type === "openMOL") {
return "var x__id__ = _smilesString; if (!x__id__) { x__id__ = 'tylenol'};x__id__ = prompt('" + J.i18n.GT.$("Enter the name or identifier (SMILES, InChI, CAS) of a compound. Preface with \":\" to load from PubChem; otherwise Jmol will use the NCI/NIH Resolver.") + "',x__id__);if (!x__id__ || x__id__=='null') { quit }; load @{(x__id__[1]==':' ? x__id__ : '$' + x__id__)}";
}return null;
}, "~S");
c$.axisLabels =  Clazz_newArray(-1, ["+X", "+Y", "+Z", null, null, null, "a", "b", "c", "X", "Y", "Z", null, null, null, "X", null, "Z", null, "(Y)", null, "u", "v", "w"]);
c$.axesTypes =  Clazz_newArray(-1, ["a", "b", "c", "x", "y", "z", "u", "v", "w"]);
c$.ruleNames =  Clazz_newArray(-1, ["", "1a", "1b", "2", "3", "4a", "4b", "4c", "5", "6"]);
c$.databaseArray =  Clazz_newArray(-1, ["itatable", "https://www.cryst.ehu.es/cgi-bin/cryst/programs/nph-getgen?gnum=%FILE&what=gp&list=Standard%2FDefault+Setting", "itadiagramita", "https://onlinelibrary.wiley.com/iucr/itc/Ac/ch2o3v0001/sgtable2o3o%FILE", "itadiagram", "http://img.chem.ucl.ac.uk/sgp/large/%FILEaz1.htm", "aflowbin", "http://aflowlib.mems.duke.edu/users/jmolers/binary_new/%FILE.aflow_binary", "aflowlib", "https://raw.githubusercontent.com/aflow-org/aflow_prototype_encyclopedia/refs/heads/main/data/%FILE/aflow.cif", "aflowpro", "$aflowlib", "ams", "'https://www.rruff.net/AMS/jsmol_search.php?'+(0+'%file'==0? 'mineral':'id')+'=%file&filetype=cif#_DOCACHE_'", "dssr", "https://jmol.x3dna-dssr.org/report.php?id=%FILE", "dssrModel", "https://jmol.x3dna-dssr.org/report.php?POST?&model=", "iucr", "http://scripts.iucr.org/cgi-bin/sendcif_yard?%FILE", "cod", "http://www.crystallography.net/cod/cif/%c1/%c2%c3/%c4%c5/%FILE.cif", "nmr", "https://www.nmrdb.org/new_predictor?POST?molfile=", "nmrdb", "https://www.nmrdb.org/service/predictor?POST?molfile=", "nmrdb13", "https://www.nmrdb.org/service/jsmol13c?POST?molfile=", "magndata", "http://webbdcrista1.ehu.es/magndata/mcif/%FILE.mcif", "rna3d", "http://rna.bgsu.edu/rna3dhub/%TYPE/download/%FILE", "mmtf", "https://mmtf.rcsb.org/v1.0/full/%FILE", "bcif", "https://models.rcsb.org/%file.bcif", "chebi", "https://www.ebi.ac.uk/chebi/saveStructure.do?defaultImage=true&chebiId=%file%2D%", "ligand", "https://files.rcsb.org/ligands/download/%FILE.cif", "nci", "https://cactus.nci.nih.gov/chemical/structure/", "pdb", "https://files.rcsb.org/download/%FILE.pdb", "pdb0", "https://files.rcsb.org/download/%FILE.pdb", "pdbe", "https://www.ebi.ac.uk/pdbe/entry-files/download/%file.cif", "pdbe2", "https://www.ebi.ac.uk/pdbe/static/entry/%file_updated.cif", "pubchem", "https://pubchem.ncbi.nlm.nih.gov/rest/pug/compound/%FILE/SDF?record_type=3d", "map", "https://www.ebi.ac.uk/pdbe/api/%TYPE/%FILE?pretty=false&metadata=true", "pdbemap", "https://www.ebi.ac.uk/pdbe/coordinates/files/%file.ccp4", "pdbemapdiff", "https://www.ebi.ac.uk/pdbe/coordinates/files/%file_diff.ccp4", "pdbemapserver", "https://www.ebi.ac.uk/pdbe/volume-server/x-ray/%file/box/0,0,0/0,0,0?detail=6&space=cartesian&encoding=bcif", "pdbemapdiffserver", "https://www.ebi.ac.uk/pdbe/volume-server/x-ray/%file/box/0,0,0/0,0,0?detail=6&space=cartesian&encoding=bcif&diff=1", "emdbmap", "https://www.ebi.ac.uk/pdbe/volume-server/emd/emd-%file/cell?detail=6&space=cartesian&encoding=bcif", "emdbquery", "https://www.ebi.ac.uk/emdb/api/search/fitted_pdbs:%file?fl=emdb_id,map_contour_level_value&wt=csv", "emdbmapserver", "https://www.ebi.ac.uk/pdbe/volume-server/emd/emd-%file/box/0,0,0/0,0,0?detail=6&space=cartesian&encoding=bcif", "xxxresolverResolver", "https://chemapps.stolaf.edu/resolver", "smiles2d", "https://cactus.nci.nih.gov/chemical/structure/%FILE/file?format=sdf&operator=remove_hydrogens", "smiles3d", "https://cactus.nci.nih.gov/chemical/structure//%FILE/file?format=sdf&get3d=true"]);
c$.databases =  new java.util.Hashtable();
{
for (var i = 0; i < JV.JC.databaseArray.length; i += 2) {
var target = JV.JC.databaseArray[i + 1];
if (target.charAt(0) == '$') {
target = JV.JC.databases.get(target.substring(1));
}JV.JC.databases.put(JV.JC.databaseArray[i].toLowerCase(), target);
}
}c$.majorVersion = null;
{
var tmpVersion = null;
var tmpDate = null;
{
tmpVersion = Jmol.___JmolVersion; tmpDate = Jmol.___JmolDate;
}if (tmpDate != null) {
tmpDate = tmpDate.substring(7, 23);
}JV.JC.version = (tmpVersion != null ? tmpVersion : "(Unknown_version)");
JV.JC.majorVersion = (tmpVersion != null ? tmpVersion : "(Unknown_version)");
JV.JC.date = (tmpDate != null ? tmpDate : "(Unknown_date)");
var v = -1;
try {
var s = JV.JC.version;
var major = "";
var i = s.indexOf(".");
if (i < 0) {
v = 100000 * Integer.parseInt(s);
s = null;
}if (s != null) {
v = 100000 * Integer.parseInt(major = s.substring(0, i));
s = s.substring(i + 1);
i = s.indexOf(".");
if (i < 0) {
v += 1000 * Integer.parseInt(s);
s = null;
}if (s != null) {
var m = s.substring(0, i);
major += "." + m;
JV.JC.majorVersion = major;
v += 1000 * Integer.parseInt(m);
s = s.substring(i + 1);
i = s.indexOf("_");
if (i >= 0) s = s.substring(0, i);
i = s.indexOf(" ");
if (i >= 0) s = s.substring(0, i);
v += Integer.parseInt(s);
}}} catch (e) {
if (Clazz_exceptionOf(e,"NumberFormatException")){
} else {
throw e;
}
}
JV.JC.versionInt = v;
}c$.center = JU.V3.new3(0, 0, 0);
c$.axisX = JU.V3.new3(1, 0, 0);
c$.axisY = JU.V3.new3(0, 1, 0);
c$.axisZ = JU.V3.new3(0, 0, 1);
c$.axisNX = JU.V3.new3(-1, 0, 0);
c$.axisNY = JU.V3.new3(0, -1, 0);
c$.axisNZ = JU.V3.new3(0, 0, -1);
c$.unitAxisVectors =  Clazz_newArray(-1, [JV.JC.axisX, JV.JC.axisY, JV.JC.axisZ, JV.JC.axisNX, JV.JC.axisNY, JV.JC.axisNZ]);
c$.altArgbsCpk =  Clazz_newIntArray(-1, [0xFFFF1493, 0xFFBFA6A6, 0xFFFFFF30, 0xFF57178F, 0xFFFFFFC0, 0xFFFFFFA0, 0xFFD8D8D8, 0xFF505050, 0xFF404040, 0xFF105050]);
c$.FORMAL_CHARGE_COLIX_RED = JU.Elements.elementSymbols.length + JV.JC.altArgbsCpk.length;
c$.argbsFormalCharge =  Clazz_newIntArray(-1, [0xFFFF0000, 0xFFFF4040, 0xFFFF8080, 0xFFFFC0C0, 0xFFFFFFFF, 0xFFD8D8FF, 0xFFB4B4FF, 0xFF9090FF, 0xFF6C6CFF, 0xFF4848FF, 0xFF2424FF, 0xFF0000FF]);
c$.PARTIAL_CHARGE_COLIX_RED = JV.JC.FORMAL_CHARGE_COLIX_RED + JV.JC.argbsFormalCharge.length;
c$.argbsRwbScale =  Clazz_newIntArray(-1, [0xFFFF0000, 0xFFFF1010, 0xFFFF2020, 0xFFFF3030, 0xFFFF4040, 0xFFFF5050, 0xFFFF6060, 0xFFFF7070, 0xFFFF8080, 0xFFFF9090, 0xFFFFA0A0, 0xFFFFB0B0, 0xFFFFC0C0, 0xFFFFD0D0, 0xFFFFE0E0, 0xFFFFFFFF, 0xFFE0E0FF, 0xFFD0D0FF, 0xFFC0C0FF, 0xFFB0B0FF, 0xFFA0A0FF, 0xFF9090FF, 0xFF8080FF, 0xFF7070FF, 0xFF6060FF, 0xFF5050FF, 0xFF4040FF, 0xFF3030FF, 0xFF2020FF, 0xFF1010FF, 0xFF0000FF]);
c$.PARTIAL_CHARGE_RANGE_SIZE = JV.JC.argbsRwbScale.length;
c$.argbsRoygbScale =  Clazz_newIntArray(-1, [0xFFFF0000, 0xFFFF2000, 0xFFFF4000, 0xFFFF6000, 0xFFFF8000, 0xFFFFA000, 0xFFFFC000, 0xFFFFE000, 0xFFFFF000, 0xFFFFFF00, 0xFFF0F000, 0xFFE0FF00, 0xFFC0FF00, 0xFFA0FF00, 0xFF80FF00, 0xFF60FF00, 0xFF40FF00, 0xFF20FF00, 0xFF00FF00, 0xFF00FF20, 0xFF00FF40, 0xFF00FF60, 0xFF00FF80, 0xFF00FFA0, 0xFF00FFC0, 0xFF00FFE0, 0xFF00FFFF, 0xFF00E0FF, 0xFF00C0FF, 0xFF00A0FF, 0xFF0080FF, 0xFF0060FF, 0xFF0040FF, 0xFF0020FF, 0xFF0000FF]);
c$.predefinedVariable =  Clazz_newArray(-1, ["@_1H _H & !(_2H,_3H)", "@_12C _C & !(_13C,_14C)", "@_14N _N & !(_15N)", "@solvent water, (_g>=45 & _g<48)", "@ligand _g=0|!(_g<46,protein,nucleic,water)", "@turn structure=1", "@sheet structure=2", "@helix structure=3", "@helix310 substructure=7", "@helixalpha substructure=8", "@helixpi substructure=9", "@magnetic vxyz>0", "@bulges within(dssr,'bulges')", "@coaxStacks within(dssr,'coaxStacks')", "@hairpins within(dssr,'hairpins')", "@hbonds within(dssr,'hbonds')", "@helices within(dssr,'helices')", "@iloops within(dssr,'iloops')", "@isoCanonPairs within(dssr,'isoCanonPairs')", "@junctions within(dssr,'junctions')", "@kissingLoops within(dssr,'kissingLoops')", "@multiplets within(dssr,'multiplets')", "@nonStack within(dssr,'nonStack')", "@nts within(dssr,'nts')", "@pairs within(dssr,'pairs')", "@ssSegments within(dssr,'ssSegments')", "@stacks within(dssr,'stacks')", "@stems within(dssr,'stems')"]);
c$.predefinedStatic =  Clazz_newArray(-1, ["@amino _g>0 & _g<=23", "@acidic asp,glu", "@basic arg,his,lys", "@charged acidic,basic", "@negative acidic", "@positive basic", "@neutral amino&!(acidic,basic)", "@polar amino&!hydrophobic", "@peptide protein&within(chain,monomer>1)&!within(chain,monomer>12)", "@cyclic his,phe,pro,trp,tyr", "@acyclic amino&!cyclic", "@aliphatic ala,gly,ile,leu,val", "@aromatic his,phe,trp,tyr", "@cystine within(group,(cys,cyx)&atomname=sg&connected((cys,cyx)&atomname=sg))", "@buried ala,cys,ile,leu,met,phe,trp,val", "@surface amino&!buried", "@hydrophobic ala,gly,ile,leu,met,phe,pro,trp,tyr,val", "@mainchain backbone", "@small ala,gly,ser", "@medium asn,asp,cys,pro,thr,val", "@large arg,glu,gln,his,ile,leu,lys,met,phe,trp,tyr", "@c nucleic & ([C] or [DC] or within(group,_a=42))", "@g nucleic & ([G] or [DG] or within(group,_a=43))", "@cg c,g", "@a nucleic & ([A] or [DA] or within(group,_a=44))", "@t nucleic & ([T] or [DT] or within(group,_a=45 | _a=49))", "@at a,t", "@i nucleic & ([I] or [DI] or within(group,_a=46) & !g)", "@u nucleic & ([U] or [DU] or within(group,_a=47) & !t)", "@tu nucleic & within(group,_a=48)", "@ions _g>=46&_g<48", "@alpha _a=2", "@_bb protein&(_a>=1&_a<6|_a=64) | nucleic&(_a>=6&_a<14|_a>=73&&_a<=79||_a==99||_a=100)", "@backbone _bb | _H && connected(single, _bb)", "@spine protein&_a>=1&_a<4|nucleic&(_a>=6&_a<11|_a=13)", "@sidechain (protein,nucleic) & !backbone", "@base nucleic & !backbone", "@dynamic_flatring search('[a]')", "@nonmetal _H,_He,_B,_C,_N,_O,_F,_Ne,_Si,_P,_S,_Cl,_Ar,_As,_Se,_Br,_Kr,_Te,_I,_Xe,_At,_Rn", "@metal !nonmetal && !_Xx", "@alkaliMetal _Li,_Na,_K,_Rb,_Cs,_Fr", "@alkalineEarth _Be,_Mg,_Ca,_Sr,_Ba,_Ra", "@nobleGas _He,_Ne,_Ar,_Kr,_Xe,_Rn", "@metalloid _B,_Si,_Ge,_As,_Sb,_Te", "@transitionMetal elemno>=21&elemno<=30|elemno=57|elemno=89|elemno>=39&elemno<=48|elemno>=72&elemno<=80|elemno>=104&elemno<=112", "@lanthanide elemno>57&elemno<=71", "@actinide elemno>89&elemno<=103"]);
c$.shapeClassBases =  Clazz_newArray(-1, ["Balls", "Sticks", "Hsticks", "Sssticks", "Struts", "Labels", "Measures", "Stars", "Halos", "Backbone", "Trace", "Cartoon", "Strands", "MeshRibbon", "Ribbons", "Rockets", "Dots", "Dipoles", "Vectors", "GeoSurface", "Ellipsoids", "Polyhedra", "Draw", "CGO", "Isosurface", "Contact", "LcaoCartoon", "MolecularOrbital", "NBO", "Pmesh", "Plot3D", "Echo", "Bbcage", "Uccage", "Axes", "Hover", "Frank"]);
{
{
}}c$.echoNames =  Clazz_newArray(-1, ["top", "bottom", "middle", "xy", "xyz"]);
c$.hAlignNames =  Clazz_newArray(-1, ["", "left", "center", "right"]);
c$.globalBooleans =  Clazz_newArray(-1, ["someModelsHaveFractionalCoordinates", "someModelsHaveSymmetry", "someModelsHaveUnitcells", "someModelsHaveCONECT", "isPDB", "someModelsHaveDomains", "someModelsHaveValidations", "isSupercell", "someModelsHaveAromaticBonds", "someModelsAreModulated"]);
});
;//5.0.1-v7 Mon Aug 24 10:19:01 CDT 2026
Clazz_declarePackage("JV");
Clazz_load(["java.io.IOException"], "JV.JmolAsyncException", null, function(){
var c$ = Clazz_decorateAsClass(function(){
this.fileName = null;
Clazz_instantialize(this, arguments);}, JV, "JmolAsyncException", java.io.IOException);
Clazz_makeConstructor(c$, 
function(cacheName){
Clazz_superConstructor (this, JV.JmolAsyncException, []);
this.fileName = cacheName;
}, "~S");
Clazz_defineMethod(c$, "getFileName", 
function(){
return this.fileName;
});
});
;//5.0.1-v7 Mon Aug 17 10:07:10 MDT 2026
Clazz_declarePackage("JV");
Clazz_load(null, "JV.ModelManager", ["JM.ModelLoader"], function(){
var c$ = Clazz_decorateAsClass(function(){
this.vwr = null;
this.modelSet = null;
this.modelSetPathName = null;
this.fileName = null;
Clazz_instantialize(this, arguments);}, JV, "ModelManager", null);
Clazz_makeConstructor(c$, 
function(vwr){
this.vwr = vwr;
}, "JV.Viewer");
Clazz_defineMethod(c$, "zap", 
function(){
this.modelSetPathName = this.fileName = null;
 new JM.ModelLoader(this.vwr, this.vwr.getZapName(), null, null, null, null);
});
Clazz_defineMethod(c$, "createModelSet", 
function(fullPathName, fileName, loadScript, atomSetCollection, bsNew, isAppend){
var modelSetName = null;
if (isAppend) {
modelSetName = this.modelSet.modelSetName;
if (modelSetName.equals("zapped")) modelSetName = null;
 else if (modelSetName.indexOf(" (modified)") < 0) modelSetName += " (modified)";
} else if (atomSetCollection == null) {
this.zap();
} else {
this.modelSetPathName = fullPathName;
this.fileName = fileName;
}if (atomSetCollection != null) {
if (modelSetName == null) {
modelSetName = this.vwr.getModelAdapter().getAtomSetCollectionName(atomSetCollection);
if (modelSetName != null) {
modelSetName = modelSetName.trim();
if (modelSetName.length == 0) modelSetName = null;
}if (modelSetName == null) modelSetName = JV.ModelManager.reduceFilename(fileName);
} new JM.ModelLoader(this.vwr, modelSetName, loadScript, atomSetCollection, (isAppend ? this.modelSet : null), bsNew);
}if (this.modelSet.ac == 0 && !this.modelSet.getMSInfoB("isPyMOL")) this.zap();
}, "~S,~S,JU.SB,~O,JU.BS,~B");
c$.reduceFilename = Clazz_defineMethod(c$, "reduceFilename", 
function(fileName){
if (fileName == null) return null;
var ichDot = fileName.indexOf('.');
if (ichDot > 0) fileName = fileName.substring(0, ichDot);
if (fileName.length > 24) fileName = fileName.substring(0, 20) + " ...";
return fileName;
}, "~S");
Clazz_defineMethod(c$, "createAtomDataSet", 
function(atomSetCollection, tokType){
return JM.ModelLoader.createAtomDataSet(this.vwr, this.modelSet, tokType, atomSetCollection, this.vwr.bsA());
}, "~O,~N");
});
;//5.0.1-v7 Mon Aug 24 10:22:24 CDT 2026
Clazz_declarePackage("JV");
(function(){
var c$ = Clazz_decorateAsClass(function(){
this.x = -1000;
this.y = -1000;
this.modifiers = 0;
this.time = -1;
this.modelIndex = 0;
this.name = null;
this.keybuf = 0;
Clazz_instantialize(this, arguments);}, JV, "MouseState", null);
Clazz_makeConstructor(c$, 
function(name){
this.name = name;
}, "~S");
Clazz_defineMethod(c$, "setModelIndex", 
function(modelIndex){
this.modelIndex = modelIndex;
}, "~N");
Clazz_defineMethod(c$, "set", 
function(time, x, y, modifiers){
this.time = time;
this.x = x;
this.y = y;
this.modifiers = modifiers;
}, "~N,~N,~N,~N");
Clazz_defineMethod(c$, "setCurrent", 
function(current, clickCount){
this.time = current.time;
if (clickCount < 2) {
this.x = current.x;
this.y = current.y;
}this.modifiers = current.modifiers;
}, "JV.MouseState,~N");
Clazz_defineMethod(c$, "inRange", 
function(xyRange, x, y){
return (Math.abs(this.x - x) <= xyRange && Math.abs(this.y - y) <= xyRange);
}, "~N,~N,~N");
Clazz_defineMethod(c$, "check", 
function(xyRange, x, y, modifiers, time, delayMax){
return (this.modifiers == modifiers && (delayMax >= 2147483647 ? this.inRange(xyRange, x, y) : time - this.time < delayMax && time - this.time > 20));
}, "~N,~N,~N,~N,~N,~N");
Clazz_defineMethod(c$, "is", 
function(current){
return (current.x == this.x && current.y == this.y && current.time == this.time);
}, "JV.MouseState");
})();
;//5.0.1-v7 Mon Aug 17 10:07:10 MDT 2026
Clazz_declarePackage("JV");
Clazz_load(["J.api.JmolSelectionListener", "JU.BS"], "JV.SelectionManager", ["JU.AU", "J.c.PAL", "J.i18n.GT", "JU.BSUtil", "$.C", "$.Escape"], function(){
var c$ = Clazz_decorateAsClass(function(){
this.bsSubset = null;
this.bsDeleted = null;
this.noneSelected = null;
this.bsHidden = null;
this.bsFixed = null;
this.vwr = null;
this.listeners = null;
this.bsSelection = null;
this.empty = 1;
this.hideNotSelected = false;
this.bsTemp = null;
this.colorer = null;
Clazz_instantialize(this, arguments);}, JV, "SelectionManager", null);
Clazz_prepareFields (c$, function(){
this.bsHidden =  new JU.BS();
this.bsFixed =  new JU.BS();
this.bsSelection =  new JU.BS();
this.bsTemp =  new JU.BS();
});
Clazz_makeConstructor(c$, 
function(vwr){
this.vwr = vwr;
this.listeners =  new Array(0);
this.colorer =  new JV.SelectionManager.SelectionColorer(vwr);
this.addListener(this.colorer);
}, "JV.Viewer");
Clazz_defineMethod(c$, "processDeletedModelAtoms", 
function(bsAtoms){
JU.BSUtil.deleteBits(this.bsDeleted, bsAtoms);
JU.BSUtil.deleteBits(this.bsSubset, bsAtoms);
JU.BSUtil.deleteBits(this.bsFixed, bsAtoms);
JU.BSUtil.deleteBits(this.bsHidden, bsAtoms);
var bs = JU.BSUtil.copy(this.bsSelection);
JU.BSUtil.deleteBits(bs, bsAtoms);
this.setSelectionSet(bs, 0);
this.selectionChanged(false);
}, "JU.BS");
Clazz_defineMethod(c$, "clear", 
function(){
this.clearSelection(true);
this.setSelectionSubset(null);
this.hide(null, null, 0, true);
this.bsDeleted = null;
this.setMotionFixedAtoms(null);
});
Clazz_defineMethod(c$, "display", 
function(modelSet, bs, addRemove, isQuiet){
switch (addRemove) {
default:
var bsNotSubset = (this.bsSubset == null ? null : JU.BSUtil.andNot(JU.BSUtil.copy(this.bsHidden), this.bsSubset));
var bsAll = modelSet.getModelAtomBitSetIncludingDeleted(-1, false);
this.bsHidden.or(bsAll);
if (bsNotSubset != null) {
this.bsHidden.and(this.bsSubset);
this.bsHidden.or(bsNotSubset);
}case 1275069441:
if (bs != null) this.bsHidden.andNot(bs);
break;
case 1073742119:
if (bs != null) this.bsHidden.or(bs);
break;
}
JU.BSUtil.andNot(this.bsHidden, this.bsDeleted);
modelSet.setBsHidden(this.bsHidden);
if (!isQuiet) this.vwr.reportSelection(J.i18n.GT.i(J.i18n.GT.$("{0} atoms hidden"), this.bsHidden.cardinality()));
}, "JM.ModelSet,JU.BS,~N,~B");
Clazz_defineMethod(c$, "hide", 
function(modelSet, bs, addRemove, isQuiet){
var bsNotSubset = (addRemove == 0 || this.bsSubset == null ? null : JU.BSUtil.andNot(JU.BSUtil.copy(this.bsHidden), this.bsSubset));
JV.SelectionManager.setBitSet(this.bsHidden, bs, addRemove);
if (bsNotSubset != null) this.bsHidden.or(bsNotSubset);
if (modelSet != null) modelSet.setBsHidden(this.bsHidden);
if (!isQuiet) this.vwr.reportSelection(J.i18n.GT.i(J.i18n.GT.$("{0} atoms hidden"), this.bsHidden.cardinality()));
}, "JM.ModelSet,JU.BS,~N,~B");
Clazz_defineMethod(c$, "setSelectionSet", 
function(set, addRemove){
JV.SelectionManager.setBitSet(this.bsSelection, set, addRemove);
this.empty = -1;
}, "JU.BS,~N");
c$.setBitSet = Clazz_defineMethod(c$, "setBitSet", 
function(bsWhat, bs, addRemove){
switch (addRemove) {
default:
bsWhat.clearAll();
case 1275069441:
if (bs != null) bsWhat.or(bs);
break;
case 1073742119:
if (bs != null) bsWhat.andNot(bs);
break;
}
}, "JU.BS,JU.BS,~N");
Clazz_defineMethod(c$, "getHiddenSet", 
function(){
return this.bsHidden;
});
Clazz_defineMethod(c$, "getHideNotSelected", 
function(){
return this.hideNotSelected;
});
Clazz_defineMethod(c$, "setHideNotSelected", 
function(TF){
this.hideNotSelected = TF;
if (TF) this.selectionChanged(false);
}, "~B");
Clazz_defineMethod(c$, "isSelected", 
function(atomIndex){
return (atomIndex >= 0 && this.bsSelection.get(atomIndex));
}, "~N");
Clazz_defineMethod(c$, "select", 
function(bs, addRemove, isQuiet){
if (bs == null) {
this.selectAll(true);
if (!this.vwr.getBoolean(1612709900)) this.excludeSelectionSet(this.vwr.ms.getAtoms(1612709900, null));
if (!this.vwr.getBoolean(1612709894)) this.excludeSelectionSet(this.vwr.ms.getAtoms(1612709894, null));
} else {
this.setSelectionSet(bs, addRemove);
if (!this.vwr.getBoolean(1612709900)) this.excludeSelectionSet(this.vwr.ms.getAtoms(1612709900, null));
if (!this.vwr.getBoolean(1612709894)) this.excludeSelectionSet(this.vwr.ms.getAtoms(1612709894, null));
}this.selectionChanged(false);
var reportChime = this.vwr.getBoolean(603979879);
if (!reportChime && isQuiet) return;
var n = this.getSelectionCount();
if (reportChime) this.vwr.getChimeMessenger().reportSelection(n);
 else if (!isQuiet) this.vwr.reportSelection(J.i18n.GT.i(J.i18n.GT.$("{0} atoms selected"), n));
}, "JU.BS,~N,~B");
Clazz_defineMethod(c$, "selectAll", 
function(isQuiet){
var count = this.vwr.ms.ac;
this.empty = (count == 0) ? 1 : 0;
for (var i = count; --i >= 0; ) this.bsSelection.set(i);

JU.BSUtil.andNot(this.bsSelection, this.bsDeleted);
this.selectionChanged(isQuiet);
}, "~B");
Clazz_defineMethod(c$, "clearSelection", 
function(isQuiet){
this.setHideNotSelected(false);
this.bsSelection.clearAll();
this.empty = 1;
this.selectionChanged(isQuiet);
}, "~B");
Clazz_defineMethod(c$, "isAtomSelected", 
function(atomIndex){
return ((this.bsSubset == null || this.bsSubset.get(atomIndex)) && this.bsDeleted == null || !this.bsDeleted.get(atomIndex)) && this.bsSelection.get(atomIndex);
}, "~N");
Clazz_defineMethod(c$, "setSelectedAtom", 
function(atomIndex, TF){
if (atomIndex < 0) {
this.selectionChanged(true);
return;
}if (this.bsSubset != null && !this.bsSubset.get(atomIndex) || this.bsDeleted != null && this.bsDeleted.get(atomIndex)) return;
this.bsSelection.setBitTo(atomIndex, TF);
if (TF) this.empty = 0;
 else this.empty = -1;
}, "~N,~B");
Clazz_defineMethod(c$, "setSelectionSubset", 
function(bs){
this.bsSubset = bs;
}, "JU.BS");
Clazz_defineMethod(c$, "isInSelectionSubset", 
function(atomIndex){
return (atomIndex < 0 || this.vwr.am.splitFrame && !this.vwr.am.isSplitFrameSelectable(atomIndex) || this.bsSubset == null || this.bsSubset.get(atomIndex));
}, "~N");
Clazz_defineMethod(c$, "invertSelection", 
function(){
JU.BSUtil.invertInPlace(this.bsSelection, this.vwr.ms.ac);
this.empty = (this.bsSelection.length() > 0 ? 0 : 1);
this.selectionChanged(false);
});
Clazz_defineMethod(c$, "excludeSelectionSet", 
function(setExclude){
if (setExclude == null || this.empty == 1) return;
this.bsSelection.andNot(setExclude);
this.empty = -1;
}, "JU.BS");
Clazz_defineMethod(c$, "getSelectionCount", 
function(){
if (this.empty == 1) return 0;
this.empty = 1;
var bs;
if (this.bsSubset == null) {
bs = this.bsSelection;
} else {
this.bsTemp.clearAll();
this.bsTemp.or(this.bsSubset);
this.bsTemp.and(this.bsSelection);
bs = this.bsTemp;
}var count = bs.cardinality();
if (count > 0) this.empty = 0;
return count;
});
Clazz_defineMethod(c$, "addListener", 
function(listener){
for (var i = this.listeners.length; --i >= 0; ) if (this.listeners[i] === listener) {
this.listeners[i] = null;
break;
}
var len = this.listeners.length;
for (var i = len; --i >= 0; ) if (this.listeners[i] == null) {
this.listeners[i] = listener;
return;
}
if (this.listeners.length == 0) this.listeners =  new Array(1);
 else this.listeners = JU.AU.doubleLength(this.listeners);
this.listeners[len] = listener;
}, "J.api.JmolSelectionListener");
Clazz_defineMethod(c$, "selectionChanged", 
function(isQuiet){
if (this.hideNotSelected) this.hide(this.vwr.ms, JU.BSUtil.copyInvert(this.bsSelection, this.vwr.ms.ac), 0, isQuiet);
if (isQuiet || this.listeners.length == 0) return;
for (var i = this.listeners.length; --i >= 0; ) if (this.listeners[i] != null) this.listeners[i].selectionChanged(this.bsSelection);

}, "~B");
Clazz_defineMethod(c$, "deleteAtoms", 
function(bs){
var bsNew = JU.BSUtil.copy(bs);
if (this.bsDeleted == null) {
this.bsDeleted = bsNew;
} else {
bsNew.andNot(this.bsDeleted);
this.bsDeleted.or(bs);
}this.bsHidden.andNot(this.bsDeleted);
this.bsSelection.andNot(this.bsDeleted);
return bsNew.cardinality();
}, "JU.BS");
Clazz_defineMethod(c$, "getSelectedAtoms", 
function(asCopy){
var bs = (asCopy || this.bsSubset != null ? JU.BSUtil.copy(this.bsSelection) : this.bsSelection);
if (this.bsSubset == null) return bs;
bs.and(this.bsSubset);
return bs;
}, "~B");
Clazz_defineMethod(c$, "getSelectedAtomsNoSubset", 
function(){
return JU.BSUtil.copy(this.bsSelection);
});
Clazz_defineMethod(c$, "excludeAtoms", 
function(bs, ignoreSubset){
if (this.bsDeleted != null) bs.andNot(this.bsDeleted);
if (!ignoreSubset && this.bsSubset != null) (bs = JU.BSUtil.copy(bs)).and(this.bsSubset);
return bs;
}, "JU.BS,~B");
Clazz_defineMethod(c$, "setMotionFixedAtoms", 
function(bs){
this.bsFixed.clearAll();
if (bs != null) this.bsFixed.or(bs);
}, "JU.BS");
Clazz_defineMethod(c$, "getMotionFixedAtoms", 
function(){
return this.bsFixed;
});
Clazz_defineMethod(c$, "setSelectionColors", 
function(colorSelected, colorUnselected, translucency, translucentLevel){
this.colorer.set(colorSelected, colorUnselected, translucency, translucentLevel);
this.vwr.selectStatus(this.getSelectedAtoms(true), false, 0, false, true);
this.colorer.enabled = (colorSelected != null || colorUnselected != null);
}, "Integer,Integer,~S,~N");
Clazz_defineMethod(c$, "getSelectionColors", 
function(){
return (this.colorer.enabled ? this.colorer.toString() : "NULL NULL");
});
/*if3*/;(function(){
var c$ = Clazz_decorateAsClass(function(){
this.enabled = false;
this.colorSelected = null;
this.colorUnselected = null;
this.bsColorSelected = null;
this.bsColorUnselected = null;
this.translucency = null;
this.translucentLevel = null;
this.vwr = null;
Clazz_instantialize(this, arguments);}, JV.SelectionManager, "SelectionColorer", null, J.api.JmolSelectionListener);
Clazz_makeConstructor(c$, 
function(vwr){
this.vwr = vwr;
}, "JV.Viewer");
Clazz_overrideMethod(c$, "selectionChanged", 
function(selection){
if (!this.enabled) return;
var bsAll = this.vwr.getAllAtoms();
JU.BSUtil.copy2(selection, this.bsColorSelected);
JU.BSUtil.copy2(bsAll, this.bsColorUnselected);
this.bsColorUnselected.andNot(this.bsColorSelected);
this.vwr.shm.setShapePropertyBs(0, "color", this.colorSelected, this.bsColorSelected);
this.vwr.shm.setShapePropertyBs(0, "color", this.colorUnselected, this.bsColorUnselected);
if (this.translucency != null) {
this.vwr.shm.setShapePropertyBs(0, "translucency", this.translucency, this.bsColorUnselected);
this.vwr.shm.setShapePropertyBs(0, "translucentLevel", this.translucentLevel, this.bsColorUnselected);
}}, "JU.BS");
Clazz_defineMethod(c$, "colorString", 
function(c, isTranslucent){
if (c == null || c === J.c.PAL.NONE) return "NULL";
var ic = JU.C.getShadedRGB((c).intValue(), (isTranslucent ? this.translucentLevel.doubleValue() : 0));
return "#" + JU.Escape.getHexColorFromRGB(ic);
}, "~O,~B");
Clazz_defineMethod(c$, "set", 
function(colorSelected, colorUnselected, translucency, translucentLevel){
if (this.bsColorSelected == null) {
this.bsColorSelected =  new JU.BS();
this.bsColorUnselected =  new JU.BS();
}this.colorSelected = (colorSelected == null ? J.c.PAL.NONE : colorSelected);
this.colorUnselected = (colorUnselected == null ? J.c.PAL.NONE : colorUnselected);
if (translucentLevel == 1.7976931348623157E308) {
this.translucency = null;
} else {
this.translucency = translucency;
this.translucentLevel = Double.$valueOf(translucentLevel);
}this.enabled = true;
}, "Integer,Integer,~S,~N");
Clazz_overrideMethod(c$, "toString", 
function(){
return this.colorString(this.colorSelected, false) + " " + this.colorString(this.colorUnselected, this.translucency != null);
});
/*eoif3*/})();
});
;//5.0.1-v7 Mon Aug 24 10:01:38 CDT 2026
Clazz_declarePackage("JV");
Clazz_load(null, "JV.ShapeManager", ["JU.BS", "$.P3", "J.api.Interface", "J.c.PAL", "$.VDW", "J.shape.Shape", "JU.BSUtil", "$.C", "JV.JC"], function(){
var c$ = Clazz_decorateAsClass(function(){
this.ms = null;
this.shapes = null;
this.vwr = null;
this.scaleText = null;
this.bsRenderableAtoms = null;
this.bsSlabbedInternal = null;
this.navMinMax = null;
Clazz_instantialize(this, arguments);}, JV, "ShapeManager", null);
Clazz_prepareFields (c$, function(){
this.navMinMax =  Clazz_newIntArray (4, 0);
});
Clazz_makeConstructor(c$, 
function(vwr){
this.vwr = vwr;
this.bsRenderableAtoms =  new JU.BS();
this.bsSlabbedInternal =  new JU.BS();
}, "JV.Viewer");
Clazz_defineMethod(c$, "findNearestShapeAtomIndex", 
function(x, y, closest, bsNot){
if (this.shapes != null) for (var i = 0; i < this.shapes.length && closest[0] == null; ++i) if (this.shapes[i] != null) this.shapes[i].findNearestAtomIndex(x, y, closest, bsNot);

}, "~N,~N,~A,JU.BS");
Clazz_defineMethod(c$, "getShapePropertyIndex", 
function(shapeID, propertyName, index){
if (this.shapes == null || this.shapes[shapeID] == null) return null;
this.vwr.setShapeErrorState(shapeID, "get " + propertyName);
var result = this.shapes[shapeID].getProperty(propertyName, index);
this.vwr.setShapeErrorState(-1, null);
return result;
}, "~N,~S,~N");
Clazz_defineMethod(c$, "getShapePropertyData", 
function(shapeID, propertyName, data){
if (this.shapes == null || this.shapes[shapeID] == null) return false;
this.vwr.setShapeErrorState(shapeID, "get " + propertyName);
var result = this.shapes[shapeID].getPropertyData(propertyName, data);
this.vwr.setShapeErrorState(-1, null);
return result;
}, "~N,~S,~A");
Clazz_defineMethod(c$, "getShapeIdFromObjectName", 
function(objectName){
if (this.shapes != null) for (var i = 16; i < 30; ++i) if (this.shapes[i] != null && this.shapes[i].getIndexFromName(objectName) >= 0) return i;

if (this.shapes[6] != null && this.shapes[6].getIndexFromName(objectName) >= 0) {
return 6;
}return -1;
}, "~S");
Clazz_defineMethod(c$, "loadDefaultShapes", 
function(newModelSet){
this.ms = newModelSet;
if (this.shapes != null) for (var i = 0; i < this.shapes.length; ++i) if (this.shapes[i] != null) this.shapes[i].setModelSet(newModelSet);

this.loadShape(0);
this.loadShape(1);
}, "JM.ModelSet");
Clazz_defineMethod(c$, "loadShape", 
function(shapeID){
if (this.shapes == null) return null;
if (this.shapes[shapeID] != null) return this.shapes[shapeID];
if (shapeID == 2 || shapeID == 3 || shapeID == 4) return null;
var className = JV.JC.getShapeClassName(shapeID, false);
var shape;
if ((shape = J.api.Interface.getInterface(className, this.vwr, "shape")) == null) return null;
this.vwr.setShapeErrorState(shapeID, "allocate");
shape.initializeShape(this.vwr, this.ms, shapeID);
this.vwr.setShapeErrorState(-1, null);
return this.shapes[shapeID] = shape;
}, "~N");
Clazz_defineMethod(c$, "notifyAtomPositionsChanged", 
function(baseModel, bs, mat){
var Imodel = Integer.$valueOf(baseModel);
var bsModelAtoms = this.vwr.getModelUndeletedAtomsBitSet(baseModel);
for (var i = 0; i < 37; i++) if (this.shapes[i] != null) this.setShapePropertyBs(i, "refreshTrajectories",  Clazz_newArray(-1, [Imodel, bs, mat]), bsModelAtoms);

}, "~N,JU.BS,JU.M4");
Clazz_defineMethod(c$, "releaseShape", 
function(shapeID){
if (this.shapes != null) this.shapes[shapeID] = null;
}, "~N");
Clazz_defineMethod(c$, "setScale", 
function(){
if (this.scaleText != null) {
this.loadShape(31);
this.setShapePropertyBs(31, "%SCALE", this.scaleText, null);
this.scaleText = null;
}});
Clazz_defineMethod(c$, "resetShapes", 
function(cacheScale){
if (cacheScale) {
var data =  new Array(1);
this.getShapePropertyData(31, "%SCALE", data);
this.scaleText = data[0];
}this.shapes =  new Array(37);
}, "~B");
Clazz_defineMethod(c$, "setShapeProperties", 
function(shapeID, values){
this.vwr.setShapeErrorState(shapeID, "set properties");
this.loadShape(shapeID).setProperties(values);
this.vwr.setShapeErrorState(-1, null);
}, "~N,~A");
Clazz_defineMethod(c$, "setShapeSizeBs", 
function(shapeID, size, rd, bsSelected){
if (this.shapes == null) return;
if (bsSelected == null && (shapeID != 1 || size != 2147483647)) bsSelected = this.vwr.bsA();
if (rd != null && rd.value != 0 && rd.vdwType === J.c.VDW.TEMP) this.ms.getBfactor100Lo();
this.vwr.setShapeErrorState(shapeID, "set size");
if (rd == null ? size != 0 : rd.value != 0) this.loadShape(shapeID);
if (this.shapes[shapeID] != null) {
this.shapes[shapeID].setShapeSizeRD(size, rd, bsSelected);
}this.vwr.setShapeErrorState(-1, null);
}, "~N,~N,J.atomdata.RadiusData,JU.BS");
Clazz_defineMethod(c$, "setLabel", 
function(strLabel, bsSelection){
if (strLabel == null) {
if (this.shapes[5] == null) return;
} else {
this.loadShape(5);
this.setShapeSizeBs(5, 0, null, bsSelection);
}this.setShapePropertyBs(5, "label", strLabel, bsSelection);
}, "~O,JU.BS");
Clazz_defineMethod(c$, "setShapePropertyBs", 
function(shapeID, propertyName, value, bsSelected){
if (this.shapes == null || this.shapes[shapeID] == null) return;
if (bsSelected == null) bsSelected = this.vwr.bsA();
this.vwr.setShapeErrorState(shapeID, "set " + propertyName);
this.shapes[shapeID].setProperty(propertyName.intern(), value, bsSelected);
this.vwr.setShapeErrorState(-1, null);
}, "~N,~S,~O,JU.BS");
Clazz_defineMethod(c$, "checkFrankclicked", 
function(x, y){
var frankShape = this.shapes[36];
return (frankShape != null && frankShape.wasClicked(x, y));
}, "~N,~N");
Clazz_defineMethod(c$, "checkObjectClicked", 
function(x, y, modifiers, bsVisible, drawPicking){
var shape;
var map = null;
if (this.vwr.getPickingMode() == 2) {
return (this.shapes[5] == null ? null : this.shapes[5].checkObjectClicked(x, y, modifiers, bsVisible, false));
}if (modifiers != 0 && this.vwr.getBondsPickable() && (map = this.shapes[1].checkObjectClicked(x, y, modifiers, bsVisible, false)) != null) return map;
for (var i = 0; i < JV.ShapeManager.clickableMax; i++) if ((shape = this.shapes[JV.ShapeManager.hoverable[i]]) != null && (map = shape.checkObjectClicked(x, y, modifiers, bsVisible, drawPicking)) != null) return map;

return null;
}, "~N,~N,~N,JU.BS,~B");
Clazz_defineMethod(c$, "checkObjectDragged", 
function(prevX, prevY, x, y, modifiers, bsVisible, iShape){
var found = false;
var n = (iShape > 0 ? iShape + 1 : 37);
for (var i = iShape; !found && i < n; ++i) if (this.shapes[i] != null) found = this.shapes[i].checkObjectDragged(prevX, prevY, x, y, modifiers, bsVisible);

return found;
}, "~N,~N,~N,~N,~N,JU.BS,~N");
Clazz_defineMethod(c$, "checkObjectHovered", 
function(x, y, bsVisible, checkBonds){
var shape = this.shapes[1];
if (checkBonds && shape != null && shape.checkObjectHovered(x, y, bsVisible)) return true;
for (var i = 0; i < JV.ShapeManager.hoverable.length; i++) {
shape = this.shapes[JV.ShapeManager.hoverable[i]];
if (shape != null && shape.checkObjectHovered(x, y, bsVisible)) return true;
}
return false;
}, "~N,~N,JU.BS,~B");
Clazz_defineMethod(c$, "deleteShapeAtoms", 
function(value, bs){
if (this.shapes != null) for (var j = 0; j < 37; j++) if (this.shapes[j] != null) this.setShapePropertyBs(j, "deleteModelAtoms", value, bs);

}, "~A,JU.BS");
Clazz_defineMethod(c$, "deleteVdwDependentShapes", 
function(bs){
if (bs == null) bs = this.vwr.bsA();
this.setShapeAtomsSafely(24, "deleteVdw", bs);
this.setShapeAtomsSafely(25, "deleteVdw", bs);
}, "JU.BS");
Clazz_defineMethod(c$, "setShapeAtomsSafely", 
function(i, key, bs){
if (this.shapes[i] != null) this.shapes[i].setProperty(key, null, bs);
}, "~N,~S,JU.BS");
Clazz_defineMethod(c$, "notifyAtoms", 
function(prop, atomsAndModels){
switch (prop) {
case "atomslabeled":
this.vwr.setModelkitPropertySafely("updatemodelkeys", atomsAndModels);
break;
case "atomsDeleted":
this.setShapeAtomsSafely(6, prop, atomsAndModels[0]);
this.vwr.setModelkitPropertySafely("updatemodelkeys", atomsAndModels);
break;
case "atomsMoved":
if (this.getShape(22) != null) this.vwr.setModelkitPropertySafely(prop, atomsAndModels[0]);
break;
}
}, "~S,~A");
Clazz_defineMethod(c$, "getAtomShapeValue", 
function(tok, group, atomIndex){
var iShape = JV.JC.shapeTokenIndex(tok);
if (iShape < 0 || this.shapes[iShape] == null) return 0;
var mad = this.shapes[iShape].getSize(atomIndex);
if (mad == 0) {
if ((group.shapeVisibilityFlags & this.shapes[iShape].vf) == 0) return 0;
mad = this.shapes[iShape].getSizeG(group);
}return mad / 2000;
}, "~N,JM.Group,~N");
Clazz_defineMethod(c$, "replaceGroup", 
function(g0, g1){
if (this.shapes == null) return;
for (var i = 9; i < 16; i++) if (this.shapes[i] != null) this.shapes[i].replaceGroup(g0, g1);

}, "JM.Group,JM.Group");
Clazz_defineMethod(c$, "getObjectMap", 
function(map, withDollar){
if (this.shapes == null) return;
var bDollar = Boolean.$valueOf(withDollar);
for (var i = 16; i < 30; ++i) this.getShapePropertyData(i, "getNames",  Clazz_newArray(-1, [map, bDollar]));

}, "java.util.Map,~B");
Clazz_defineMethod(c$, "getProperty", 
function(paramInfo){
if (paramInfo.equals("getShapes")) return this.shapes;
return null;
}, "~O");
Clazz_defineMethod(c$, "getShape", 
function(i){
return (this.shapes == null ? null : this.shapes[i]);
}, "~N");
Clazz_defineMethod(c$, "resetBioshapes", 
function(bsAllAtoms){
if (this.shapes == null) return;
for (var i = 0; i < this.shapes.length; ++i) if (this.shapes[i] != null && this.shapes[i].isBioShape) {
this.shapes[i].setModelSet(this.ms);
this.shapes[i].setShapeSizeRD(0, null, bsAllAtoms);
this.shapes[i].setProperty("color", J.c.PAL.NONE, bsAllAtoms);
}
}, "JU.BS");
Clazz_defineMethod(c$, "setAtomLabel", 
function(strLabel, i){
if (this.shapes != null) {
this.shapes[5].setProperty("label:" + strLabel, Integer.$valueOf(i), null);
if (this.vwr.getModelkitPropertySafely(null) === Boolean.TRUE) this.notifyAtoms("atomslabeled",  Clazz_newArray(-1, [null, JU.BSUtil.newAndSetBit(this.vwr.ms.at[i].mi)]));
}}, "~S,~N");
Clazz_defineMethod(c$, "setModelVisibility", 
function(bs){
var shapes = this.shapes;
if (shapes == null || shapes[0] == null) return;
if (bs == null) bs = this.vwr.getVisibleFramesBitSet();
if (shapes[8] != null) shapes[8].setProperty("highlight", null, null);
for (var i = 8; i < 33; i++) if (shapes[i] != null) shapes[i].setModelVisibilityFlags(bs);

var showHydrogens = this.vwr.getBoolean(603979922);
var bsDeleted = this.vwr.slm.bsDeleted;
var atoms = this.ms.at;
this.ms.clearVisibleSets();
if (atoms.length > 0) {
for (var i = this.ms.ac; --i >= 0; ) {
var atom = atoms[i];
if (atom != null) atom.shapeVisibilityFlags &= -64;
if (bsDeleted != null && bsDeleted.get(i)) continue;
if (bs.get(atom.mi)) {
var f = 1;
if (!this.ms.isAtomHidden(i) && (showHydrogens || atom.getElementNumber() != 1)) {
f |= 8;
if (atom.madAtom != 0) f |= 16;
atom.setShapeVisibility(f, true);
}}}
}this.setShapeVis();
}, "JU.BS");
Clazz_defineMethod(c$, "setShapeVis", 
function(){
for (var i = 0; i < 37; ++i) {
var shape = this.shapes[i];
if (shape != null) shape.setAtomClickability();
}
});
Clazz_defineMethod(c$, "finalizeAtoms", 
function(bsTranslateSelected, finalizeParams){
var vwr = this.vwr;
var tm = vwr.tm;
if (finalizeParams) vwr.finalizeTransformParameters();
if (bsTranslateSelected != null) {
var ptCenter = this.ms.getAtomSetCenter(bsTranslateSelected);
var pt =  new JU.P3();
tm.transformPt3fSafe(ptCenter, pt);
pt.add(tm.ptOffset);
tm.unTransformPoint(pt, pt);
pt.sub(ptCenter);
vwr.setAtomCoordsRelative(pt, bsTranslateSelected);
tm.ptOffset.set(0, 0, 0);
tm.bsSelectedAtoms = null;
}var bsOK = this.bsRenderableAtoms;
this.ms.getAtomsInFrame(bsOK);
var vibrationVectors = this.ms.vibrations;
var vibsOn = (vibrationVectors != null && tm.vibrationOn);
var checkOccupancy = (this.ms.bsModulated != null && this.ms.occupancies != null);
var atoms = this.ms.at;
var occ;
var occMax = vwr.getInt(553648159);
var haveMods = false;
var bsSlabbed = this.bsSlabbedInternal;
bsSlabbed.clearAll();
for (var i = bsOK.nextSetBit(0); i >= 0; i = bsOK.nextSetBit(i + 1)) {
var atom = atoms[i];
var screen = (vibsOn && atom.hasVibration() ? tm.transformPtVibSafe(atom, vibrationVectors[i]) : tm.transformPtSafe(atom));
if (screen.z == 1 && tm.internalSlab && tm.xyzIsSlabbedInternal(atom)) {
bsSlabbed.set(i);
}atom.sX = screen.x;
atom.sY = screen.y;
atom.sZ = screen.z;
var d = Math.abs(atom.madAtom);
if (d == 32200) d = Clazz_floatToInt(vwr.getFloat(1153433601) * 2000);
atom.sD = Clazz_floatToInt(vwr.tm.scaleToScreen(screen.z, d));
if (checkOccupancy && vibrationVectors[i] != null && (occ = vibrationVectors[i].getOccupancy100(vibsOn)) != -2147483648) {
haveMods = true;
atom.setShapeVisibility(2, false);
if (occ >= 0 && occ < occMax) atom.setShapeVisibility(24, false);
 else atom.setShapeVisibility(8 | (atom.madAtom > 0 ? 16 : 0), true);
this.ms.occupancies[atom.i] = Math.abs(occ);
}}
if (haveMods) this.setShapeVis();
var gdata = vwr.gdata;
if (tm.slabEnabled) {
var slabByMolecule = vwr.getBoolean(603979940);
var slabByAtom = vwr.getBoolean(603979939);
var minZ = gdata.slab;
var maxZ = gdata.depth;
if (slabByMolecule) {
var molecules = this.ms.getMolecules();
var moleculeCount = this.ms.getMoleculeCountInModel(-1);
for (var i = 0; i < moleculeCount; i++) {
var m = molecules[i];
var j = 0;
var pt = m.firstAtomIndex;
if (!bsOK.get(pt)) continue;
for (; j < m.ac; j++, pt++) if (gdata.isClippedZ(atoms[pt].sZ - (atoms[pt].sD >> 1))) break;

if (j != m.ac) {
pt = m.firstAtomIndex;
for (var k = 0; k < m.ac; k++) {
bsOK.clear(pt);
atoms[pt++].sZ = 0;
}
}}
}for (var i = bsOK.nextSetBit(0); i >= 0; i = bsOK.nextSetBit(i + 1)) {
var atom = atoms[i];
if (gdata.isClippedZ(atom.sZ - (slabByAtom ? atoms[i].sD >> 1 : 0))) {
atom.setClickable(0);
var r = Clazz_doubleToInt((slabByAtom ? -1 : 1) * atom.sD / 2);
if (atom.sZ + r < minZ || atom.sZ - r > maxZ || !gdata.isInDisplayRange(atom.sX, atom.sY)) {
bsOK.clear(i);
}}}
}if (this.ms.ac == 0 || !vwr.getShowNavigationPoint()) return null;
var minX = 2147483647;
var maxX = -2147483648;
var minY = 2147483647;
var maxY = -2147483648;
for (var i = bsOK.nextSetBit(0); i >= 0; i = bsOK.nextSetBit(i + 1)) {
var atom = atoms[i];
if (atom.sX < minX) minX = atom.sX;
if (atom.sX > maxX) maxX = atom.sX;
if (atom.sY < minY) minY = atom.sY;
if (atom.sY > maxY) maxY = atom.sY;
}
this.navMinMax[0] = minX;
this.navMinMax[1] = maxX;
this.navMinMax[2] = minY;
this.navMinMax[3] = maxY;
return this.navMinMax;
}, "JU.BS,~B");
Clazz_defineMethod(c$, "setModelSet", 
function(modelSet){
this.ms = modelSet;
}, "JM.ModelSet");
Clazz_defineMethod(c$, "checkInheritedShapes", 
function(){
if (this.shapes[24] != null) this.setShapePropertyBs(24, "remapInherited", null, null);
});
Clazz_defineMethod(c$, "restrictSelected", 
function(isBond, doInvert){
var bsSelected = this.vwr.slm.getSelectedAtomsNoSubset();
if (doInvert) {
this.vwr.slm.invertSelection();
var bsSubset = this.vwr.slm.bsSubset;
if (bsSubset != null) {
bsSelected = this.vwr.slm.getSelectedAtomsNoSubset();
bsSelected.and(bsSubset);
this.vwr.selectStatus(bsSelected, false, 0, true, false);
JU.BSUtil.invertInPlace(bsSelected, this.vwr.ms.ac);
bsSelected.and(bsSubset);
}}JU.BSUtil.andNot(bsSelected, this.vwr.slm.bsDeleted);
var bondmode = this.vwr.getBoolean(603979812);
if (!isBond) this.vwr.setBooleanProperty("bondModeOr", true);
this.setShapeSizeBs(1, 0, null, null);
this.setShapePropertyBs(1, "type", Integer.$valueOf(32768), null);
this.setShapeSizeBs(1, 0, null, null);
this.setShapePropertyBs(1, "type", Integer.$valueOf(1023), null);
var bs = this.vwr.bsA();
for (var iShape = 21; --iShape >= 0; ) if (iShape != 6 && this.getShape(iShape) != null) this.setShapeSizeBs(iShape, 0, null, bs);

if (this.getShape(21) != null) this.setShapePropertyBs(21, "off", bs, null);
this.setLabel(null, bs);
if (!isBond) this.vwr.setBooleanProperty("bondModeOr", bondmode);
this.vwr.selectStatus(bsSelected, false, 0, true, false);
}, "~B,~B");
Clazz_defineMethod(c$, "getAtomColorRGBShaded", 
function(colixes, atom){
var colix = J.shape.Shape.getColix(colixes, atom.i, atom);
if (colix < 0) colix = this.vwr.gdata.fixChangeableColix(colix);
return JU.C.getColixShadedRGB(colix);
}, "~A,JM.Atom");
c$.hoverable =  Clazz_newIntArray(-1, [31, 20, 25, 24, 22, 23, 36]);
c$.clickableMax = JV.ShapeManager.hoverable.length - 1;
});
;//5.0.1-v7 Mon Aug 24 10:01:38 CDT 2026
Clazz_declarePackage("JV");
Clazz_load(["java.util.Hashtable"], ["JV.Connection", "$.Scene", "$.StateManager", "$.Connections"], ["java.util.Arrays", "JU.BS", "$.Lst", "$.SB", "JM.Orientation", "JU.BSUtil", "$.Escape"], function(){
var c$ = Clazz_decorateAsClass(function(){
this.maxUndo = 20;
this.vwr = null;
this.saved = null;
this.lastOrientation = "";
this.lastContext = "";
this.lastConnections = "";
this.lastScene = "";
this.lastSelected = "";
this.lastState = "";
this.lastShape = "";
this.lastCoordinates = "";
this.lastUnitcell = "";
this.undoStateStack = null;
this.redoStateStack = null;
Clazz_instantialize(this, arguments);}, JV, "StateManager", null);
Clazz_prepareFields (c$, function(){
this.saved =  new java.util.Hashtable();
});
Clazz_makeConstructor(c$, 
function(vwr){
this.vwr = vwr;
}, "JV.Viewer");
c$.getVariableList = Clazz_defineMethod(c$, "getVariableList", 
function(htVariables, nMax, withSites, definedOnly){
var sb =  new JU.SB();
var n = 0;
var list =  new Array(htVariables.size());
for (var entry, $entry = htVariables.entrySet().iterator (); $entry.hasNext()&& ((entry = $entry.next ()) || true);) {
var key = entry.getKey();
var $var = entry.getValue();
if ((withSites || !key.startsWith("site_")) && (!definedOnly || key.charAt(0) == '@')) list[n++] = key + (key.charAt(0) == '@' ? " " + $var.asString() : " = " + JV.StateManager.varClip(key, $var.escape(), nMax));
}
java.util.Arrays.sort(list, 0, n);
for (var i = 0; i < n; i++) if (list[i] != null) sb.append("  ").append(list[i]).append(";\n");

if (n == 0 && !definedOnly) sb.append("# --no global user variables defined--;\n");
return sb.toString();
}, "java.util.Map,~N,~B,~B");
c$.getObjectIdFromName = Clazz_defineMethod(c$, "getObjectIdFromName", 
function(name){
if (name == null) return -1;
var objID = "background axis1      axis2      axis3      boundbox   unitcell   frank      ".indexOf(name.toLowerCase());
return (objID < 0 ? objID : Clazz_doubleToInt(objID / 11));
}, "~S");
c$.getObjectNameFromId = Clazz_defineMethod(c$, "getObjectNameFromId", 
function(objId){
if (objId < 0 || objId >= 7) return null;
return "background axis1      axis2      axis3      boundbox   unitcell   frank      ".substring(objId * 11, objId * 11 + 11).trim();
}, "~N");
Clazz_defineMethod(c$, "clear", 
function(global){
this.vwr.setShowAxes(false);
this.vwr.setShowBbcage(false);
this.vwr.setShowUnitCell(false);
global.clear();
}, "JV.GlobalSettings");
Clazz_defineMethod(c$, "resetLighting", 
function(){
this.vwr.setIntProperty("ambientPercent", 45);
this.vwr.setIntProperty("celShadingPower", 10);
this.vwr.setIntProperty("diffusePercent", 84);
this.vwr.setIntProperty("phongExponent", 64);
this.vwr.setIntProperty("specularExponent", 6);
this.vwr.setIntProperty("specularPercent", 22);
this.vwr.setIntProperty("specularPower", 40);
this.vwr.setIntProperty("zDepth", 0);
this.vwr.setIntProperty("zShadePower", 3);
this.vwr.setIntProperty("zSlab", 50);
this.vwr.setBooleanProperty("specular", true);
this.vwr.setBooleanProperty("celShading", false);
this.vwr.setBooleanProperty("zshade", false);
});
Clazz_defineMethod(c$, "setCrystallographicDefaults", 
function(){
this.vwr.setAxesMode(603979808);
this.vwr.setShowAxes(true);
this.vwr.setShowUnitCell(true);
this.vwr.setBooleanProperty("perspectiveDepth", false);
});
Clazz_defineMethod(c$, "setCommonDefaults", 
function(){
this.vwr.setBooleanProperty("perspectiveDepth", true);
this.vwr.setFloatProperty("bondTolerance", 0.45);
this.vwr.setFloatProperty("minBondDistance", 0.4);
this.vwr.setIntProperty("bondingVersion", 0);
this.vwr.setBooleanProperty("translucent", true);
});
Clazz_defineMethod(c$, "setJmolDefaults", 
function(){
this.setCommonDefaults();
this.vwr.setStringProperty("defaultColorScheme", "Jmol");
this.vwr.setBooleanProperty("axesOrientationRasmol", false);
this.vwr.setBooleanProperty("zeroBasedXyzRasmol", false);
this.vwr.setIntProperty("percentVdwAtom", 23);
this.vwr.setIntProperty("bondRadiusMilliAngstroms", 150);
this.vwr.setVdwStr("auto");
});
Clazz_defineMethod(c$, "setRasMolDefaults", 
function(){
this.setCommonDefaults();
this.vwr.setStringProperty("defaultColorScheme", "RasMol");
this.vwr.setBooleanProperty("axesOrientationRasmol", true);
this.vwr.setBooleanProperty("zeroBasedXyzRasmol", true);
this.vwr.setIntProperty("percentVdwAtom", 0);
this.vwr.setIntProperty("bondRadiusMilliAngstroms", 1);
this.vwr.setVdwStr("Rasmol");
});
Clazz_defineMethod(c$, "setPyMOLDefaults", 
function(){
this.setCommonDefaults();
this.vwr.setStringProperty("measurementUnits", "ANGSTROMS");
this.vwr.setBooleanProperty("zoomHeight", true);
});
c$.getNoCase = Clazz_defineMethod(c$, "getNoCase", 
function(saved, name){
for (var e, $e = saved.entrySet().iterator (); $e.hasNext()&& ((e = $e.next ()) || true);) if (e.getKey().equalsIgnoreCase(name)) return e.getValue();

return null;
}, "java.util.Map,~S");
Clazz_defineMethod(c$, "listSavedStates", 
function(){
var names = "";
for (var name, $name = this.saved.keySet().iterator (); $name.hasNext()&& ((name = $name.next ()) || true);) names += "\n" + name;

return names;
});
Clazz_defineMethod(c$, "deleteSavedType", 
function(type){
var e = this.saved.keySet().iterator();
while (e.hasNext()) if (e.next().startsWith(type)) e.remove();

}, "~S");
Clazz_defineMethod(c$, "deleteSaved", 
function(namelike){
var e = this.saved.keySet().iterator();
while (e.hasNext()) {
var name = e.next();
if (name.startsWith(namelike) || name.endsWith("_" + namelike) && name.indexOf("_") == name.lastIndexOf("_" + namelike)) e.remove();
}
}, "~S");
Clazz_defineMethod(c$, "saveSelection", 
function(saveName, bsSelected){
if (saveName.equalsIgnoreCase("DELETE")) {
this.deleteSavedType("Selected_");
return;
}saveName = this.lastSelected = "Selected_" + saveName;
this.saved.put(saveName, JU.BSUtil.copy(bsSelected));
}, "~S,JU.BS");
Clazz_defineMethod(c$, "restoreSelection", 
function(saveName){
var name = (saveName.length > 0 ? "Selected_" + saveName : this.lastSelected);
var bsSelected = JV.StateManager.getNoCase(this.saved, name);
if (bsSelected == null) {
this.vwr.selectStatus( new JU.BS(), false, 0, false, false);
return false;
}this.vwr.selectStatus(bsSelected, false, 0, false, false);
return true;
}, "~S");
Clazz_defineMethod(c$, "saveUnitCell", 
function(saveName){
if (saveName.equalsIgnoreCase("DELETE")) {
this.deleteSavedType("unitcell_");
return;
}saveName = this.lastUnitcell = "unitcell_" + saveName;
var uc = this.vwr.getCurrentUnitCell();
if (uc != null) {
var state = "UNITCELL " + JU.Escape.e(uc.getUnitCellVectors());
this.saved.put(saveName, "unitcell reset;" + state);
}}, "~S");
Clazz_defineMethod(c$, "getSavedUnitCell", 
function(saveName){
var name = (saveName.length > 0 ? "unitcell_" + saveName : this.lastUnitcell);
var ucstate = JV.StateManager.getNoCase(this.saved, name);
return ucstate;
}, "~S");
Clazz_defineMethod(c$, "restoreUnitCell", 
function(saveName){
var ucstate = this.getSavedUnitCell(saveName);
if (ucstate == null) {
this.vwr.ms.setModelCagePts(-1, null, null);
return false;
}this.vwr.runScript(ucstate);
return true;
}, "~S");
Clazz_defineMethod(c$, "saveState", 
function(saveName){
if (saveName.equalsIgnoreCase("DELETE")) {
this.deleteSavedType("State_");
this.clearStateStack();
return;
}if (saveName.length == 0) {
this.vwr.setBooleanProperty("undoAuto", false);
this.appendState(this.getStack(603984065));
this.redoStateStack.clear();
return;
}saveName = this.lastState = "State_" + saveName;
this.saved.put(saveName, this.vwr.getStateInfo());
}, "~S");
Clazz_defineMethod(c$, "getSavedState", 
function(saveName){
if (saveName.length == 0) {
var stack = this.getStack(603984065);
return (stack.size() > 0 ? stack.get(stack.size() - 1) : null);
}var name = (saveName.length > 0 ? "State_" + saveName : this.lastState);
var script = JV.StateManager.getNoCase(this.saved, name);
return (script == null ? "" : script);
}, "~S");
Clazz_defineMethod(c$, "popStack", 
function(type){
var stack = this.getStack(type);
var state = (stack.size() > 0 ? stack.removeItemAt(stack.size() - 1) : null);
if (state != null) {
this.appendState(this.getStack(type == 603984065 ? 4139 : 603984065));
}this.checkStack(this.getStack(603984065));
return state;
}, "~N");
Clazz_defineMethod(c$, "appendState", 
function(stack){
this.checkStack(stack);
if (this.maxUndo > 0) stack.addLast(this.vwr.getStateInfo());
}, "JU.Lst");
Clazz_defineMethod(c$, "checkStack", 
function(stack){
while (stack.size() > this.maxUndo) stack.removeItemAt(0);

}, "JU.Lst");
Clazz_defineMethod(c$, "getStack", 
function(type){
if (this.undoStateStack == null) {
this.undoStateStack =  new JU.Lst();
this.redoStateStack =  new JU.Lst();
}return (type == 603984065 ? this.undoStateStack : this.redoStateStack);
}, "~N");
Clazz_defineMethod(c$, "clearStateStack", 
function(){
if (this.undoStateStack == null) return;
this.undoStateStack.clear();
this.redoStateStack.clear();
});
Clazz_defineMethod(c$, "saveStructure", 
function(saveName){
if (saveName.equalsIgnoreCase("DELETE")) {
this.deleteSavedType("Shape_");
return;
}saveName = this.lastShape = "Shape_" + saveName;
this.saved.put(saveName, this.vwr.getStructureState());
}, "~S");
Clazz_defineMethod(c$, "getSavedStructure", 
function(saveName){
var name = (saveName.length > 0 ? "Shape_" + saveName : this.lastShape);
var script = JV.StateManager.getNoCase(this.saved, name);
return (script == null ? "" : script);
}, "~S");
Clazz_defineMethod(c$, "saveCoordinates", 
function(saveName, bsSelected){
if (saveName.equalsIgnoreCase("DELETE")) {
this.deleteSavedType("Coordinates_");
return;
}saveName = this.lastCoordinates = "Coordinates_" + saveName;
this.saved.put(saveName, this.vwr.getCoordinateState(bsSelected));
}, "~S,JU.BS");
Clazz_defineMethod(c$, "getSavedCoordinates", 
function(saveName){
var name = (saveName.length > 0 ? "Coordinates_" + saveName : this.lastCoordinates);
var script = JV.StateManager.getNoCase(this.saved, name);
return (script == null ? "" : script);
}, "~S");
Clazz_defineMethod(c$, "getOrientation", 
function(){
return  new JM.Orientation(this.vwr, false, null);
});
Clazz_defineMethod(c$, "getSavedOrientationText", 
function(saveName){
var o;
if (saveName != null) {
o = this.getOrientationFor(saveName);
return (o == null ? "" : o.getMoveToText(true));
}var sb =  new JU.SB();
for (var e, $e = this.saved.entrySet().iterator (); $e.hasNext()&& ((e = $e.next ()) || true);) {
var name = e.getKey();
if (name.startsWith("Orientation_")) sb.append((e.getValue()).getMoveToText(true));
}
return sb.toString();
}, "~S");
Clazz_defineMethod(c$, "saveScene", 
function(saveName, scene){
if (saveName.equalsIgnoreCase("DELETE")) {
this.deleteSavedType("Scene_");
return;
}var o =  new JV.Scene(scene);
o.saveName = this.lastScene = "Scene_" + saveName;
this.saved.put(o.saveName, o);
}, "~S,java.util.Map");
Clazz_defineMethod(c$, "restoreScene", 
function(saveName, timeSeconds){
var o = JV.StateManager.getNoCase(this.saved, (saveName.length > 0 ? "Scene_" + saveName : this.lastScene));
return (o != null && o.restore(this.vwr, timeSeconds));
}, "~S,~N");
Clazz_defineMethod(c$, "saveOrientation", 
function(saveName, pymolView){
if (saveName.equalsIgnoreCase("DELETE")) {
this.deleteSavedType("Orientation_");
return;
}var o =  new JM.Orientation(this.vwr, saveName.equalsIgnoreCase("default"), pymolView);
o.saveName = this.lastOrientation = "Orientation_" + saveName;
this.saved.put(o.saveName, o);
}, "~S,~A");
Clazz_defineMethod(c$, "restoreOrientation", 
function(saveName, timeSeconds, isAll){
var o = this.getOrientationFor(saveName);
return (o != null && o.restore(timeSeconds, isAll));
}, "~S,~N,~B");
Clazz_defineMethod(c$, "getOrientationFor", 
function(saveName){
var name = (saveName.length > 0 ? "Orientation_" + saveName : this.lastOrientation);
return JV.StateManager.getNoCase(this.saved, name);
}, "~S");
Clazz_defineMethod(c$, "saveContext", 
function(saveName, context){
if (saveName.equalsIgnoreCase("DELETE")) {
this.deleteSavedType("Context_");
return;
}this.saved.put((this.lastContext = "Context_" + saveName), context);
}, "~S,~O");
Clazz_defineMethod(c$, "getContext", 
function(saveName){
return this.saved.get(saveName.length == 0 ? this.lastContext : "Context_" + saveName);
}, "~S");
Clazz_defineMethod(c$, "saveBonds", 
function(saveName){
if (saveName.equalsIgnoreCase("DELETE")) {
this.deleteSavedType("Bonds_");
return;
}var b =  new JV.Connections(this.vwr);
b.saveName = this.lastConnections = "Bonds_" + saveName;
this.saved.put(b.saveName, b);
}, "~S");
Clazz_defineMethod(c$, "restoreBonds", 
function(saveName){
this.vwr.clearModelDependentObjects();
var name = (saveName.length > 0 ? "Bonds_" + saveName : this.lastConnections);
var c = JV.StateManager.getNoCase(this.saved, name);
return (c != null && c.restore());
}, "~S");
c$.varClip = Clazz_defineMethod(c$, "varClip", 
function(name, sv, nMax){
if (nMax > 0 && sv.length > nMax) sv = sv.substring(0, nMax) + " #...more (" + sv.length + " bytes -- use SHOW " + name + " or MESSAGE @" + name + " to view)";
return sv;
}, "~S,~S,~N");
Clazz_defineMethod(c$, "getUndoMax", 
function(){
return this.maxUndo;
});
Clazz_defineMethod(c$, "setUndoMax", 
function(n){
this.maxUndo = Math.max(n, 0);
this.checkStack(this.getStack(603984065));
this.checkStack(this.getStack(4139));
}, "~N");
Clazz_defineMethod(c$, "getUndoRedoState", 
function(tok){
return this.popStack(tok);
}, "~N");
Clazz_defineMethod(c$, "canDo", 
function(type){
return (this.maxUndo > 0 && this.vwr.getBoolean(603979898) && !this.getStack(type).isEmpty());
}, "~N");
Clazz_defineMethod(c$, "getUndoInfo", 
function(){
var auto = this.vwr.getBooleanProperty("undoAuto");
return (this.vwr.getBoolean(603979898) ? "undoAuto=" + auto + (!auto ? "; user stack sizes: UNDO=" + this.getStack(603984065).size() + ", REDO=" + this.getStack(4139).size() : "") : "SET preserveState = FALSE -- undo/redo is disabled");
});
var c$ = Clazz_decorateAsClass(function(){
this.saveName = null;
this.scene = null;
Clazz_instantialize(this, arguments);}, JV, "Scene", null);
Clazz_makeConstructor(c$, 
function(scene){
this.scene = scene;
}, "java.util.Map");
Clazz_defineMethod(c$, "restore", 
function(vwr, timeSeconds){
var gen = this.scene.get("generator");
if (gen != null) gen.generateScene(this.scene);
var pv = this.scene.get("pymolView");
return (pv != null && vwr.tm.moveToPyMOL(vwr.eval, timeSeconds, pv));
}, "JV.Viewer,~N");
var c$ = Clazz_decorateAsClass(function(){
this.saveName = null;
this.bondCount = 0;
this.connections = null;
this.vwr = null;
Clazz_instantialize(this, arguments);}, JV, "Connections", null);
Clazz_makeConstructor(c$, 
function(vwr){
var modelSet = vwr.ms;
if (modelSet == null) return;
this.vwr = vwr;
this.bondCount = modelSet.bondCount;
this.connections =  new Array(this.bondCount + 1);
var bonds = modelSet.bo;
for (var i = this.bondCount; --i >= 0; ) {
var b = bonds[i];
if (b != null) this.connections[i] =  new JV.Connection(b.atom1.i, b.atom2.i, b.mad, b.colix, b.order, b.getEnergy(), b.shapeVisibilityFlags);
}
}, "JV.Viewer");
Clazz_defineMethod(c$, "restore", 
function(){
var modelSet = this.vwr.ms;
if (modelSet == null) return false;
modelSet.deleteAllBonds();
for (var i = this.bondCount; --i >= 0; ) {
var c = this.connections[i];
var ac = modelSet.ac;
if (c.atomIndex1 >= ac || c.atomIndex2 >= ac) continue;
var b = modelSet.bondAtoms(modelSet.at[c.atomIndex1], modelSet.at[c.atomIndex2], c.order, c.mad, null, c.energy, false, true);
b.colix = c.colix;
b.shapeVisibilityFlags = c.shapeVisibilityFlags;
}
var bonds = modelSet.bo;
for (var i = modelSet.bondCount; --i >= 0; ) if (bonds[i] != null) bonds[i].index = i;

this.vwr.setShapeProperty(1, "reportAll", null);
return true;
});
var c$ = Clazz_decorateAsClass(function(){
this.atomIndex1 = 0;
this.atomIndex2 = 0;
this.mad = 0;
this.colix = 0;
this.order = 0;
this.energy = 0;
this.shapeVisibilityFlags = 0;
Clazz_instantialize(this, arguments);}, JV, "Connection", null);
Clazz_makeConstructor(c$, 
function(atom1, atom2, mad, colix, order, energy, shapeVisibilityFlags){
this.atomIndex1 = atom1;
this.atomIndex2 = atom2;
this.mad = mad;
this.colix = colix;
this.order = order;
this.energy = energy;
this.shapeVisibilityFlags = shapeVisibilityFlags;
}, "~N,~N,~N,~N,~N,~N,~N");
});
;//5.0.1-v7 Mon Aug 24 10:01:38 CDT 2026
Clazz_declarePackage("JV");
Clazz_load(["java.util.Hashtable"], "JV.StatusManager", ["JU.Lst", "$.PT", "J.api.Interface", "J.c.CBK", "JS.SV", "JU.BSUtil", "$.Logger", "JV.JC"], function(){
var c$ = Clazz_decorateAsClass(function(){
this.vwr = null;
this.jsl = null;
this.cbl = null;
this.statusList = "";
this.allowStatusReporting = false;
this.messageQueue = null;
this.statusPtr = 0;
this.jmolScriptCallbacks = null;
this.imageMap = null;
this.echoing = false;
this.minSyncRepeatMs = 100;
this.syncingScripts = false;
this.syncingMouse = false;
this.drivingSync = false;
this.isSynced = false;
this.syncDisabled = false;
this.stereoSync = false;
this.qualityJPG = -1;
this.qualityPNG = -1;
this.imageType = null;
this.audios = null;
Clazz_instantialize(this, arguments);}, JV, "StatusManager", null);
Clazz_prepareFields (c$, function(){
this.messageQueue =  new java.util.Hashtable();
this.jmolScriptCallbacks =  new java.util.Hashtable();
});
Clazz_makeConstructor(c$, 
function(vwr){
this.vwr = vwr;
}, "JV.Viewer");
Clazz_defineMethod(c$, "recordStatus", 
function(statusName){
return (this.allowStatusReporting && this.statusList.length > 0 && (this.statusList.equals("all") || this.statusList.indexOf(statusName) >= 0));
}, "~S");
Clazz_defineMethod(c$, "setStatusChanged", 
function(statusName, intInfo, statusInfo, isReplace){
if (!this.recordStatus(statusName)) return;
var msgRecord =  new JU.Lst();
msgRecord.addLast(Integer.$valueOf(++this.statusPtr));
msgRecord.addLast(statusName);
msgRecord.addLast(Integer.$valueOf(intInfo));
msgRecord.addLast(statusInfo);
var statusRecordSet = (isReplace ? null : this.messageQueue.get(statusName));
if (statusRecordSet == null) this.messageQueue.put(statusName, statusRecordSet =  new JU.Lst());
 else if (statusRecordSet.size() == JV.StatusManager.MAXIMUM_QUEUE_LENGTH) statusRecordSet.removeItemAt(0);
statusRecordSet.addLast(msgRecord);
}, "~S,~N,~O,~B");
Clazz_defineMethod(c$, "getStatusChanged", 
function(newStatusList){
var isRemove = (newStatusList.length > 0 && newStatusList.charAt(0) == '-');
var isAdd = (newStatusList.length > 0 && newStatusList.charAt(0) == '+');
var getList = false;
if (isRemove) {
this.statusList = JU.PT.rep(this.statusList, newStatusList.substring(1, newStatusList.length), "");
} else {
newStatusList = JU.PT.rep(newStatusList, "+", "");
if (this.statusList.equals(newStatusList) || isAdd && this.statusList.indexOf(newStatusList) >= 0) {
getList = true;
} else {
if (!isAdd) this.statusList = "";
this.statusList += newStatusList;
if (JU.Logger.debugging) JU.Logger.debug("StatusManager messageQueue = " + this.statusList);
}}var list =  new JU.Lst();
if (getList) for (var e, $e = this.messageQueue.entrySet().iterator (); $e.hasNext()&& ((e = $e.next ()) || true);) list.addLast(e.getValue());

this.messageQueue.clear();
this.statusPtr = 0;
return list;
}, "~S");
Clazz_defineMethod(c$, "setCallbackFunction", 
function(callbackType, callbackObject){
var cbk = J.c.CBK.getCallback(callbackType);
var callbackFunction = ((typeof(callbackObject)=='string') ? callbackObject : null);
if (cbk != null) {
var callback = J.c.CBK.getCallback(callbackType).name();
JU.Logger.info("StatusManager " + callback + "callback set f=" + callbackFunction);
var isSync = (callbackFunction != null && callbackFunction.startsWith("SYNC:"));
if (isSync) {
if (callbackFunction.toLowerCase().trim().equals("sync:off")) {
this.jmolScriptCallbacks.remove("SYNC:" + callback);
JU.Logger.info("SYNC callback for " + callback + " deactivated");
} else {
this.jmolScriptCallbacks.put("SYNC:" + callback, "_");
JU.Logger.info("SYNC callback for " + callback + " activated");
return;
}} else {
var lc = "";
var pt = (callbackFunction == null ? 0 : (lc = callbackFunction.toLowerCase()).startsWith("script:") ? 7 : lc.startsWith("jmolscript:") ? 11 : 0);
if (pt == 0) {
if (callbackObject == null) this.jmolScriptCallbacks.remove(callback);
} else {
this.jmolScriptCallbacks.put(callback, callbackFunction.substring(pt).trim());
return;
}}}if (this.cbl != null) this.cbl.setCallbackFunction(callbackType, callbackObject);
}, "~S,~O");
Clazz_defineMethod(c$, "notifyEnabled", 
function(type){
return this.cbl != null && this.cbl.notifyEnabled(type);
}, "J.c.CBK");
Clazz_defineMethod(c$, "getJmolScriptCallback", 
function(callback){
return this.jmolScriptCallbacks.get(callback.name());
}, "J.c.CBK");
Clazz_defineMethod(c$, "fireJmolScriptCallback", 
function(isEnabled, callback, o, doWait){
var name = callback.name();
if (o[0] != null) {
var params =  new Array(o.length);
System.arraycopy(o, 0, params, 0, o.length);
var cmd = "try{\n" + params[0] + "\n}";
params[0] = name;
this.vwr.evalCallback(cmd, params, doWait);
}if (this.jmolScriptCallbacks.containsKey("SYNC:" + callback.name())) o[0] = "SYNC";
if (isEnabled) {
this.cbl.notifyCallback(callback, o);
}}, "~B,J.c.CBK,~A,~B");
Clazz_defineMethod(c$, "setStatusAppletReady", 
function(htmlName, isReady){
var sJmol = (isReady ? this.getJmolScriptCallback(J.c.CBK.APPLETREADY) : null);
var isEnabled = this.notifyEnabled(J.c.CBK.APPLETREADY);
if (isEnabled || sJmol != null) this.fireJmolScriptCallback(isEnabled, J.c.CBK.APPLETREADY,  Clazz_newArray(-1, [sJmol, htmlName, Boolean.$valueOf(isReady), null]), true);
}, "~S,~B");
Clazz_defineMethod(c$, "setStatusAtomMoved", 
function(bsMoved){
var sJmol = this.getJmolScriptCallback(J.c.CBK.ATOMMOVED);
this.setStatusChanged("atomMoved", -1, bsMoved, false);
var isEnabled = this.notifyEnabled(J.c.CBK.ATOMMOVED);
if (isEnabled || sJmol != null) this.fireJmolScriptCallback(isEnabled, J.c.CBK.ATOMMOVED,  Clazz_newArray(-1, [sJmol, bsMoved, Integer.$valueOf(bsMoved.cardinality())]), true);
}, "JU.BS");
Clazz_defineMethod(c$, "notifyCalculation", 
function(type, atoms, result){
var sJmol = this.getJmolScriptCallback(J.c.CBK.CALCULATION);
var isEnabled = this.notifyEnabled(J.c.CBK.CALCULATION);
if (isEnabled || sJmol != null) this.fireJmolScriptCallback(isEnabled, J.c.CBK.CALCULATION,  Clazz_newArray(-1, [sJmol, atoms, type, result]), true);
}, "~S,JU.BS,~S");
Clazz_defineMethod(c$, "setStatusSelect", 
function(atoms){
var sJmol = this.getJmolScriptCallback(J.c.CBK.SELECT);
this.setStatusChanged("select", -1, atoms, false);
var isEnabled = this.notifyEnabled(J.c.CBK.SELECT);
if (isEnabled || sJmol != null) this.fireJmolScriptCallback(isEnabled, J.c.CBK.SELECT,  Clazz_newArray(-1, [sJmol, atoms, Integer.$valueOf(atoms.cardinality()), Integer.$valueOf(atoms.nextSetBit(0)), Integer.$valueOf(atoms.length()), this.vwr.slm.getSelectionColors()]), true);
}, "JU.BS");
Clazz_defineMethod(c$, "setStatusStructureModified", 
function(atomIndex, modelIndex, mode, msg, n, bsAtoms){
if (bsAtoms == null) {
if (atomIndex >= 0) bsAtoms = JU.BSUtil.newAndSetBit(atomIndex);
 else bsAtoms = this.vwr.bsA();
}var sJmol = this.getJmolScriptCallback(J.c.CBK.STRUCTUREMODIFIED);
var isEnabled = this.notifyEnabled(J.c.CBK.STRUCTUREMODIFIED);
if (isEnabled || sJmol != null) this.fireJmolScriptCallback(isEnabled, J.c.CBK.STRUCTUREMODIFIED,  Clazz_newArray(-1, [sJmol, Integer.$valueOf(mode), Integer.$valueOf(atomIndex), Integer.$valueOf(modelIndex), msg, Integer.$valueOf(n), bsAtoms]), true);
}, "~N,~N,~N,~S,~N,JU.BS");
Clazz_defineMethod(c$, "setStatusAtomPicked", 
function(atomIndex, strInfo, map){
var sJmol = this.getJmolScriptCallback(J.c.CBK.PICK);
JU.Logger.info("setStatusAtomPicked(" + atomIndex + "," + strInfo + ")");
this.setStatusChanged("atomPicked", atomIndex, strInfo, false);
var isEnabled = this.notifyEnabled(J.c.CBK.PICK);
if (isEnabled || sJmol != null) this.fireJmolScriptCallback(isEnabled, J.c.CBK.PICK,  Clazz_newArray(-1, [sJmol, strInfo, Integer.$valueOf(atomIndex), map]), true);
}, "~N,~S,java.util.Map");
Clazz_defineMethod(c$, "setStatusClicked", 
function(x, y, action, clickCount, mode){
var sJmol = this.getJmolScriptCallback(J.c.CBK.CLICK);
var m =  Clazz_newIntArray(-1, [action, mode]);
var isEnabled = this.notifyEnabled(J.c.CBK.CLICK);
if (isEnabled || sJmol != null) this.fireJmolScriptCallback(isEnabled, J.c.CBK.CLICK,  Clazz_newArray(-1, [sJmol, Integer.$valueOf(x), Integer.$valueOf(y), Integer.$valueOf(action), Integer.$valueOf(clickCount), m]), true);
return m[0];
}, "~N,~N,~N,~N,~N");
Clazz_defineMethod(c$, "setStatusResized", 
function(width, height){
var sJmol = this.getJmolScriptCallback(J.c.CBK.RESIZE);
var isEnabled = this.notifyEnabled(J.c.CBK.RESIZE);
if (isEnabled || sJmol != null) this.fireJmolScriptCallback(isEnabled, J.c.CBK.RESIZE,  Clazz_newArray(-1, [sJmol, Integer.$valueOf(width), Integer.$valueOf(height)]), true);
}, "~N,~N");
Clazz_defineMethod(c$, "haveHoverCallback", 
function(){
return (this.jmolScriptCallbacks.containsKey(J.c.CBK.HOVER.name()) || this.notifyEnabled(J.c.CBK.HOVER));
});
Clazz_defineMethod(c$, "setStatusAtomHovered", 
function(iatom, strInfo){
var sJmol = this.getJmolScriptCallback(J.c.CBK.HOVER);
var isEnabled = this.notifyEnabled(J.c.CBK.HOVER);
if (isEnabled || sJmol != null) this.fireJmolScriptCallback(isEnabled, J.c.CBK.HOVER,  Clazz_newArray(-1, [sJmol, strInfo, Integer.$valueOf(iatom)]), true);
}, "~N,~S");
Clazz_defineMethod(c$, "setStatusObjectHovered", 
function(id, strInfo, pt){
var sJmol = this.getJmolScriptCallback(J.c.CBK.HOVER);
var isEnabled = this.notifyEnabled(J.c.CBK.HOVER);
if (isEnabled || sJmol != null) this.fireJmolScriptCallback(isEnabled, J.c.CBK.HOVER,  Clazz_newArray(-1, [sJmol, strInfo, Integer.$valueOf(-1), id, Float.$valueOf(pt.x), Float.$valueOf(pt.y), Float.$valueOf(pt.z)]), true);
}, "~S,~S,JU.T3");
Clazz_defineMethod(c$, "showImage", 
function(title, image){
var a = JU.PT.split(title, "\1");
title = (a.length < 2 ? "Jmol" : a.length < 3 || a[2].equals("null") ? a[1].substring(a[1].lastIndexOf("/") + 1) : a[2]);
var sJmol = this.getJmolScriptCallback(J.c.CBK.IMAGE);
var isEnabled = this.notifyEnabled(J.c.CBK.IMAGE);
if (isEnabled || sJmol != null) this.fireJmolScriptCallback(isEnabled, J.c.CBK.IMAGE,  Clazz_newArray(-1, [sJmol, title, image]), true);
if (Boolean.TRUE.equals(image)) {
if (this.imageMap == null) return;
var lst =  new JU.Lst();
for (var key, $key = this.imageMap.keySet().iterator (); $key.hasNext()&& ((key = $key.next ()) || true);) lst.addLast(key);

for (var i = lst.size(); --i >= 0; ) this.imageMap.get(lst.get(i)).closeMe();

return;
}if (this.imageMap == null) this.imageMap =  new java.util.Hashtable();
var d = this.imageMap.get(title);
if (Boolean.FALSE.equals(image)) {
if (d != null) d.closeMe();
return;
}if (d == null && image != null) d = this.vwr.apiPlatform.getImageDialog(title, this.imageMap);
if (d == null) return;
if (image == null) d.closeMe();
 else d.setImage(image);
}, "~S,~O");
Clazz_defineMethod(c$, "setFileLoadStatus", 
function(fullPathName, fileName, modelName, errorMsg, ptLoad, doCallback, isAsync){
if (fullPathName == null && "resetUndo".equals(fileName)) {
var appConsole = this.vwr.getProperty("DATA_API", "getAppConsole", null);
if (appConsole != null) appConsole.zap();
fileName = this.vwr.getZapName();
}this.setStatusChanged("fileLoaded", ptLoad, fullPathName, false);
if (errorMsg != null) this.setStatusChanged("fileLoadError", ptLoad, errorMsg, false);
var sJmol = this.getJmolScriptCallback(J.c.CBK.LOADSTRUCT);
var isEnabled = doCallback && this.notifyEnabled(J.c.CBK.LOADSTRUCT);
if (isEnabled || sJmol != null) {
var name = this.vwr.getP("_smilesString");
if (name.length != 0) fileName = name;
this.fireJmolScriptCallback(isEnabled, J.c.CBK.LOADSTRUCT,  Clazz_newArray(-1, [sJmol, fullPathName, fileName, modelName, errorMsg, Integer.$valueOf(ptLoad), this.vwr.getP("_modelNumber"), this.vwr.getModelNumberDotted(this.vwr.ms.mc - 1), isAsync]), true);
}}, "~S,~S,~S,~S,~N,~B,Boolean");
Clazz_defineMethod(c$, "setStatusModelKit", 
function(istate){
var state = (istate == 1 ? "ON" : "OFF");
this.setStatusChanged("modelkit", istate, state, false);
var sJmol = this.getJmolScriptCallback(J.c.CBK.MODELKIT);
var isEnabled = this.notifyEnabled(J.c.CBK.MODELKIT);
if (isEnabled || sJmol != null) this.fireJmolScriptCallback(isEnabled, J.c.CBK.MODELKIT,  Clazz_newArray(-1, [sJmol, state]), true);
}, "~N");
Clazz_defineMethod(c$, "setStatusFrameChanged", 
function(fileNo, modelNo, firstNo, lastNo, currentFrame, currentMorphModel, entryName){
if (this.vwr.ms == null) return;
var animating = this.vwr.am.animationOn;
var frameNo = (animating ? -2 - currentFrame : currentFrame);
this.setStatusChanged("frameChanged", frameNo, (currentFrame >= 0 ? this.vwr.getModelNumberDotted(currentFrame) : ""), false);
var sJmol = this.getJmolScriptCallback(J.c.CBK.ANIMFRAME);
var isEnabled = this.notifyEnabled(J.c.CBK.ANIMFRAME);
if (isEnabled || sJmol != null) this.fireJmolScriptCallback(isEnabled, J.c.CBK.ANIMFRAME,  Clazz_newArray(-1, [sJmol,  Clazz_newIntArray(-1, [frameNo, fileNo, modelNo, firstNo, lastNo, currentFrame]), entryName, Float.$valueOf(currentMorphModel)]), false);
if (!animating && !this.vwr.isJSNoAWT) this.vwr.checkMenuUpdate();
}, "~N,~N,~N,~N,~N,~N,~S");
Clazz_defineMethod(c$, "setStatusDragDropped", 
function(mode, x, y, fileName, retType){
this.setStatusChanged("dragDrop", 0, "", false);
var sJmol = this.getJmolScriptCallback(J.c.CBK.DRAGDROP);
var isEnabled = this.notifyEnabled(J.c.CBK.DRAGDROP);
if (isEnabled || sJmol != null) this.fireJmolScriptCallback(isEnabled, J.c.CBK.DRAGDROP,  Clazz_newArray(-1, [sJmol, Integer.$valueOf(mode), Integer.$valueOf(x), Integer.$valueOf(y), fileName, retType == null ?  new Array(1) : retType]), true);
return isEnabled;
}, "~N,~N,~N,~S,~A");
Clazz_defineMethod(c$, "setScriptEcho", 
function(strEcho, isScriptQueued){
if (strEcho == null || this.echoing) return;
this.echoing = true;
this.setStatusChanged("scriptEcho", 0, strEcho, false);
var sJmol = this.getJmolScriptCallback(J.c.CBK.ECHO);
var isEnabled = this.notifyEnabled(J.c.CBK.ECHO);
if (isEnabled || sJmol != null) {
this.fireJmolScriptCallback(isEnabled, J.c.CBK.ECHO,  Clazz_newArray(-1, [sJmol, strEcho, Integer.$valueOf(isScriptQueued ? 1 : 0)]), true);
}this.echoing = false;
}, "~S,~B");
Clazz_defineMethod(c$, "setStatusMeasuring", 
function(status, intInfo, strMeasure, value){
this.setStatusChanged(status, intInfo, strMeasure, false);
var sJmol = null;
if (status.equals("measureCompleted")) {
JU.Logger.info("measurement[" + intInfo + "] = " + strMeasure);
sJmol = this.getJmolScriptCallback(J.c.CBK.MEASURE);
} else if (status.equals("measurePicked")) {
this.setStatusChanged("measurePicked", intInfo, strMeasure, false);
JU.Logger.info("measurePicked " + intInfo + " " + strMeasure);
}var isEnabled = this.notifyEnabled(J.c.CBK.MEASURE);
if (isEnabled || sJmol != null) this.fireJmolScriptCallback(isEnabled, J.c.CBK.MEASURE,  Clazz_newArray(-1, [sJmol, strMeasure, Integer.$valueOf(intInfo), status, Float.$valueOf(value)]), true);
}, "~S,~N,~S,~N");
Clazz_defineMethod(c$, "notifyError", 
function(errType, errMsg, errMsgUntranslated){
var sJmol = this.getJmolScriptCallback(J.c.CBK.ERROR);
var isEnabled = this.notifyEnabled(J.c.CBK.ERROR);
if (isEnabled || sJmol != null) this.fireJmolScriptCallback(isEnabled, J.c.CBK.ERROR,  Clazz_newArray(-1, [sJmol, errType, errMsg, this.vwr.getShapeErrorState(), errMsgUntranslated]), true);
}, "~S,~S,~S");
Clazz_defineMethod(c$, "notifyMinimizationStatus", 
function(minStatus, minSteps, minEnergy, minEnergyDiff, ff){
var sJmol = this.getJmolScriptCallback(J.c.CBK.MINIMIZATION);
var isEnabled = this.notifyEnabled(J.c.CBK.MINIMIZATION);
if (isEnabled || sJmol != null) this.fireJmolScriptCallback(isEnabled, J.c.CBK.MINIMIZATION,  Clazz_newArray(-1, [sJmol, minStatus, minSteps, minEnergy, minEnergyDiff, ff]), true);
}, "~S,Integer,Float,Float,~S");
Clazz_defineMethod(c$, "setScriptStatus", 
function(strStatus, statusMessage, msWalltime, strErrorMessageUntranslated){
if (msWalltime < -1) {
var iscript = -2 - msWalltime;
this.setStatusChanged("scriptStarted", iscript, statusMessage, false);
strStatus = "script " + iscript + " started";
} else if (strStatus == null) {
return;
}var sJmol = (msWalltime == 0 ? this.getJmolScriptCallback(J.c.CBK.SCRIPT) : null);
var isScriptCompletion = (strStatus === "Script completed");
if (this.recordStatus("script")) {
var isError = (strErrorMessageUntranslated != null);
this.setStatusChanged((isError ? "scriptError" : "scriptStatus"), 0, strStatus, false);
if (isError || isScriptCompletion) this.setStatusChanged("scriptTerminated", 1, "Jmol script terminated" + (isError ? " unsuccessfully: " + strStatus : " successfully"), false);
}if (isScriptCompletion && this.vwr.getBoolean(603979879) && this.vwr.getBoolean(603979825)) strStatus = this.vwr.getChimeMessenger().scriptCompleted(this, statusMessage, strErrorMessageUntranslated);
var data =  Clazz_newArray(-1, [sJmol, strStatus, statusMessage, Integer.$valueOf(isScriptCompletion ? -1 : msWalltime), strErrorMessageUntranslated]);
var isEnabled = this.notifyEnabled(J.c.CBK.SCRIPT);
if (isEnabled || sJmol != null) this.fireJmolScriptCallback(isEnabled, J.c.CBK.SCRIPT, data, true);
this.processScript(data);
}, "~S,~S,~N,~S");
Clazz_defineMethod(c$, "processScript", 
function(data){
var msWalltime = (data[3]).intValue();
this.vwr.notifyScriptEditor(msWalltime, data);
if (msWalltime == 0) this.vwr.sendConsoleMessage(data[1] == null ? null : data[1].toString());
}, "~A");
Clazz_defineMethod(c$, "doSync", 
function(){
return (this.isSynced && this.drivingSync && !this.syncDisabled);
});
Clazz_defineMethod(c$, "setSync", 
function(mouseCommand){
if (this.syncingMouse) {
if (mouseCommand != null) {
var sJmol = this.getJmolScriptCallback(J.c.CBK.SYNC);
if (sJmol != null) this.fireJmolScriptCallback(false, J.c.CBK.SYNC,  Clazz_newArray(-1, [sJmol, mouseCommand, "sending mouseSync"]), true);
this.syncSend(mouseCommand, "*", 0);
}} else if (!this.syncingScripts) this.syncSend("!" + this.vwr.tm.getMoveToText(this.minSyncRepeatMs / 1000, false), "*", 0);
}, "~S");
Clazz_defineMethod(c$, "setSyncDriver", 
function(syncMode){
if (this.stereoSync && syncMode != 4) {
this.syncSend("SET_GRAPHICS_OFF", "*", 0);
this.stereoSync = false;
}switch (syncMode) {
case 4:
if (!this.syncDisabled) return;
this.syncDisabled = false;
break;
case 3:
this.syncDisabled = true;
break;
case 5:
this.drivingSync = true;
this.isSynced = true;
this.stereoSync = true;
break;
case 1:
this.drivingSync = true;
this.isSynced = true;
break;
case 2:
this.drivingSync = false;
this.isSynced = true;
break;
default:
this.drivingSync = false;
this.isSynced = false;
}
if (JU.Logger.debugging) {
JU.Logger.debug(this.vwr.appletName + " sync mode=" + syncMode + "; synced? " + this.isSynced + "; driving? " + this.drivingSync + "; disabled? " + this.syncDisabled);
}}, "~N");
Clazz_defineMethod(c$, "syncSend", 
function(script, appletNameOrProp, port){
if (port == 0 && !this.notifyEnabled(J.c.CBK.SYNC)) return null;
var o =  Clazz_newArray(-1, [null, script, appletNameOrProp, Integer.$valueOf(port)]);
if (this.cbl != null) this.cbl.notifyCallback(J.c.CBK.SYNC, o);
return o[0];
}, "~S,~O,~N");
Clazz_defineMethod(c$, "processService", 
function(info){
var s = info.get("service");
if (s == null || !this.notifyEnabled(J.c.CBK.SERVICE)) return null;
if (Clazz_instanceOf(s,"JS.SV")) {
var m =  new java.util.Hashtable();
for (var e, $e = info.entrySet().iterator (); $e.hasNext()&& ((e = $e.next ()) || true);) m.put(e.getKey(), JS.SV.oValue(e.getValue()));

info = m;
}this.cbl.notifyCallback(J.c.CBK.SERVICE,  Clazz_newArray(-1, [null, info]));
return info;
}, "java.util.Map");
Clazz_defineMethod(c$, "getSyncMode", 
function(){
return (!this.isSynced ? 0 : this.drivingSync ? 1 : 2);
});
Clazz_defineMethod(c$, "showUrl", 
function(urlString){
if (this.jsl != null) this.jsl.showUrl(urlString);
}, "~S");
Clazz_defineMethod(c$, "clearConsole", 
function(){
this.vwr.sendConsoleMessage(null);
if (this.jsl != null) this.cbl.notifyCallback(J.c.CBK.MESSAGE, null);
});
Clazz_defineMethod(c$, "functionXY", 
function(functionName, nX, nY){
return (this.jsl == null ?  Clazz_newFloatArray (Math.abs(nX), Math.abs(nY), 0) : this.jsl.functionXY(functionName, nX, nY));
}, "~S,~N,~N");
Clazz_defineMethod(c$, "functionXYZ", 
function(functionName, nX, nY, nZ){
return (this.jsl == null ?  Clazz_newFloatArray (Math.abs(nX), Math.abs(nY), Math.abs(nY), 0) : this.jsl.functionXYZ(functionName, nX, nY, nZ));
}, "~S,~N,~N,~N");
Clazz_defineMethod(c$, "jsEval", 
function(strEval){
return (this.jsl == null ? "" : this.jsl.eval(strEval));
}, "~S");
Clazz_defineMethod(c$, "createImage", 
function(fileNameOrError, type, text, bytes, quality){
return (this.jsl == null ? null : this.jsl.createImage(fileNameOrError, type, text == null ? bytes : text, quality));
}, "~S,~S,~S,~A,~N");
Clazz_defineMethod(c$, "getRegistryInfo", 
function(){
return (this.jsl == null ? null : this.jsl.getRegistryInfo());
});
Clazz_defineMethod(c$, "dialogAsk", 
function(type, fileName, params){
var isImage = type.equals("Save Image");
var sd = J.api.Interface.getOption("dialog.Dialog", this.vwr, "status");
if (sd == null) return null;
sd.setupUI(false);
if (isImage) sd.setImageInfo(this.qualityJPG, this.qualityPNG, this.imageType);
var outputFileName = sd.getFileNameFromDialog(this.vwr, type, fileName);
if (isImage && outputFileName != null) {
this.qualityJPG = sd.getQuality("JPG");
this.qualityPNG = sd.getQuality("PNG");
var sType = sd.getType();
if (params != null) {
params.put("qualityJPG", Integer.$valueOf(this.qualityJPG));
params.put("qualityPNG", Integer.$valueOf(this.qualityPNG));
if (sType != null) params.put("dialogImageType", sType);
}if (sType != null) this.imageType = sType;
}return outputFileName;
}, "~S,~S,java.util.Map");
Clazz_defineMethod(c$, "resizeInnerPanel", 
function(width, height){
return (this.jsl == null || width == this.vwr.getScreenWidth() && height == this.vwr.getScreenHeight() ?  Clazz_newIntArray(-1, [width, height]) : this.jsl.resizeInnerPanel("preferredWidthHeight " + width + " " + height + ";"));
}, "~N,~N");
Clazz_defineMethod(c$, "resizeInnerPanelString", 
function(data){
if (this.jsl != null) this.jsl.resizeInnerPanel(data);
}, "~S");
Clazz_defineMethod(c$, "registerAudio", 
function(id, htParams){
this.stopAudio(id);
if (this.audios == null) this.audios =  new java.util.Hashtable();
if (htParams == null) this.audios.remove(id);
 else this.audios.put(id, htParams.get("audioPlayer"));
}, "~S,java.util.Map");
Clazz_defineMethod(c$, "stopAudio", 
function(id){
if (this.audios == null) return;
if (id == null) {
this.closeAllAudio();
return;
}var player = this.audios.get(id);
if (player != null) player.action("kill");
}, "~S");
Clazz_defineMethod(c$, "playAudio", 
function(htParams){
if (!this.vwr.getBoolean(603979797)) {
if (htParams == null) return;
htParams.put("status", "close");
JU.Logger.info("allowAudio is set false");
this.notifyAudioStatus(htParams);
return;
}try {
var action = (htParams == null ? "close" : htParams.get("action"));
var id = (htParams == null ? null : htParams.get("id"));
if (action != null && action.length > 0) {
if (id == null || id.length == 0) {
if (this.audios == null || this.audios.isEmpty()) return;
if (action.equals("close")) {
this.closeAllAudio();
}return;
}var player = (this.audios == null ? null : this.audios.get(id));
if (player != null) {
player.action(action);
return;
}}try {
(J.api.Interface.getInterface("JU.JmolAudio", this.vwr, "script")).playAudio(this.vwr, htParams);
} catch (e) {
if (Clazz_exceptionOf(e, Exception)){
JU.Logger.info(e.getMessage());
} else {
throw e;
}
}
} catch (t) {
}
}, "java.util.Map");
Clazz_defineMethod(c$, "closeAllAudio", 
function(){
for (var key, $key = this.audios.keySet().iterator (); $key.hasNext()&& ((key = $key.next ()) || true);) {
System.out.println("AUDIO " + key);
this.audios.get(key).action("close");
}
this.audios.clear();
});
Clazz_defineMethod(c$, "notifyAudioStatus", 
function(htParams){
var status = htParams.get("status");
var script = htParams.get(status);
if (script != null) this.vwr.script(script);
var sJmol = this.getJmolScriptCallback(J.c.CBK.AUDIO);
var isEnabled = this.notifyEnabled(J.c.CBK.AUDIO);
if (isEnabled || sJmol != null) this.fireJmolScriptCallback(isEnabled, J.c.CBK.AUDIO,  Clazz_newArray(-1, [sJmol, htParams, status]), true);
if (status === "ended" && htParams.get("autoclose") !== Boolean.FALSE) this.registerAudio(htParams.get("id"), null);
}, "java.util.Map");
Clazz_defineMethod(c$, "syncScriptErr", 
function(script){
return this.syncScript(script, "?", 0);
}, "~S");
Clazz_defineMethod(c$, "syncScript", 
function(script, applet, port){
if ("GET_GRAPHICS".equalsIgnoreCase(script)) {
this.setSyncDriver(5);
this.syncSend(script, applet, 0);
this.vwr.setBooleanProperty("_syncMouse", false);
this.vwr.setBooleanProperty("_syncScript", false);
return null;
}if ("=".equals(applet)) {
applet = "~";
this.setSyncDriver(2);
}var disableSend = "~".equals(applet);
if (port > 0 || !disableSend && !".".equals(applet)) {
var msg = this.syncSend(script, applet, port);
if (!"*".equals(applet) || script.startsWith("{")) return ("?".equals(applet) ? msg : null);
}switch (script.toLowerCase()) {
case "on":
case "true":
this.setSyncDriver(1);
return null;
case "off":
case "false":
this.setSyncDriver(0);
return null;
case "slave":
this.setSyncDriver(2);
return null;
}
var syncMode = this.getSyncMode();
if (syncMode == 0) return null;
if (syncMode != 1) disableSend = false;
if (JU.Logger.debugging) JU.Logger.debug(this.vwr.htmlName + " syncing with script: " + script);
if (disableSend) this.setSyncDriver(3);
if (script.indexOf("Mouse: ") != 0) {
var serviceMode = JV.JC.getServiceCommand(script);
switch (serviceMode) {
case 70:
case 42:
case 49:
case 56:
case 63:
this.syncSend(script, ".", port);
return null;
case -1:
break;
case 0:
case 77:
case 28:
case 35:
if (disableSend) return null;
case 21:
case 7:
case 14:
if ((script = this.vwr.getJSV().processSync(script, serviceMode)) == null) return null;
}
this.vwr.evalStringQuietSync(script, true, false);
return null;
}this.mouseScript(script);
if (disableSend) this.vwr.setSyncDriver(4);
return null;
}, "~S,~S,~N");
Clazz_defineMethod(c$, "mouseScript", 
function(script){
var tokens = JU.PT.getTokens(script);
var key = tokens[1];
try {
key = (key.toLowerCase() + "...............").substring(0, 15);
switch (("zoombyfactor...zoomby.........rotatezby......rotatexyby.....translatexyby..rotatemolecule.spinxyby.......rotatearcball..").indexOf(key)) {
case 0:
switch (tokens.length) {
case 3:
this.vwr.zoomByFactor(JU.PT.parseFloat(tokens[2]), 2147483647, 2147483647);
return;
case 5:
this.vwr.zoomByFactor(JU.PT.parseFloat(tokens[2]), JU.PT.parseInt(tokens[3]), JU.PT.parseInt(tokens[4]));
return;
}
break;
case 15:
switch (tokens.length) {
case 3:
this.vwr.zoomBy(JU.PT.parseInt(tokens[2]));
return;
}
break;
case 30:
switch (tokens.length) {
case 3:
this.vwr.rotateZBy(JU.PT.parseInt(tokens[2]), 2147483647, 2147483647);
return;
case 5:
this.vwr.rotateZBy(JU.PT.parseInt(tokens[2]), JU.PT.parseInt(tokens[3]), JU.PT.parseInt(tokens[4]));
}
break;
case 45:
this.vwr.rotateXYBy(JU.PT.parseFloat(tokens[2]), JU.PT.parseFloat(tokens[3]));
return;
case 60:
this.vwr.translateXYBy(JU.PT.parseInt(tokens[2]), JU.PT.parseInt(tokens[3]));
return;
case 75:
this.vwr.rotateSelected(JU.PT.parseFloat(tokens[2]), JU.PT.parseFloat(tokens[3]), null);
return;
case 90:
this.vwr.spinXYBy(JU.PT.parseInt(tokens[2]), JU.PT.parseInt(tokens[3]), JU.PT.parseFloat(tokens[4]));
return;
case 105:
this.vwr.rotateXYBy(JU.PT.parseInt(tokens[2]), JU.PT.parseInt(tokens[3]));
return;
}
} catch (e) {
if (Clazz_exceptionOf(e, Exception)){
} else {
throw e;
}
}
this.vwr.showString("error reading SYNC command: " + script, false);
}, "~S");
Clazz_defineMethod(c$, "processPluginRequest", 
function(name, action, value){
return (this.jsl == null ? null : this.jsl.processPluginRequest(name, action, value));
}, "~S,~S,~O");
c$.MAXIMUM_QUEUE_LENGTH = 16;
});
;//5.0.1-v7 Mon Aug 24 10:01:38 CDT 2026
Clazz_declarePackage("JV");
Clazz_load(["JU.A4", "$.M3", "$.M4", "$.P3", "$.P3i", "$.V3", "J.c.STER", "JU.Point3fi"], "JV.TransformManager", ["java.util.Hashtable", "JU.P4", "$.Quat", "$.SB", "J.api.Interface", "JU.Escape", "$.Logger"], function(){
var c$ = Clazz_decorateAsClass(function(){
this.vwr = null;
this.movetoThread = null;
this.vibrationThread = null;
this.spinThread = null;
this.perspectiveModel = 11;
this.cameraScaleFactor = 0;
this.referencePlaneOffset = 0;
this.aperatureAngle = 0;
this.cameraDistanceFromCenter = 0;
this.modelCenterOffset = 0;
this.modelRadius = 0;
this.modelRadiusPixels = 0;
this.navigationCenter = null;
this.navigationOffset = null;
this.navigationShiftXY = null;
this.navigationDepthPercent = 0;
this.matrixTemp = null;
this.vectorTemp = null;
this.splitFrameCurrentlyRendering = -1;
this.haveNotifiedNaN = false;
this.spinX = 0;
this.spinY = 30;
this.spinZ = 0;
this.spinFps = 30;
this.navX = 0;
this.navY = 0;
this.navZ = 0;
this.navFps = NaN;
this.isSpinInternal = false;
this.isSpinFixed = false;
this.isSpinSelected = false;
this.doTransform4D = false;
this.fixedRotationOffset = null;
this.fixedRotationCenter = null;
this.perspectiveOffset = null;
this.perspectiveShiftXY = null;
this.rotationCenterDefault = null;
this.rotationRadiusDefault = 0;
this.fixedRotationAxis = null;
this.internalRotationAxis = null;
this.internalTranslation = null;
this.internalRotationCenter = null;
this.internalRotationAngle = 0;
this.matrixRotate = null;
this.matrixTemp3 = null;
this.matrixTemp4 = null;
this.axisangleT = null;
this.vectorT = null;
this.vectorT2 = null;
this.pointT2 = null;
this.rotationAxis = null;
this.rotationRate = 0;
this.fixedTranslation = null;
this.camera = null;
this.cameraSetting = null;
this.xTranslationFraction = 0.5;
this.yTranslationFraction = 0.5;
this.prevZoomSetting = 0;
this.previousX = 0;
this.previousY = 0;
this.zoomEnabled = true;
this.zmPct = 100;
this.zmPctSet = 100;
this.zoomRatio = 0;
this.slabEnabled = false;
this.zShadeEnabled = false;
this.internalSlab = false;
this.slabPercentSetting = 0;
this.depthPercentSetting = 0;
this.slabValue = 0;
this.depthValue = 0;
this.zSlabPercentSetting = 50;
this.zDepthPercentSetting = 0;
this.zSlabPoint = null;
this.zSlabValue = 0;
this.zDepthValue = 0;
this.slabRange = 0;
this.slabPlane = null;
this.depthPlane = null;
this.perspectiveDepth = true;
this.scale3D = false;
this.cameraDepth = 3;
this.cameraDepthSetting = 3;
this.visualRangeAngstroms = 0;
this.cameraDistance = 1000;
this.width = 0;
this.height = 0;
this.screenPixelCount = 0;
this.scalePixelsPerAngstrom = 0;
this.scaleDefaultPixelsPerAngstrom = 0;
this.scale3DAngstromsPerInch = 0;
this.antialias = false;
this.useZoomLarge = false;
this.zoomHeight = false;
this.screenWidth = 0;
this.screenHeight = 0;
this.matrixTransform = null;
this.matrixTransformInv = null;
this.fScrPtSafe = null;
this.iScrPt = null;
this.ptVibTemp = null;
this.fScrPt = null;
this.iScrPtSafe = null;
this.ptVibTempSafe = null;
this.navigating = false;
this.mode = 0;
this.defaultMode = 0;
this.untransformedPoint = null;
this.ptTest1 = null;
this.ptTest2 = null;
this.ptTest3 = null;
this.aaTest1 = null;
this.matrixTest = null;
this.spinOn = false;
this.vectorSpinOnly = false;
this.navOn = false;
this.spinIsGesture = false;
this.vibrationOn = false;
this.vibrationPeriod = 0;
this.vibrationPeriodMs = 0;
this.vibrationScale = 0;
this.vibrationT = null;
this.stereoMode = null;
this.stereoColors = null;
this.stereoDoubleFull = false;
this.stereoDoubleDTI = false;
this.stereoDegrees = NaN;
this.stereoRadians = 0;
this.stereoFrame = false;
this.matrixStereo = null;
this.windowCentered = false;
this.frameOffset = null;
this.frameOffsets = null;
this.bsFrameOffsets = null;
this.bsSelectedAtoms = null;
this.ptOffset = null;
this.navMode = 1;
this.zoomFactor = 3.4028235E38;
this.navigationSlabOffset = 0;
this.nav = null;
Clazz_instantialize(this, arguments);}, JV, "TransformManager", null);
Clazz_prepareFields (c$, function(){
this.navigationCenter =  new JU.P3();
this.navigationOffset =  new JU.P3();
this.navigationShiftXY =  new JU.P3();
this.matrixTemp =  new JU.M4();
this.vectorTemp =  new JU.V3();
this.fixedRotationOffset =  new JU.P3();
this.fixedRotationCenter =  new JU.P3();
this.perspectiveOffset =  new JU.P3();
this.perspectiveShiftXY =  new JU.P3();
this.rotationCenterDefault =  new JU.P3();
this.fixedRotationAxis =  new JU.A4();
this.internalRotationAxis =  new JU.A4();
this.internalRotationCenter = JU.P3.new3(0, 0, 0);
this.matrixRotate =  new JU.M3();
this.matrixTemp3 =  new JU.M3();
this.matrixTemp4 =  new JU.M4();
this.axisangleT =  new JU.A4();
this.vectorT =  new JU.V3();
this.vectorT2 =  new JU.V3();
this.pointT2 =  new JU.P3();
this.rotationAxis =  new JU.V3();
this.fixedTranslation =  new JU.P3();
this.camera =  new JU.P3();
this.cameraSetting =  new JU.P3();
this.matrixTransform =  new JU.M4();
this.matrixTransformInv =  new JU.M4();
this.fScrPtSafe =  new JU.P3();
this.iScrPt =  new JU.P3i();
this.ptVibTemp =  new JU.Point3fi();
this.fScrPt =  new JU.P3();
this.iScrPtSafe =  new JU.P3i();
this.ptVibTempSafe =  new JU.Point3fi();
this.untransformedPoint =  new JU.P3();
this.ptTest1 =  new JU.P3();
this.ptTest2 =  new JU.P3();
this.ptTest3 =  new JU.P3();
this.aaTest1 =  new JU.A4();
this.matrixTest =  new JU.M3();
this.vibrationT =  new JU.P3();
this.stereoMode = J.c.STER.NONE;
this.matrixStereo =  new JU.M3();
this.frameOffset =  new JU.P3();
this.ptOffset =  new JU.P3();
});
Clazz_makeConstructor(c$, 
function(){
});
c$.getTransformManager = Clazz_defineMethod(c$, "getTransformManager", 
function(vwr, width, height, is4D){
var me = (is4D ? J.api.Interface.getInterface("JV.TransformManager4D", vwr, "tm") :  new JV.TransformManager());
me.vwr = vwr;
me.setScreenParameters(width, height, true, false, true, true);
return me;
}, "JV.Viewer,~N,~N,~B");
Clazz_defineMethod(c$, "setDefaultPerspective", 
function(){
this.setCameraDepthPercent(3.0, true);
this.setPerspectiveDepth(true);
this.setStereoDegrees(-5);
this.visualRangeAngstroms = 5.0;
this.setSpinOff();
this.setVibrationPeriod(0);
});
Clazz_defineMethod(c$, "homePosition", 
function(resetSpin){
if (resetSpin) this.setSpinOff();
this.setNavOn(false);
this.navFps = 10;
this.navX = this.navY = this.navZ = 0;
this.rotationCenterDefault.setT(this.vwr.getBoundBoxCenter());
this.setFixedRotationCenter(this.rotationCenterDefault);
this.rotationRadiusDefault = this.setRotationRadius(0, true);
this.windowCentered = true;
this.setRotationCenterAndRadiusXYZ(null, true);
this.resetRotation();
var m = this.vwr.ms.getInfoM("defaultOrientationMatrix");
if (m != null) this.setRotation(m);
this.setZoomEnabled(true);
this.zoomToPercent(this.vwr.g.modelKitMode ? 50 : 100);
this.zmPct = this.zmPctSet;
this.slabReset();
this.resetFitToScreen(true);
if (this.vwr.isJmolDataFrame()) {
this.fixedRotationCenter.set(0, 0, 0);
} else {
if (this.vwr.g.axesOrientationRasmol) this.matrixRotate.setAsXRotation(3.141592653589793);
}this.vwr.stm.saveOrientation("default", null);
if (this.mode == 1) this.setNavigationMode(true);
}, "~B");
Clazz_defineMethod(c$, "setRotation", 
function(m){
if (m.isRotation()) this.matrixRotate.setM3(m);
 else this.resetRotation();
}, "JU.M3");
Clazz_defineMethod(c$, "resetRotation", 
function(){
this.matrixRotate.setScale(1);
});
Clazz_defineMethod(c$, "clearThreads", 
function(){
this.clearVibration();
this.clearSpin();
this.setNavOn(false);
this.stopMotion();
});
Clazz_defineMethod(c$, "clear", 
function(){
this.fixedRotationCenter.set(0, 0, 0);
this.navigating = false;
this.slabPlane = null;
this.depthPlane = null;
this.zSlabPoint = null;
this.resetNavigationPoint(true);
});
Clazz_defineMethod(c$, "setFixedRotationCenter", 
function(center){
if (center == null) return;
this.fixedRotationCenter.setT(center);
}, "JU.T3");
Clazz_defineMethod(c$, "setRotationPointXY", 
function(center){
var newCenterScreen = this.transformPtSafe(center);
this.fixedTranslation.set(newCenterScreen.x, newCenterScreen.y, 0);
}, "JU.P3");
Clazz_defineMethod(c$, "spinXYBy", 
function(xDelta, yDelta, speed){
if (xDelta == 0 && yDelta == 0) {
if (this.spinThread != null && this.spinIsGesture) this.clearSpin();
return;
}this.clearSpin();
var pt1 = JU.P3.newP(this.fixedRotationCenter);
var ptScreen =  new JU.P3();
this.transformPt3fSafe(pt1, ptScreen);
var pt2 = JU.P3.new3(-yDelta, xDelta, 0);
pt2.add(ptScreen);
this.unTransformPoint(pt2, pt2);
this.vwr.setInMotion(false);
this.rotateAboutPointsInternal(null, pt2, pt1, 10 * speed, NaN, false, true, null, true, null, null, null, null, null, false, null);
}, "~N,~N,~N");
Clazz_defineMethod(c$, "rotateXYBy", 
function(degX, degY, bsAtoms){
if (this.vwr.is2D()) return;
this.rotate3DBall(degX, degY, bsAtoms);
}, "~N,~N,JU.BS");
Clazz_defineMethod(c$, "rotateZBy", 
function(zDelta, x, y){
if (x != 2147483647 && y != 2147483647) this.resetXYCenter(x, y);
this.rotateZRadians((zDelta / 57.29577951308232));
}, "~N,~N,~N");
Clazz_defineMethod(c$, "applyRotation", 
function(mNew, isInternal, bsAtoms, translation, translationOnly, m4, useModelKit){
if (bsAtoms == null) {
this.matrixRotate.mul2(mNew, this.matrixRotate);
return;
}this.vwr.moveAtoms(m4, mNew, this.matrixRotate, translation, this.internalRotationCenter, isInternal, bsAtoms, translationOnly, useModelKit);
if (translation != null) {
this.internalRotationCenter.add(translation);
}}, "JU.M3,~B,JU.BS,JU.V3,~B,JU.M4,~B");
Clazz_defineMethod(c$, "rotate3DBall", 
function(xDeg, yDeg, bsAtoms){
if (this.matrixTemp3.setAsBallRotation(0.017453292519943295, -yDeg, -xDeg)) this.applyRotation(this.matrixTemp3, false, bsAtoms, null, false, null, true);
}, "~N,~N,JU.BS");
Clazz_defineMethod(c$, "rotateXRadians", 
function(angleRadians, bsAtoms){
this.applyRotation(this.matrixTemp3.setAsXRotation(angleRadians), false, bsAtoms, null, false, null, false);
}, "~N,JU.BS");
Clazz_defineMethod(c$, "rotateYRadians", 
function(angleRadians, bsAtoms){
this.applyRotation(this.matrixTemp3.setAsYRotation(angleRadians), false, bsAtoms, null, false, null, false);
}, "~N,JU.BS");
Clazz_defineMethod(c$, "rotateZRadians", 
function(angleRadians){
this.applyRotation(this.matrixTemp3.setAsZRotation(angleRadians), false, null, null, false, null, false);
}, "~N");
Clazz_defineMethod(c$, "rotateAxisAngle", 
function(rotAxis, radians){
this.axisangleT.setVA(rotAxis, radians);
this.rotateAxisAngle2(this.axisangleT, null);
}, "JU.V3,~N");
Clazz_defineMethod(c$, "rotateAxisAngle2", 
function(axisAngle, bsAtoms){
this.applyRotation(this.matrixTemp3.setAA(axisAngle), false, bsAtoms, null, false, null, false);
}, "JU.A4,JU.BS");
Clazz_defineMethod(c$, "rotateAxisAngleAtCenter", 
function(eval, rotCenter, rotAxis, degreesPerSecond, endDegrees, isSpin, bsAtoms){
if (rotCenter != null) this.moveRotationCenter(rotCenter, true);
if (isSpin) this.setSpinOff();
this.setNavOn(false);
if (this.vwr.headless) {
if (isSpin && endDegrees == 3.4028235E38) return false;
isSpin = false;
}if (Float.isNaN(degreesPerSecond) || degreesPerSecond == 0 || endDegrees == 0) return false;
if (rotCenter != null) {
this.setRotationPointXY(rotCenter);
}this.setFixedRotationCenter(rotCenter);
this.rotationAxis.setT(rotAxis);
this.rotationRate = degreesPerSecond;
if (isSpin) {
this.fixedRotationAxis.setVA(rotAxis, (degreesPerSecond * 0.017453292519943295));
this.isSpinInternal = false;
this.isSpinFixed = true;
this.isSpinSelected = (bsAtoms != null);
this.setSpin(eval, true, endDegrees, null, null, null, bsAtoms, false, null, -1);
return (endDegrees != 3.4028235E38);
}var radians = (endDegrees * 0.017453292519943295);
this.fixedRotationAxis.setVA(rotAxis, endDegrees);
this.rotateAxisAngleRadiansFixed(radians, bsAtoms);
return true;
}, "J.api.JmolScriptEvaluator,JU.P3,JU.V3,~N,~N,~B,JU.BS");
Clazz_defineMethod(c$, "rotateAxisAngleRadiansFixed", 
function(angleRadians, bsAtoms){
this.axisangleT.setAA(this.fixedRotationAxis);
this.axisangleT.angle = angleRadians;
this.rotateAxisAngle2(this.axisangleT, bsAtoms);
}, "~N,JU.BS");
Clazz_defineMethod(c$, "rotateAboutPointsInternal", 
function(eval, point1, point2, degreesPerSecond, endDegrees, isClockwise, isSpin, bsAtoms, isGesture, translation, finalPoints, dihedralList, vectorMatrix, m4, useModelKit, centerAndPoints){
if (isSpin) this.setSpinOff();
this.setNavOn(false);
if (vectorMatrix == null && dihedralList == null && centerAndPoints == null && (translation == null || translation.length() < 0.001) && (isSpin ? Float.isNaN(degreesPerSecond) || degreesPerSecond == 0 : endDegrees == 0)) return false;
var axis = null;
if (dihedralList == null && vectorMatrix == null) {
axis = JU.V3.newVsub(point2, point1);
if (isClockwise) axis.scale(-1.0);
this.internalRotationCenter.setT(point1);
this.rotationAxis.setT(axis);
this.internalTranslation = (translation == null ? null : JU.V3.newV(translation));
}var isSelected = (bsAtoms != null);
var nFrames = -1;
if (isSpin) {
if (dihedralList == null && vectorMatrix == null) {
if (endDegrees == 0) endDegrees = NaN;
if (Float.isNaN(endDegrees)) {
this.rotationRate = degreesPerSecond;
} else {
nFrames = Clazz_doubleToInt(Math.abs(endDegrees) / Math.abs(degreesPerSecond) * this.spinFps + 0.5);
this.rotationRate = degreesPerSecond = endDegrees / nFrames * this.spinFps;
if (translation != null) this.internalTranslation.scale(1 / nFrames);
}this.internalRotationAxis.setVA(axis, ((Float.isNaN(this.rotationRate) ? 0 : this.rotationRate) * 0.017453292519943295));
this.isSpinInternal = true;
this.isSpinFixed = false;
this.isSpinSelected = isSelected;
} else {
endDegrees = degreesPerSecond;
}this.setSpin(eval, true, endDegrees, finalPoints, dihedralList, vectorMatrix, bsAtoms, isGesture, centerAndPoints, centerAndPoints == null ? -1 : nFrames);
return !Float.isNaN(endDegrees);
}var radians = (endDegrees * 0.017453292519943295);
this.internalRotationAxis.setVA(axis, radians);
this.rotateAxisAngleRadiansInternal(radians, bsAtoms, m4, useModelKit);
return false;
}, "J.api.JmolScriptEvaluator,JU.T3,JU.T3,~N,~N,~B,~B,JU.BS,~B,JU.V3,JU.Lst,~A,JU.M3,JU.M4,~B,~A");
Clazz_defineMethod(c$, "rotateAxisAngleRadiansInternal", 
function(radians, bsAtoms, m4, useModelKit){
this.internalRotationAngle = radians;
this.vectorT.set(this.internalRotationAxis.x, this.internalRotationAxis.y, this.internalRotationAxis.z);
this.matrixRotate.rotate2(this.vectorT, this.vectorT2);
this.axisangleT.setVA(this.vectorT2, radians);
this.applyRotation(this.matrixTemp3.setAA(this.axisangleT), true, bsAtoms, this.internalTranslation, radians > 1e6, m4, useModelKit);
if (bsAtoms == null) this.getNewFixedRotationCenter();
}, "~N,JU.BS,JU.M4,~B");
Clazz_defineMethod(c$, "getNewFixedRotationCenter", 
function(){
this.axisangleT.setAA(this.internalRotationAxis);
this.axisangleT.angle = -this.internalRotationAngle;
this.matrixTemp4.setToAA(this.axisangleT);
this.vectorT.setT(this.internalRotationCenter);
this.pointT2.sub2(this.fixedRotationCenter, this.vectorT);
var pt = this.matrixTemp4.rotTrans2(this.pointT2,  new JU.P3());
pt.add(this.vectorT);
this.setRotationCenterAndRadiusXYZ(pt, false);
});
Clazz_defineMethod(c$, "setTranslationFractions", 
function(){
this.xTranslationFraction = this.fixedTranslation.x / this.width;
this.yTranslationFraction = this.fixedTranslation.y / this.height;
});
Clazz_defineMethod(c$, "centerAt", 
function(x, y, pt){
if (pt == null) {
this.translateXYBy(x, y);
return;
}if (this.windowCentered) this.vwr.setBooleanProperty("windowCentered", false);
this.fixedTranslation.x = x;
this.fixedTranslation.y = y;
this.setFixedRotationCenter(pt);
}, "~N,~N,JU.P3");
Clazz_defineMethod(c$, "percentToPixels", 
function(xyz, percent){
switch ((xyz).charCodeAt(0)) {
case 120:
return Clazz_doubleToInt(Math.floor(percent / 100 * this.width));
case 121:
return Clazz_doubleToInt(Math.floor(percent / 100 * this.height));
case 122:
return Clazz_doubleToInt(Math.floor(percent / 100 * this.screenPixelCount));
}
return 0;
}, "~S,~N");
Clazz_defineMethod(c$, "angstromsToPixels", 
function(distance){
return this.scalePixelsPerAngstrom * distance;
}, "~N");
Clazz_defineMethod(c$, "translateXYBy", 
function(xDelta, yDelta){
this.fixedTranslation.x += xDelta;
this.fixedTranslation.y += yDelta;
this.setTranslationFractions();
}, "~N,~N");
Clazz_defineMethod(c$, "setCamera", 
function(x, y){
this.cameraSetting.set(x, y, (x == 0 && y == 0 ? 0 : 1));
}, "~N,~N");
Clazz_defineMethod(c$, "translateToPercent", 
function(type, percent){
switch ((type).charCodeAt(0)) {
case 120:
this.xTranslationFraction = 0.5 + percent / 100;
this.fixedTranslation.x = this.width * this.xTranslationFraction;
return;
case 121:
this.yTranslationFraction = 0.5 + percent / 100;
this.fixedTranslation.y = this.height * this.yTranslationFraction;
return;
case 122:
if (this.mode == 1) this.setNavigationDepthPercent(percent);
return;
}
}, "~S,~N");
Clazz_defineMethod(c$, "getTranslationXPercent", 
function(){
return (this.width == 0 ? 0 : (this.fixedTranslation.x - this.width / 2) * 100 / this.width);
});
Clazz_defineMethod(c$, "getTranslationYPercent", 
function(){
return (this.height == 0 ? 0 : (this.fixedTranslation.y - this.height / 2) * 100 / this.height);
});
Clazz_defineMethod(c$, "getTranslationScript", 
function(){
var info = "";
var f = this.getTranslationXPercent();
if (f != 0.0) info += "translate x " + f + ";";
f = this.getTranslationYPercent();
if (f != 0.0) info += "translate y " + f + ";";
return info;
});
Clazz_defineMethod(c$, "getOrientationText", 
function(type, isBest){
switch (type) {
case 4129:
return this.getMoveToText(1, false);
case 1073742132:
var q = this.getRotationQ();
if (isBest) q = q.inv();
return q.toString();
case 1073742178:
var sb =  new JU.SB();
var d = this.getTranslationXPercent();
JV.TransformManager.truncate2(sb, (isBest ? -d : d));
d = this.getTranslationYPercent();
JV.TransformManager.truncate2(sb, (isBest ? -d : d));
return sb.toString();
default:
return this.getMoveToText(1, true) + "\n#OR\n" + this.getRotateZyzText(true);
}
}, "~N,~B");
Clazz_defineMethod(c$, "getRotationQ", 
function(){
return JU.Quat.newM(this.matrixRotate);
});
Clazz_defineMethod(c$, "getOrientationInfo", 
function(){
var info =  new java.util.Hashtable();
info.put("moveTo", this.getMoveToText(1, false));
info.put("center", "center " + this.getCenterText());
info.put("centerPt", this.fixedRotationCenter);
var aa =  new JU.A4();
aa.setM(this.matrixRotate);
info.put("axisAngle", aa);
info.put("quaternion", this.getRotationQ().toPoint4f());
info.put("rotationMatrix", this.matrixRotate);
info.put("rotateZYZ", this.getRotateZyzText(false));
info.put("rotateXYZ", this.getRotateXyzText());
info.put("transXPercent", Float.$valueOf(this.getTranslationXPercent()));
info.put("transYPercent", Float.$valueOf(this.getTranslationYPercent()));
info.put("zoom", Float.$valueOf(this.zmPct));
info.put("modelRadius", Float.$valueOf(this.modelRadius));
if (this.mode == 1) {
info.put("navigationCenter", "navigate center " + JU.Escape.eP(this.navigationCenter));
info.put("navigationOffsetXPercent", Float.$valueOf(this.getNavigationOffsetPercent('X')));
info.put("navigationOffsetYPercent", Float.$valueOf(this.getNavigationOffsetPercent('Y')));
info.put("navigationDepthPercent", Float.$valueOf(this.navigationDepthPercent));
}return info;
});
Clazz_defineMethod(c$, "getRotation", 
function(m){
m.setM3(this.matrixRotate);
}, "JU.M3");
Clazz_defineMethod(c$, "setZoomHeight", 
function(zoomHeight, zoomLarge){
this.zoomHeight = zoomHeight;
this.scaleFitToScreen(false, zoomLarge, false, true);
}, "~B,~B");
Clazz_defineMethod(c$, "zoomBy", 
function(pixels){
if (pixels > 20) pixels = 20;
 else if (pixels < -20) pixels = -20;
var deltaPercent = pixels * this.zmPctSet / 50;
if (deltaPercent == 0) deltaPercent = (pixels > 0 ? 1 : (deltaPercent < 0 ? -1 : 0));
this.zoomRatio = (deltaPercent + this.zmPctSet) / this.zmPctSet;
this.zmPctSet += deltaPercent;
}, "~N");
Clazz_defineMethod(c$, "zoomByFactor", 
function(factor, x, y){
if (factor <= 0 || !this.zoomEnabled) return;
if (this.mode != 1) {
this.zoomRatio = factor;
this.zmPctSet *= factor;
this.resetXYCenter(x, y);
} else if (this.getNav()) {
this.nav.zoomByFactor(factor, x, y);
}}, "~N,~N,~N");
Clazz_defineMethod(c$, "zoomToPercent", 
function(percentZoom){
this.zmPctSet = percentZoom;
this.zoomRatio = 0;
}, "~N");
Clazz_defineMethod(c$, "translateZBy", 
function(pixels){
if (pixels >= this.screenPixelCount) return;
var sppa = this.scalePixelsPerAngstrom / (1 - pixels * 1.0 / this.screenPixelCount);
if (sppa >= this.screenPixelCount) return;
var newZoomPercent = sppa / this.scaleDefaultPixelsPerAngstrom * 100;
this.zoomRatio = newZoomPercent / this.zmPctSet;
this.zmPctSet = newZoomPercent;
}, "~N");
Clazz_defineMethod(c$, "resetXYCenter", 
function(x, y){
if (x == 2147483647 || y == 2147483647) return;
if (this.windowCentered) this.vwr.setBooleanProperty("windowCentered", false);
var pt =  new JU.P3();
this.transformPt3fSafe(this.fixedRotationCenter, pt);
pt.set(x, y, pt.z);
this.unTransformPoint(pt, pt);
this.fixedTranslation.set(x, y, 0);
this.setFixedRotationCenter(pt);
}, "~N,~N");
Clazz_defineMethod(c$, "zoomByPercent", 
function(percentZoom){
var deltaPercent = percentZoom * this.zmPctSet / 100;
if (deltaPercent == 0) deltaPercent = (percentZoom < 0) ? -1 : 1;
this.zoomRatio = (deltaPercent + this.zmPctSet) / this.zmPctSet;
this.zmPctSet += deltaPercent;
}, "~N");
Clazz_defineMethod(c$, "setScaleAngstromsPerInch", 
function(angstromsPerInch){
this.scale3D = (angstromsPerInch > 0);
if (this.scale3D) this.scale3DAngstromsPerInch = angstromsPerInch;
this.perspectiveDepth = !this.scale3D;
}, "~N");
Clazz_defineMethod(c$, "setSlabRange", 
function(value){
this.slabRange = value;
}, "~N");
Clazz_defineMethod(c$, "setSlabEnabled", 
function(slabEnabled){
this.vwr.g.setB("slabEnabled", this.slabEnabled = slabEnabled);
}, "~B");
Clazz_defineMethod(c$, "setZShadeEnabled", 
function(zShadeEnabled){
this.zShadeEnabled = zShadeEnabled;
this.vwr.g.setB("zShade", zShadeEnabled);
}, "~B");
Clazz_defineMethod(c$, "setZoomEnabled", 
function(zoomEnabled){
this.zoomEnabled = zoomEnabled;
this.vwr.g.setB("zoomEnabled", zoomEnabled);
}, "~B");
Clazz_defineMethod(c$, "slabReset", 
function(){
this.slabToPercent(100);
this.depthToPercent(0);
this.depthPlane = null;
this.slabPlane = null;
this.setSlabEnabled(false);
this.setZShadeEnabled(false);
this.slabDepthChanged();
});
Clazz_defineMethod(c$, "getSlabPercentSetting", 
function(){
return this.slabPercentSetting;
});
Clazz_defineMethod(c$, "slabDepthChanged", 
function(){
this.vwr.g.setI("slab", this.slabPercentSetting);
this.vwr.g.setI("depth", this.depthPercentSetting);
this.finalizeTransformParameters();
});
Clazz_defineMethod(c$, "slabByPercentagePoints", 
function(percentage){
this.slabPlane = null;
if (percentage < 0 ? this.slabPercentSetting <= Math.max(0, this.depthPercentSetting) : this.slabPercentSetting >= 100) return;
this.slabPercentSetting += percentage;
this.slabDepthChanged();
if (this.depthPercentSetting >= this.slabPercentSetting) this.depthPercentSetting = this.slabPercentSetting - 1;
}, "~N");
Clazz_defineMethod(c$, "depthByPercentagePoints", 
function(percentage){
this.depthPlane = null;
if (percentage < 0 ? this.depthPercentSetting <= 0 : this.depthPercentSetting >= Math.min(100, this.slabPercentSetting)) return;
this.depthPercentSetting += percentage;
if (this.slabPercentSetting <= this.depthPercentSetting) this.slabPercentSetting = this.depthPercentSetting + 1;
this.slabDepthChanged();
}, "~N");
Clazz_defineMethod(c$, "slabDepthByPercentagePoints", 
function(percentage){
this.slabPlane = null;
this.depthPlane = null;
if (percentage < 0 ? this.slabPercentSetting <= Math.max(0, this.depthPercentSetting) : this.depthPercentSetting >= Math.min(100, this.slabPercentSetting)) return;
this.slabPercentSetting += percentage;
this.depthPercentSetting += percentage;
this.slabDepthChanged();
}, "~N");
Clazz_defineMethod(c$, "slabToPercent", 
function(percentSlab){
this.slabPlane = null;
this.vwr.setFloatProperty("slabRange", 0);
this.slabPercentSetting = percentSlab;
if (this.depthPercentSetting >= this.slabPercentSetting) this.depthPercentSetting = this.slabPercentSetting - 1;
this.slabDepthChanged();
}, "~N");
Clazz_defineMethod(c$, "depthToPercent", 
function(percentDepth){
this.depthPlane = null;
this.vwr.g.setI("depth", percentDepth);
this.depthPercentSetting = percentDepth;
if (this.slabPercentSetting <= this.depthPercentSetting) this.slabPercentSetting = this.depthPercentSetting + 1;
this.slabDepthChanged();
}, "~N");
Clazz_defineMethod(c$, "zSlabToPercent", 
function(percentSlab){
this.zSlabPercentSetting = percentSlab;
if (this.zDepthPercentSetting > this.zSlabPercentSetting) this.zDepthPercentSetting = percentSlab;
}, "~N");
Clazz_defineMethod(c$, "zDepthToPercent", 
function(percentDepth){
this.zDepthPercentSetting = percentDepth;
if (this.zDepthPercentSetting > this.zSlabPercentSetting) this.zSlabPercentSetting = percentDepth;
}, "~N");
Clazz_defineMethod(c$, "slabInternal", 
function(plane, isDepth){
if (isDepth) {
this.depthPlane = plane;
this.depthPercentSetting = 0;
} else {
this.slabPlane = plane;
this.slabPercentSetting = 100;
}this.slabDepthChanged();
}, "JU.P4,~B");
Clazz_defineMethod(c$, "setSlabDepthInternal", 
function(isDepth){
if (isDepth) this.depthPlane = null;
 else this.slabPlane = null;
this.finalizeTransformParameters();
this.slabInternal(this.getSlabDepthPlane(isDepth), isDepth);
}, "~B");
Clazz_defineMethod(c$, "getSlabDepthPlane", 
function(isDepth){
if (isDepth) {
if (this.depthPlane != null) return this.depthPlane;
} else if (this.slabPlane != null) {
return this.slabPlane;
}var m = this.matrixTransform;
var plane = JU.P4.new4(-m.m20, -m.m21, -m.m22, -m.m23 + (isDepth ? this.depthValue : this.slabValue));
return plane;
}, "~B");
Clazz_defineMethod(c$, "getCameraFactors", 
function(){
this.aperatureAngle = (Math.atan2(this.screenPixelCount / 2, this.referencePlaneOffset) * 2 * 180 / 3.141592653589793);
this.cameraDistanceFromCenter = this.referencePlaneOffset / this.scalePixelsPerAngstrom;
var ptRef = JU.P3.new3(Clazz_doubleToInt(this.screenWidth / 2), Clazz_doubleToInt(this.screenHeight / 2), this.referencePlaneOffset);
this.unTransformPoint(ptRef, ptRef);
var ptCamera = JU.P3.new3(Clazz_doubleToInt(this.screenWidth / 2), Clazz_doubleToInt(this.screenHeight / 2), 0);
this.unTransformPoint(ptCamera, ptCamera);
ptCamera.sub(this.fixedRotationCenter);
var pt = JU.P3.new3(Clazz_doubleToInt(this.screenWidth / 2), Clazz_doubleToInt(this.screenHeight / 2), this.cameraDistanceFromCenter * this.scalePixelsPerAngstrom);
this.unTransformPoint(pt, pt);
pt.sub(this.fixedRotationCenter);
ptCamera.add(pt);
return  Clazz_newArray(-1, [ptRef, ptCamera, this.fixedRotationCenter, JU.P3.new3(this.cameraDistanceFromCenter, this.aperatureAngle, this.scalePixelsPerAngstrom)]);
});
Clazz_defineMethod(c$, "setPerspectiveDepth", 
function(perspectiveDepth){
if (this.perspectiveDepth == perspectiveDepth) return;
this.perspectiveDepth = perspectiveDepth;
this.vwr.g.setB("perspectiveDepth", perspectiveDepth);
this.resetFitToScreen(false);
}, "~B");
Clazz_defineMethod(c$, "getPerspectiveDepth", 
function(){
return this.perspectiveDepth;
});
Clazz_defineMethod(c$, "setCameraDepthPercent", 
function(percent, resetSlab){
this.resetNavigationPoint(resetSlab);
var screenMultiples = (percent < 0 ? -percent / 100 : percent);
if (screenMultiples == 0) return;
this.cameraDepthSetting = screenMultiples;
this.vwr.g.setF("cameraDepth", this.cameraDepthSetting);
this.cameraDepth = NaN;
}, "~N,~B");
Clazz_defineMethod(c$, "getCameraDepth", 
function(){
return this.cameraDepthSetting;
});
Clazz_defineMethod(c$, "setScreenParameters0", 
function(screenWidth, screenHeight, useZoomLarge, antialias, resetSlab, resetZoom){
if (screenWidth == 2147483647) return;
this.screenWidth = screenWidth;
this.screenHeight = screenHeight;
this.useZoomLarge = useZoomLarge;
this.antialias = antialias;
this.width = (antialias ? screenWidth * 2 : screenWidth);
this.height = (antialias ? screenHeight * 2 : screenHeight);
this.scaleFitToScreen(false, useZoomLarge, resetSlab, resetZoom);
}, "~N,~N,~B,~B,~B,~B");
Clazz_defineMethod(c$, "setAntialias", 
function(TF){
var isNew = (this.antialias != TF);
this.antialias = TF;
this.width = (this.antialias ? this.screenWidth * 2 : this.screenWidth);
this.height = (this.antialias ? this.screenHeight * 2 : this.screenHeight);
if (isNew) this.scaleFitToScreen(false, this.useZoomLarge, false, false);
}, "~B");
Clazz_defineMethod(c$, "defaultScaleToScreen", 
function(radius){
return this.screenPixelCount / 2 / radius;
}, "~N");
Clazz_defineMethod(c$, "resetFitToScreen", 
function(andCenter){
this.scaleFitToScreen(andCenter, this.vwr.g.zoomLarge, true, true);
}, "~B");
Clazz_defineMethod(c$, "scaleFitToScreen", 
function(andCenter, zoomLarge, resetSlab, resetZoom){
if (this.width == 0 || this.height == 0) {
this.screenPixelCount = 1;
} else {
this.fixedTranslation.set(this.width * (andCenter ? 0.5 : this.xTranslationFraction), this.height * (andCenter ? 0.5 : this.yTranslationFraction), 0);
this.setTranslationFractions();
if (andCenter) this.camera.set(0, 0, 0);
if (resetZoom) this.resetNavigationPoint(resetSlab);
if (this.zoomHeight) zoomLarge = (this.height > this.width);
this.screenPixelCount = (zoomLarge == (this.height > this.width) ? this.height : this.width);
}if (this.screenPixelCount > 2) this.screenPixelCount -= 2;
this.scaleDefaultPixelsPerAngstrom = this.defaultScaleToScreen(this.modelRadius);
}, "~B,~B,~B,~B");
Clazz_defineMethod(c$, "scaleToScreen", 
function(z, milliAngstroms){
if (milliAngstroms == 0 || z < 2) return 0;
var pixelSize = this.scaleToPerspective(z, milliAngstroms * this.scalePixelsPerAngstrom / 1000);
return (pixelSize > 0 ? pixelSize : 1);
}, "~N,~N");
Clazz_defineMethod(c$, "unscaleToScreen", 
function(z, screenDistance){
var d = screenDistance / this.scalePixelsPerAngstrom;
return (this.perspectiveDepth ? d / this.getPerspectiveFactor(z) : d);
}, "~N,~N");
Clazz_defineMethod(c$, "scaleToPerspective", 
function(z, sizeAngstroms){
return (this.perspectiveDepth ? sizeAngstroms * this.getPerspectiveFactor(z) : sizeAngstroms);
}, "~N,~N");
Clazz_defineMethod(c$, "setNavigationMode", 
function(TF){
var mode = this.mode;
this.mode = (TF ? 1 : this.defaultMode);
this.resetNavigationPoint(TF || mode == 1);
}, "~B");
Clazz_defineMethod(c$, "isNavigating", 
function(){
return this.navigating || this.navOn;
});
Clazz_defineMethod(c$, "finalizeTransformParameters", 
function(){
this.haveNotifiedNaN = false;
this.fixedRotationOffset.setT(this.fixedTranslation);
this.camera.setT(this.cameraSetting);
this.internalSlab = this.slabEnabled && (this.slabPlane != null || this.depthPlane != null);
var newZoom = this.getZoomSetting();
if (this.zmPct != newZoom) {
this.zmPct = newZoom;
if (!this.vwr.g.fontCaching) this.vwr.gdata.clearFontCache();
}this.calcCameraFactors();
this.calcTransformMatrix();
if (this.mode == 1) this.calcNavigationPoint();
 else this.calcSlabAndDepthValues();
});
Clazz_defineMethod(c$, "getZoomSetting", 
function(){
if (this.zmPctSet < 5) this.zmPctSet = 5;
if (this.zmPctSet > 200000) this.zmPctSet = 200000;
return (this.zoomEnabled || this.mode == 1 ? this.zmPctSet : 100);
});
Clazz_defineMethod(c$, "calcSlabAndDepthValues", 
function(){
if (this.slabRange < 1) this.slabValue = this.zValueFromPercent(this.slabPercentSetting);
 else this.slabValue = Clazz_doubleToInt(Math.floor(this.modelCenterOffset * this.slabRange / (2 * this.modelRadius) * (this.zmPctSet / 100)));
this.depthValue = this.zValueFromPercent(this.depthPercentSetting);
if (this.zSlabPercentSetting == this.zDepthPercentSetting) {
this.zSlabValue = this.slabValue;
this.zDepthValue = this.depthValue;
} else {
this.zSlabValue = this.zValueFromPercent(this.zSlabPercentSetting);
this.zDepthValue = this.zValueFromPercent(this.zDepthPercentSetting);
}if (this.zSlabPoint != null) {
try {
this.transformPt3fSafe(this.zSlabPoint, this.pointT2);
this.zSlabValue = Clazz_floatToInt(this.pointT2.z);
} catch (e) {
if (Clazz_exceptionOf(e, Exception)){
} else {
throw e;
}
}
}this.vwr.g.setO("_slabPlane", JU.Escape.eP4(this.getSlabDepthPlane(false)));
this.vwr.g.setO("_depthPlane", JU.Escape.eP4(this.getSlabDepthPlane(true)));
if (this.slabEnabled) return;
this.slabValue = 0;
this.depthValue = 2147483647;
});
Clazz_defineMethod(c$, "zValueFromPercent", 
function(zPercent){
return Clazz_doubleToInt(Math.floor((1 - zPercent / 50) * this.modelRadiusPixels + this.modelCenterOffset));
}, "~N");
Clazz_defineMethod(c$, "calcTransformMatrix", 
function(){
this.matrixTransform.setIdentity();
this.vectorTemp.sub2(this.frameOffset, this.fixedRotationCenter);
this.matrixTransform.setTranslation(this.vectorTemp);
this.matrixTemp.setToM3(this.stereoFrame ? this.matrixStereo : this.matrixRotate);
this.matrixTransform.mul2(this.matrixTemp, this.matrixTransform);
this.matrixTemp.setIdentity();
this.matrixTemp.m00 = this.matrixTemp.m11 = this.matrixTemp.m22 = this.scalePixelsPerAngstrom;
this.matrixTemp.m11 = this.matrixTemp.m22 = -this.scalePixelsPerAngstrom;
this.matrixTransform.mul2(this.matrixTemp, this.matrixTransform);
this.matrixTransform.m23 += this.modelCenterOffset;
try {
this.matrixTransformInv.setM4(this.matrixTransform).invert();
} catch (e) {
if (Clazz_exceptionOf(e, Exception)){
System.out.println("ERROR INVERTING matrixTransform!");
} else {
throw e;
}
}
});
Clazz_defineMethod(c$, "rotatePoint", 
function(pt, ptRot){
this.matrixRotate.rotate2(pt, ptRot);
ptRot.y = -ptRot.y;
}, "JU.T3,JU.T3");
Clazz_defineMethod(c$, "getScreenTemp", 
function(ptXYZ, fScrPt){
this.matrixTransform.rotTrans2(ptXYZ, fScrPt);
}, "JU.T3,JU.P3");
Clazz_defineMethod(c$, "transformPtScr", 
function(ptXYZ, pointScreen){
pointScreen.setT(this.transformPt(ptXYZ));
}, "JU.T3,JU.P3i");
Clazz_defineMethod(c$, "transformPtScrSafe", 
function(ptXYZ, pointScreen){
pointScreen.setT(this.transformPtSafe(ptXYZ));
}, "JU.T3,JU.P3i");
Clazz_defineMethod(c$, "transformPtScrT3", 
function(ptXYZ, pointScreen){
this.transformPt(ptXYZ);
pointScreen.setT(this.fScrPtSafe);
}, "JU.T3,JU.T3");
Clazz_defineMethod(c$, "transformPt3f", 
function(ptXYZ, screen){
this.applyPerspective(ptXYZ, ptXYZ, this.fScrPtSafe, null);
screen.setT(this.fScrPtSafe);
}, "JU.T3,JU.P3");
Clazz_defineMethod(c$, "transformPt3fSafe", 
function(ptXYZ, screen){
this.applyPerspective(ptXYZ, ptXYZ, this.fScrPt, null);
screen.setT(this.fScrPt);
}, "JU.T3,JU.P3");
Clazz_defineMethod(c$, "transformPtNoClip", 
function(ptXYZ, pointScreen){
this.applyPerspective(ptXYZ, null, this.fScrPtSafe, null);
pointScreen.setT(this.fScrPtSafe);
}, "JU.T3,JU.T3");
Clazz_defineMethod(c$, "transformPt", 
function(ptXYZ){
return this.applyPerspective(ptXYZ, this.internalSlab ? ptXYZ : null, this.fScrPtSafe, this.iScrPt);
}, "JU.T3");
Clazz_defineMethod(c$, "transformPtSafe", 
function(ptXYZ){
return this.applyPerspective(ptXYZ, this.internalSlab ? ptXYZ : null, this.fScrPt, this.iScrPtSafe);
}, "JU.T3");
Clazz_defineMethod(c$, "transformPtVib", 
function(ptXYZ, v){
return this.applyPerspective(this.getVibrationPoint(v, this.ptVibTemp.setP(ptXYZ), NaN), ptXYZ, this.fScrPtSafe, this.iScrPt);
}, "JU.P3,JU.Vibration");
Clazz_defineMethod(c$, "transformPtVibSafe", 
function(ptXYZ, v){
return this.applyPerspective(this.getVibrationPoint(v, this.ptVibTempSafe.setP(ptXYZ), NaN), ptXYZ, this.fScrPt, this.iScrPtSafe);
}, "JU.P3,JU.Vibration");
Clazz_defineMethod(c$, "getVibrationPoint", 
function(v, pt, scale){
return v.setCalcPoint(pt, this.vibrationT, (Float.isNaN(scale) ? this.vibrationScale : scale), this.vwr.g.modulationScale);
}, "JU.Vibration,JU.T3,~N");
Clazz_defineMethod(c$, "transformPt2D", 
function(ptXyp){
if (ptXyp.z == -3.4028235E38) {
this.iScrPt.x = Clazz_doubleToInt(Math.floor(ptXyp.x / 100 * this.screenWidth));
this.iScrPt.y = Clazz_doubleToInt(Math.floor((1 - ptXyp.y / 100) * this.screenHeight));
} else {
this.iScrPt.x = Clazz_floatToInt(ptXyp.x);
this.iScrPt.y = (this.screenHeight - Clazz_floatToInt(ptXyp.y));
}if (this.antialias) {
this.iScrPt.x <<= 1;
this.iScrPt.y <<= 1;
}this.matrixTransform.rotTrans2(this.fixedRotationCenter, this.fScrPtSafe);
this.iScrPt.z = Clazz_floatToInt(this.fScrPtSafe.z);
return this.iScrPt;
}, "JU.T3");
Clazz_defineMethod(c$, "applyPerspective", 
function(ptXYZ, ptRef, fScrPt, iScrPt){
this.getScreenTemp(ptXYZ, fScrPt);
var z = fScrPt.z;
if (Float.isNaN(z)) {
if (!this.haveNotifiedNaN && JU.Logger.debugging) JU.Logger.debug("NaN seen in TransformPoint");
this.haveNotifiedNaN = true;
z = fScrPt.z = 1;
} else if (z <= 0) {
z = fScrPt.z = 1;
}switch (this.mode) {
case 1:
fScrPt.x -= this.navigationShiftXY.x;
fScrPt.y -= this.navigationShiftXY.y;
break;
case 2:
fScrPt.x += this.perspectiveShiftXY.x;
fScrPt.y += this.perspectiveShiftXY.y;
break;
}
if (this.perspectiveDepth) {
var factor = this.getPerspectiveFactor(z);
fScrPt.x *= factor;
fScrPt.y *= factor;
}switch (this.mode) {
case 1:
fScrPt.x += this.navigationOffset.x;
fScrPt.y += this.navigationOffset.y;
break;
case 2:
fScrPt.x -= this.perspectiveShiftXY.x;
fScrPt.y -= this.perspectiveShiftXY.y;
case 0:
fScrPt.x += this.fixedRotationOffset.x;
fScrPt.y += this.fixedRotationOffset.y;
break;
}
if (Float.isNaN(fScrPt.x) && !this.haveNotifiedNaN) {
if (JU.Logger.debugging) JU.Logger.debug("NaN found in transformPoint ");
this.haveNotifiedNaN = true;
}var z1 = (ptRef != null && this.xyzIsSlabbedInternal(ptRef));
if (z1) {
fScrPt.z = 1;
}if (iScrPt != null) iScrPt.set(Clazz_floatToInt(fScrPt.x), Clazz_floatToInt(fScrPt.y), (z1 ? 1 : Clazz_floatToInt(fScrPt.z)));
return iScrPt;
}, "JU.T3,JU.T3,JU.P3,JU.P3i");
Clazz_defineMethod(c$, "xyzIsSlabbedInternal", 
function(ptRef){
return (this.slabPlane != null && ptRef.x * this.slabPlane.x + ptRef.y * this.slabPlane.y + ptRef.z * this.slabPlane.z + this.slabPlane.w > 0 || this.depthPlane != null && ptRef.x * this.depthPlane.x + ptRef.y * this.depthPlane.y + ptRef.z * this.depthPlane.z + this.depthPlane.w < 0);
}, "JU.T3");
Clazz_defineMethod(c$, "move", 
function(eval, dRot, dZoom, dTrans, dSlab, secondsTotal, fps){
this.movetoThread = J.api.Interface.getOption("thread.MoveToThread", this.vwr, "tm");
this.movetoThread.setManager(this, this.vwr,  Clazz_newArray(-1, [dRot, dTrans,  Clazz_newFloatArray(-1, [dZoom, dSlab, secondsTotal, fps])]));
if (secondsTotal > 0) this.movetoThread.setEval(eval);
this.movetoThread.run();
}, "J.api.JmolScriptEvaluator,JU.V3,~N,JU.V3,~N,~N,~N");
Clazz_defineMethod(c$, "isInPosition", 
function(axis, degrees){
if (Float.isNaN(degrees)) return true;
this.aaTest1.setVA(axis, (degrees / 57.29577951308232));
this.ptTest1.set(4.321, 1.23456, 3.14159);
this.getRotation(this.matrixTest);
this.matrixTest.rotate2(this.ptTest1, this.ptTest2);
this.matrixTest.setAA(this.aaTest1).rotate2(this.ptTest1, this.ptTest3);
return (this.ptTest3.distance(this.ptTest2) < 0.1);
}, "JU.V3,~N");
Clazz_defineMethod(c$, "moveToPyMOL", 
function(eval, secondsTotal, pymolView){
var m3 = JU.M3.newA9(pymolView);
m3.invert();
var cameraX = pymolView[9];
var cameraY = -pymolView[10];
var pymolDistanceToCenter = -pymolView[11];
var center = JU.P3.new3(pymolView[12], pymolView[13], pymolView[14]);
var pymolDistanceToSlab = pymolView[15];
var pymolDistanceToDepth = pymolView[16];
var fov = pymolView[17];
var isOrtho = (fov >= 0);
this.setPerspectiveDepth(!isOrtho);
var theta = Math.abs(fov) / 2;
var tan = Math.tan(theta * 3.141592653589793 / 180);
var rotationRadius = pymolDistanceToCenter * tan;
var jmolCameraToCenter = 0.5 / tan;
var cameraDepth = jmolCameraToCenter - 0.5;
var f = 50 / rotationRadius;
if (pymolDistanceToSlab > 0) {
var slab = 50 + Clazz_floatToInt((pymolDistanceToCenter - pymolDistanceToSlab) * f);
var depth = 50 + Clazz_floatToInt((pymolDistanceToCenter - pymolDistanceToDepth) * f);
this.setSlabEnabled(true);
this.slabToPercent(slab);
this.depthToPercent(depth);
if (pymolView.length == 21) {
var depthCue = (pymolView[18] != 0);
var fog = (pymolView[19] != 0);
var fogStart = pymolView[20];
this.setZShadeEnabled(depthCue);
if (depthCue) {
if (fog) {
this.vwr.setIntProperty("zSlab", Clazz_floatToInt(Math.min(100, slab + fogStart * (depth - slab))));
} else {
this.vwr.setIntProperty("zSlab", Clazz_floatToInt((slab + depth) / 2));
}this.vwr.setIntProperty("zDepth", depth);
}}}this.moveTo(eval, secondsTotal, center, null, 0, m3, 100, NaN, NaN, rotationRadius, null, NaN, NaN, NaN, cameraDepth, cameraX, cameraY);
return true;
}, "J.api.JmolScriptEvaluator,~N,~A");
Clazz_defineMethod(c$, "moveTo", 
function(eval, secondsTotal, center, rotAxis, degrees, matrixEnd, zoom, xTrans, yTrans, newRotationRadius, navCenter, xNav, yNav, navDepth, cameraDepth, cameraX, cameraY){
if (matrixEnd == null) {
matrixEnd =  new JU.M3();
var axis = JU.V3.newV(rotAxis);
if (Float.isNaN(degrees)) {
matrixEnd.m00 = NaN;
} else if (degrees < 0.01 && degrees > -0.01) {
matrixEnd.setScale(1);
} else {
if (axis.x == 0 && axis.y == 0 && axis.z == 0) {
return;
}var aaMoveTo =  new JU.A4();
aaMoveTo.setVA(axis, (degrees / 57.29577951308232));
matrixEnd.setAA(aaMoveTo);
}}if (cameraX == this.cameraSetting.x) cameraX = NaN;
if (cameraY == this.cameraSetting.y) cameraY = NaN;
if (cameraDepth == this.cameraDepth) cameraDepth = NaN;
if (!Float.isNaN(cameraX)) xTrans = cameraX * 50 / newRotationRadius / this.width * this.screenPixelCount;
if (!Float.isNaN(cameraY)) yTrans = cameraY * 50 / newRotationRadius / this.height * this.screenPixelCount;
var pixelScale = (center == null ? this.scaleDefaultPixelsPerAngstrom : this.defaultScaleToScreen(newRotationRadius));
if (secondsTotal <= 0) {
this.setAll(center, matrixEnd, navCenter, zoom, xTrans, yTrans, newRotationRadius, pixelScale, navDepth, xNav, yNav, cameraDepth, cameraX, cameraY);
this.vwr.moveUpdate(secondsTotal);
this.vwr.finalizeTransformParameters();
return;
}try {
if (this.movetoThread == null) this.movetoThread = J.api.Interface.getOption("thread.MoveToThread", this.vwr, "tm");
var nSteps = this.movetoThread.setManager(this, this.vwr,  Clazz_newArray(-1, [center, matrixEnd, navCenter,  Clazz_newFloatArray(-1, [secondsTotal, zoom, xTrans, yTrans, newRotationRadius, pixelScale, navDepth, xNav, yNav, cameraDepth, cameraX, cameraY])]));
if (nSteps <= 0 || this.vwr.g.waitForMoveTo) {
if (nSteps > 0) this.movetoThread.setEval(eval == null ? this.vwr.eval : eval);
this.movetoThread.run();
if (!this.vwr.isSingleThreaded) this.movetoThread = null;
} else {
this.movetoThread.start();
}} catch (e) {
if (Clazz_exceptionOf(e, Exception)){
} else {
throw e;
}
}
}, "J.api.JmolScriptEvaluator,~N,JU.P3,JU.T3,~N,JU.M3,~N,~N,~N,~N,JU.P3,~N,~N,~N,~N,~N,~N");
Clazz_defineMethod(c$, "setAll", 
function(center, m, navCenter, zoom, xTrans, yTrans, rotationRadius, pixelScale, navDepth, xNav, yNav, cameraDepth, cameraX, cameraY){
if (!Float.isNaN(m.m00)) this.setRotation(m);
if (center != null) this.moveRotationCenter(center, !this.windowCentered);
if (navCenter != null && this.mode == 1) this.navigationCenter.setT(navCenter);
if (!Float.isNaN(cameraDepth)) this.setCameraDepthPercent(cameraDepth, false);
if (!Float.isNaN(cameraX) && !Float.isNaN(cameraY)) this.setCamera(cameraX, cameraY);
if (!Float.isNaN(zoom)) this.zoomToPercent(zoom);
if (!Float.isNaN(rotationRadius)) this.modelRadius = rotationRadius;
if (!Float.isNaN(pixelScale)) this.scaleDefaultPixelsPerAngstrom = pixelScale;
if (!Float.isNaN(xTrans) && !Float.isNaN(yTrans)) {
this.translateToPercent('x', xTrans);
this.translateToPercent('y', yTrans);
}if (this.mode == 1) {
if (!Float.isNaN(xNav) && !Float.isNaN(yNav)) this.navTranslatePercentOrTo(0, xNav, yNav);
if (!Float.isNaN(navDepth)) this.setNavigationDepthPercent(navDepth);
}}, "JU.P3,JU.M3,JU.P3,~N,~N,~N,~N,~N,~N,~N,~N,~N,~N,~N");
Clazz_defineMethod(c$, "stopMotion", 
function(){
this.movetoThread = null;
});
Clazz_defineMethod(c$, "getRotationText", 
function(){
this.axisangleT.setM(this.matrixRotate);
var degrees = (this.axisangleT.angle * 57.29577951308232);
var sb =  new JU.SB();
this.vectorT.set(this.axisangleT.x, this.axisangleT.y, this.axisangleT.z);
if (degrees < 0.01) return "{0 0 1 0}";
this.vectorT.normalize();
this.vectorT.scale(1000);
sb.append("{");
JV.TransformManager.truncate0(sb, this.vectorT.x);
JV.TransformManager.truncate0(sb, this.vectorT.y);
JV.TransformManager.truncate0(sb, this.vectorT.z);
JV.TransformManager.truncate2(sb, degrees);
sb.append("}");
return sb.toString();
});
Clazz_defineMethod(c$, "getMoveToText", 
function(timespan, addComments){
this.finalizeTransformParameters();
var sb =  new JU.SB();
sb.append("moveto ");
if (addComments) sb.append("/* time, axisAngle */ ");
sb.appendF(timespan);
sb.append(" ").append(this.getRotationText());
if (addComments) sb.append(" /* zoom, translation */ ");
JV.TransformManager.truncate2(sb, this.zmPctSet);
JV.TransformManager.truncate2(sb, this.getTranslationXPercent());
JV.TransformManager.truncate2(sb, this.getTranslationYPercent());
sb.append(" ");
if (addComments) sb.append(" /* center, rotationRadius */ ");
sb.append(this.getCenterText());
sb.append(" ").appendF(this.modelRadius);
sb.append(this.getNavigationText(addComments));
if (addComments) sb.append(" /* cameraDepth, cameraX, cameraY */ ");
JV.TransformManager.truncate2(sb, this.cameraDepth);
JV.TransformManager.truncate2(sb, this.cameraSetting.x);
JV.TransformManager.truncate2(sb, this.cameraSetting.y);
sb.append(";");
return sb.toString();
}, "~N,~B");
Clazz_defineMethod(c$, "getCenterText", 
function(){
return JU.Escape.eP(this.fixedRotationCenter);
});
Clazz_defineMethod(c$, "getRotateXyzText", 
function(){
var sb =  new JU.SB();
var m20 = this.matrixRotate.m20;
var rY = -(Math.asin(m20) * 57.29577951308232);
var rX;
var rZ;
if (m20 > .999 || m20 < -0.999) {
rX = -(Math.atan2(this.matrixRotate.m12, this.matrixRotate.m11) * 57.29577951308232);
rZ = 0;
} else {
rX = (Math.atan2(this.matrixRotate.m21, this.matrixRotate.m22) * 57.29577951308232);
rZ = (Math.atan2(this.matrixRotate.m10, this.matrixRotate.m00) * 57.29577951308232);
}sb.append("reset");
sb.append(";center ").append(this.getCenterText());
if (rX != 0) {
sb.append("; rotate x");
JV.TransformManager.truncate2(sb, rX);
}if (rY != 0) {
sb.append("; rotate y");
JV.TransformManager.truncate2(sb, rY);
}if (rZ != 0) {
sb.append("; rotate z");
JV.TransformManager.truncate2(sb, rZ);
}sb.append(";");
this.addZoomTranslationNavigationText(sb);
return sb.toString();
});
Clazz_defineMethod(c$, "addZoomTranslationNavigationText", 
function(sb){
if (this.zmPct != 100) {
sb.append(" zoom");
JV.TransformManager.truncate2(sb, this.zmPct);
sb.append(";");
}var tX = this.getTranslationXPercent();
if (tX != 0) {
sb.append(" translate x");
JV.TransformManager.truncate2(sb, tX);
sb.append(";");
}var tY = this.getTranslationYPercent();
if (tY != 0) {
sb.append(" translate y");
JV.TransformManager.truncate2(sb, tY);
sb.append(";");
}if (this.modelRadius != this.rotationRadiusDefault || this.modelRadius == 10) {
sb.append(" set rotationRadius");
JV.TransformManager.truncate2(sb, this.modelRadius);
sb.append(";");
}if (this.mode == 1) {
sb.append("navigate 0 center ").append(JU.Escape.eP(this.navigationCenter));
sb.append(";navigate 0 translate");
JV.TransformManager.truncate2(sb, this.getNavigationOffsetPercent('X'));
JV.TransformManager.truncate2(sb, this.getNavigationOffsetPercent('Y'));
sb.append(";navigate 0 depth ");
JV.TransformManager.truncate2(sb, this.navigationDepthPercent);
sb.append(";");
}}, "JU.SB");
Clazz_defineMethod(c$, "getRotateZyzText", 
function(iAddComment){
var sb =  new JU.SB();
var m = this.vwr.ms.getInfoM("defaultOrientationMatrix");
if (m == null) {
m = this.matrixRotate;
} else {
m = JU.M3.newM3(m);
m.invert();
m.mul2(this.matrixRotate, m);
}var m22 = m.m22;
var rY = (Math.acos(m22) * 57.29577951308232);
var rZ1;
var rZ2;
if (m22 > .999 || m22 < -0.999) {
rZ1 = (Math.atan2(m.m10, m.m11) * 57.29577951308232);
rZ2 = 0;
} else {
rZ1 = (Math.atan2(m.m21, -m.m20) * 57.29577951308232);
rZ2 = (Math.atan2(m.m12, m.m02) * 57.29577951308232);
}if (rZ1 != 0 && rY != 0 && rZ2 != 0 && iAddComment) sb.append("#Follows Z-Y-Z convention for Euler angles\n");
sb.append("reset");
sb.append(";center ").append(this.getCenterText());
if (rZ1 != 0) {
sb.append("; rotate z");
JV.TransformManager.truncate2(sb, rZ1);
}if (rY != 0) {
sb.append("; rotate y");
JV.TransformManager.truncate2(sb, rY);
}if (rZ2 != 0) {
sb.append("; rotate z");
JV.TransformManager.truncate2(sb, rZ2);
}sb.append(";");
this.addZoomTranslationNavigationText(sb);
return sb.toString();
}, "~B");
c$.truncate0 = Clazz_defineMethod(c$, "truncate0", 
function(sb, val){
sb.appendC(' ');
sb.appendI(Math.round(val));
}, "JU.SB,~N");
c$.truncate2 = Clazz_defineMethod(c$, "truncate2", 
function(sb, val){
sb.appendC(' ');
sb.appendF(Math.round(val * 100) / 100);
}, "JU.SB,~N");
Clazz_defineMethod(c$, "setSpinXYZ", 
function(x, y, z){
if (!Float.isNaN(x)) this.spinX = x;
if (!Float.isNaN(y)) this.spinY = y;
if (!Float.isNaN(z)) this.spinZ = z;
if (this.isSpinInternal || this.isSpinFixed) this.clearSpin();
}, "~N,~N,~N");
Clazz_defineMethod(c$, "setSpinFps", 
function(value){
if (value <= 0) value = 1;
 else if (value > 50) value = 50;
this.spinFps = value;
}, "~N");
Clazz_defineMethod(c$, "setNavXYZ", 
function(x, y, z){
if (!Float.isNaN(x)) this.navX = x;
if (!Float.isNaN(y)) this.navY = y;
if (!Float.isNaN(z)) this.navZ = z;
}, "~N,~N,~N");
Clazz_defineMethod(c$, "clearSpin", 
function(){
this.setSpinOff();
this.setNavOn(false);
this.isSpinInternal = false;
this.isSpinFixed = false;
this.vectorSpinOnly = false;
});
Clazz_defineMethod(c$, "setSpinOn", 
function(){
this.setSpin(null, true, 3.4028235E38, null, null, null, null, false, null, -1);
});
Clazz_defineMethod(c$, "setSpinOff", 
function(){
this.setSpin(null, false, 3.4028235E38, null, null, null, null, false, null, -1);
});
Clazz_defineMethod(c$, "setSpin", 
function(eval, spinOn, endDegrees, endPositions, dihedralList, vectorMatrix, bsAtoms, isGesture, centerAndPoints, nFrames){
if (this.navOn && spinOn) this.setNavOn(false);
if (this.spinOn == spinOn) return;
this.spinOn = spinOn;
this.vectorSpinOnly = (vectorMatrix != null);
this.vwr.g.setB("_spinning", spinOn);
if (spinOn) {
if (this.spinThread == null) {
this.spinThread = J.api.Interface.getOption("thread.SpinThread", this.vwr, "tm");
this.spinThread.setManager(this, this.vwr,  Clazz_newArray(-1, [Float.$valueOf(endDegrees), endPositions, dihedralList, vectorMatrix, bsAtoms, isGesture ? Boolean.TRUE : null, centerAndPoints, Integer.$valueOf(nFrames)]));
this.spinIsGesture = isGesture;
if (vectorMatrix != null || (Float.isNaN(endDegrees) || endDegrees == 3.4028235E38 || !this.vwr.g.waitForMoveTo)) {
this.spinThread.start();
} else {
this.spinThread.setEval(eval);
this.spinThread.run();
}}} else if (this.spinThread != null) {
this.spinThread.reset();
this.spinThread = null;
}}, "J.api.JmolScriptEvaluator,~B,~N,JU.Lst,~A,JU.M3,JU.BS,~B,~A,~N");
Clazz_defineMethod(c$, "setNavOn", 
function(navOn){
if (Float.isNaN(this.navFps)) return;
var wasOn = this.navOn;
if (navOn && this.spinOn) this.setSpin(null, false, 0, null, null, null, null, false, null, -1);
this.navOn = navOn;
this.vwr.g.setB("_navigating", navOn);
if (!navOn) this.navInterrupt();
if (navOn) {
if (this.navX == 0 && this.navY == 0 && this.navZ == 0) this.navZ = 1;
if (this.navFps == 0) this.navFps = 10;
if (this.spinThread == null) {
this.spinThread = J.api.Interface.getOption("thread.SpinThread", this.vwr, "tm");
this.spinThread.setManager(this, this.vwr, null);
this.spinThread.start();
}} else if (wasOn) {
if (this.spinThread != null) {
this.spinThread.interrupt();
this.spinThread = null;
}}}, "~B");
Clazz_defineMethod(c$, "setVibrationScale", 
function(scale){
this.vibrationScale = scale;
}, "~N");
Clazz_defineMethod(c$, "setVibrationPeriod", 
function(period){
if (Float.isNaN(period)) {
period = this.vibrationPeriod;
} else if (period == 0) {
this.vibrationPeriod = 0;
this.vibrationPeriodMs = 0;
} else {
this.vibrationPeriod = Math.abs(period);
this.vibrationPeriodMs = Clazz_floatToInt(this.vibrationPeriod * 1000);
if (period > 0) return;
period = -period;
}this.setVibrationOn(period > 0 && (this.vwr.ms.getLastVibrationVector(this.vwr.am.cmi, 0) >= 0));
}, "~N");
Clazz_defineMethod(c$, "setVibrationT", 
function(t){
this.vibrationT.x = this.vibrationT.y = this.vibrationT.z = t;
if (this.vibrationScale == 0) this.vibrationScale = this.vwr.g.vibrationScale;
}, "~N");
Clazz_defineMethod(c$, "isVibrationOn", 
function(){
return this.vibrationOn;
});
Clazz_defineMethod(c$, "setVibrationOn", 
function(vibrationOn){
if (!vibrationOn) {
if (this.vibrationThread != null) {
this.vibrationThread.interrupt();
this.vibrationThread = null;
}this.vibrationOn = false;
this.vibrationT.x = this.vibrationT.y = this.vibrationT.z = 0;
return;
}if (this.vwr.ms.mc < 1) {
this.vibrationOn = false;
this.vibrationT.x = this.vibrationT.y = this.vibrationT.z = 0;
return;
}if (this.vibrationThread == null) {
this.vibrationThread = J.api.Interface.getOption("thread.VibrationThread", this.vwr, "tm");
this.vibrationThread.setManager(this, this.vwr, null);
this.vibrationThread.start();
}this.vibrationOn = true;
}, "~B");
Clazz_defineMethod(c$, "clearVibration", 
function(){
this.setVibrationOn(false);
this.vibrationScale = 0;
});
Clazz_defineMethod(c$, "setStereoMode2", 
function(twoColors){
this.stereoMode = J.c.STER.CUSTOM;
this.stereoColors = twoColors;
}, "~A");
Clazz_defineMethod(c$, "setStereoMode", 
function(stereoMode){
this.stereoColors = null;
this.stereoMode = stereoMode;
this.stereoDoubleDTI = (stereoMode === J.c.STER.DTI);
this.stereoDoubleFull = (stereoMode === J.c.STER.DOUBLE);
}, "J.c.STER");
Clazz_defineMethod(c$, "setStereoDegrees", 
function(stereoDegrees){
this.stereoDegrees = stereoDegrees;
this.stereoRadians = (stereoDegrees * 0.017453292519943295);
}, "~N");
Clazz_defineMethod(c$, "getStereoRotationMatrix", 
function(stereoFrame){
this.stereoFrame = stereoFrame;
if (!stereoFrame) return this.matrixRotate;
this.matrixTemp3.setAsYRotation(-this.stereoRadians);
this.matrixStereo.mul2(this.matrixTemp3, this.matrixRotate);
return this.matrixStereo;
}, "~B");
Clazz_defineMethod(c$, "isWindowCentered", 
function(){
return this.windowCentered;
});
Clazz_defineMethod(c$, "setWindowCentered", 
function(TF){
this.windowCentered = TF;
this.resetNavigationPoint(true);
}, "~B");
Clazz_defineMethod(c$, "setRotationRadius", 
function(angstroms, doAll){
angstroms = (this.modelRadius = (angstroms <= 0 ? this.vwr.ms.calcRotationRadius(this.vwr.am.cmi, this.fixedRotationCenter, true) : angstroms));
if (doAll) this.vwr.setRotationRadius(angstroms, false);
return angstroms;
}, "~N,~B");
Clazz_defineMethod(c$, "setRotationCenterAndRadiusXYZ", 
function(newCenterOfRotation, andRadius){
this.resetNavigationPoint(false);
if (newCenterOfRotation == null) {
this.setFixedRotationCenter(this.rotationCenterDefault);
this.modelRadius = this.rotationRadiusDefault;
return;
}this.setFixedRotationCenter(newCenterOfRotation);
if (andRadius && this.windowCentered) this.modelRadius = this.vwr.ms.calcRotationRadius(this.vwr.am.cmi, this.fixedRotationCenter, true);
}, "JU.T3,~B");
Clazz_defineMethod(c$, "setNewRotationCenter", 
function(center, doScale){
if (center == null) center = this.rotationCenterDefault;
if (this.windowCentered) {
this.translateToPercent('x', 0);
this.translateToPercent('y', 0);
this.setRotationCenterAndRadiusXYZ(center, true);
if (doScale) this.resetFitToScreen(true);
} else {
this.moveRotationCenter(center, true);
}}, "JU.P3,~B");
Clazz_defineMethod(c$, "moveRotationCenter", 
function(center, toXY){
this.setRotationCenterAndRadiusXYZ(center, false);
if (toXY) this.setRotationPointXY(this.fixedRotationCenter);
}, "JU.P3,~B");
Clazz_defineMethod(c$, "setCenter", 
function(){
this.setRotationCenterAndRadiusXYZ(this.fixedRotationCenter, true);
});
Clazz_defineMethod(c$, "setCenterAt", 
function(relativeTo, pt){
var pt1 = JU.P3.newP(pt);
switch (relativeTo) {
case 1073741826:
break;
case 96:
pt1.add(this.vwr.ms.getAverageAtomPoint());
break;
case 1812599299:
pt1.add(this.vwr.getBoundBoxCenter());
break;
default:
pt1.setT(this.rotationCenterDefault);
break;
}
this.setRotationCenterAndRadiusXYZ(pt1, true);
this.resetFitToScreen(true);
}, "~N,JU.P3");
Clazz_defineMethod(c$, "setFrameOffset", 
function(modelIndex){
if (this.frameOffsets == null || modelIndex < 0 || modelIndex >= this.frameOffsets.length) this.frameOffset.set(0, 0, 0);
 else this.frameOffset.setT(this.frameOffsets[modelIndex]);
}, "~N");
Clazz_defineMethod(c$, "setSelectedTranslation", 
function(bsAtoms, xyz, xy, x){
if (!this.perspectiveDepth) {
var v =  new JU.V3();
switch ((xyz).charCodeAt(0)) {
case 88:
case 120:
v.set(x, 0, 0);
break;
case 89:
case 121:
v.set(0, x, 0);
break;
case 90:
case 122:
v.set(0, 0, x);
break;
}
this.vwr.moveAtoms(null, null, this.matrixRotate, v, this.internalRotationCenter, false, bsAtoms, true, false);
return;
}this.bsSelectedAtoms = bsAtoms;
switch ((xyz).charCodeAt(0)) {
case 88:
case 120:
this.ptOffset.x += xy;
break;
case 89:
case 121:
this.ptOffset.y += xy;
break;
case 90:
case 122:
this.ptOffset.z += xy;
break;
}
}, "JU.BS,~S,~N,~N");
Clazz_defineMethod(c$, "setNavFps", 
function(navFps){
this.navFps = navFps;
}, "~N");
Clazz_defineMethod(c$, "calcCameraFactors", 
function(){
if (Float.isNaN(this.cameraDepth)) {
this.cameraDepth = this.cameraDepthSetting;
this.zoomFactor = 3.4028235E38;
}this.cameraDistance = this.cameraDepth * this.screenPixelCount;
this.referencePlaneOffset = this.cameraDistance + this.screenPixelCount / 2;
this.scalePixelsPerAngstrom = (this.scale3D && !this.perspectiveDepth && this.mode != 1 ? 72 / this.scale3DAngstromsPerInch * (this.antialias ? 2 : 1) : this.screenPixelCount / this.visualRangeAngstroms);
if (this.mode != 1) this.mode = (this.camera.z == 0 ? 0 : 2);
this.perspectiveShiftXY.set(this.camera.z == 0 ? 0 : this.camera.x * this.scalePixelsPerAngstrom / this.screenWidth * 100, this.camera.z == 0 ? 0 : this.camera.y * this.scalePixelsPerAngstrom / this.screenHeight * 100, 0);
this.modelRadiusPixels = this.modelRadius * this.scalePixelsPerAngstrom;
var offset100 = (2 * this.modelRadius) / this.visualRangeAngstroms * this.referencePlaneOffset;
if (this.mode == 1) {
this.calcNavCameraFactors(offset100);
return;
}this.zoomFactor = 3.4028235E38;
this.modelCenterOffset = this.referencePlaneOffset;
if (!this.scale3D || this.perspectiveDepth) this.scalePixelsPerAngstrom *= (this.modelCenterOffset / offset100) * this.zmPct / 100;
this.modelRadiusPixels = this.modelRadius * this.scalePixelsPerAngstrom;
});
Clazz_defineMethod(c$, "calcNavCameraFactors", 
function(offset100){
if (this.zoomFactor == 3.4028235E38) {
if (this.zmPct > 10000) this.zmPct = 10000;
this.modelCenterOffset = offset100 * 100 / this.zmPct;
} else if (this.prevZoomSetting != this.zmPctSet) {
if (this.zoomRatio == 0) this.modelCenterOffset = offset100 * 100 / this.zmPctSet;
 else this.modelCenterOffset += (1 - this.zoomRatio) * this.referencePlaneOffset;
this.navMode = -1;
}this.prevZoomSetting = this.zmPctSet;
this.zoomFactor = this.modelCenterOffset / this.referencePlaneOffset;
this.zmPct = (this.zoomFactor == 0 ? 10000 : offset100 / this.modelCenterOffset * 100);
}, "~N");
Clazz_defineMethod(c$, "getPerspectiveFactor", 
function(z){
return (z <= 0 ? this.referencePlaneOffset : this.referencePlaneOffset / z);
}, "~N");
Clazz_defineMethod(c$, "unTransformPoint", 
function(screenPt, coordPt){
this.untransformedPoint.setT(screenPt);
switch (this.mode) {
case 1:
this.untransformedPoint.x -= this.navigationOffset.x;
this.untransformedPoint.y -= this.navigationOffset.y;
break;
case 2:
this.fScrPtSafe.x += this.perspectiveShiftXY.x;
this.fScrPtSafe.y += this.perspectiveShiftXY.y;
case 0:
this.untransformedPoint.x -= this.fixedRotationOffset.x;
this.untransformedPoint.y -= this.fixedRotationOffset.y;
}
if (this.perspectiveDepth) {
var factor = this.getPerspectiveFactor(this.untransformedPoint.z);
this.untransformedPoint.x /= factor;
this.untransformedPoint.y /= factor;
}switch (this.mode) {
case 1:
this.untransformedPoint.x += this.navigationShiftXY.x;
this.untransformedPoint.y += this.navigationShiftXY.y;
break;
case 2:
this.untransformedPoint.x -= this.perspectiveShiftXY.x;
this.untransformedPoint.y -= this.perspectiveShiftXY.y;
break;
}
this.matrixTransformInv.rotTrans2(this.untransformedPoint, coordPt);
}, "JU.T3,JU.T3");
Clazz_defineMethod(c$, "resetNavigationPoint", 
function(doResetSlab){
if (this.zmPct < 5 && this.mode != 1) {
this.perspectiveDepth = true;
this.mode = 1;
return;
}if (this.mode == 1) {
this.navMode = 1;
this.slabPercentSetting = 0;
this.perspectiveDepth = true;
} else if (doResetSlab) {
this.slabPercentSetting = 100;
}this.vwr.setFloatProperty("slabRange", 0);
if (doResetSlab) {
this.setSlabEnabled(this.mode == 1);
}this.zoomFactor = 3.4028235E38;
this.zmPctSet = this.zmPct;
}, "~B");
Clazz_defineMethod(c$, "setNavigatePt", 
function(pt){
this.navigationCenter.setT(pt);
this.navMode = 3;
this.navigating = true;
this.finalizeTransformParameters();
this.navigating = false;
}, "JU.P3");
Clazz_defineMethod(c$, "setNavigationSlabOffsetPercent", 
function(percent){
this.vwr.g.setF("navigationSlab", percent);
this.calcCameraFactors();
this.navigationSlabOffset = percent / 50 * this.modelRadiusPixels;
}, "~N");
Clazz_defineMethod(c$, "getNavigationOffset", 
function(){
this.transformPt3fSafe(this.navigationCenter, this.navigationOffset);
return this.navigationOffset;
});
Clazz_defineMethod(c$, "getNavPtHeight", 
function(){
return this.height / 2;
});
Clazz_defineMethod(c$, "getNavigationOffsetPercent", 
function(XorY){
this.getNavigationOffset();
if (this.width == 0 || this.height == 0) return 0;
return (XorY == 'X' ? (this.navigationOffset.x - this.width / 2) * 100 / this.width : (this.navigationOffset.y - this.getNavPtHeight()) * 100 / this.height);
}, "~S");
Clazz_defineMethod(c$, "getNavigationText", 
function(addComments){
var s = (addComments ? " /* navigation center, translation, depth */ " : " ");
if (this.mode != 1) return s + "{0 0 0} 0 0 0";
this.getNavigationOffset();
return s + JU.Escape.eP(this.navigationCenter) + " " + this.getNavigationOffsetPercent('X') + " " + this.getNavigationOffsetPercent('Y') + " " + this.navigationDepthPercent;
}, "~B");
Clazz_defineMethod(c$, "setScreenParameters", 
function(screenWidth, screenHeight, useZoomLarge, antialias, resetSlab, resetZoom){
var pt = (this.mode == 1 ? JU.P3.newP(this.navigationCenter) : null);
var ptoff = JU.P3.newP(this.navigationOffset);
ptoff.x = ptoff.x / this.width;
ptoff.y = ptoff.y / this.height;
this.setScreenParameters0(screenWidth, screenHeight, useZoomLarge, antialias, resetSlab, resetZoom);
if (pt != null) {
this.navigationCenter.setT(pt);
this.navTranslatePercentOrTo(-1, ptoff.x * this.width, ptoff.y * this.height);
this.setNavigatePt(pt);
}}, "~N,~N,~B,~B,~B,~B");
Clazz_defineMethod(c$, "navInterrupt", 
function(){
if (this.nav != null) this.nav.interrupt();
});
Clazz_defineMethod(c$, "getNav", 
function(){
if (this.nav != null) return true;
this.nav = J.api.Interface.getOption("navigate.Navigator", this.vwr, "tm");
if (this.nav == null) return false;
this.nav.set(this, this.vwr);
return true;
});
Clazz_defineMethod(c$, "navigateList", 
function(eval, list){
if (this.getNav()) this.nav.navigateList(eval, list);
}, "J.api.JmolScriptEvaluator,JU.Lst");
Clazz_defineMethod(c$, "navigateAxis", 
function(rotAxis, degrees){
if (this.getNav()) this.nav.navigateAxis(rotAxis, degrees);
}, "JU.V3,~N");
Clazz_defineMethod(c$, "setNavigationOffsetRelative", 
function(){
if (this.getNav()) this.nav.setNavigationOffsetRelative();
});
Clazz_defineMethod(c$, "navigateKey", 
function(keyCode, modifiers){
if (this.getNav()) this.nav.navigateKey(keyCode, modifiers);
}, "~N,~N");
Clazz_defineMethod(c$, "setNavigationDepthPercent", 
function(percent){
if (this.getNav()) this.nav.setNavigationDepthPercent(percent);
}, "~N");
Clazz_defineMethod(c$, "navTranslatePercentOrTo", 
function(seconds, x, y){
if (this.getNav()) this.nav.navTranslatePercentOrTo(seconds, x, y);
}, "~N,~N,~N");
Clazz_defineMethod(c$, "calcNavigationPoint", 
function(){
if (this.getNav()) this.nav.calcNavigationPoint();
});
Clazz_defineMethod(c$, "getNavigationState", 
function(){
return (this.mode == 1 && this.getNav() ? this.nav.getNavigationState() : "");
});
});
;//5.0.1-v7 Mon Aug 24 10:01:38 CDT 2026
Clazz_declarePackage("JV");
Clazz_load(["java.lang.Enum", "J.api.JmolViewer", "$.PlatformViewer", "J.atomdata.AtomDataServer", "java.util.Hashtable", "JU.P3"], "JV.Viewer", ["java.util.Arrays", "JU.AU", "$.BS", "$.Base64", "$.CU", "$.DF", "$.Lst", "$.M3", "$.P3i", "$.PT", "$.Quat", "$.Rdr", "$.SB", "J.adapter.smarter.SmarterJmolAdapter", "J.api.Interface", "J.atomdata.RadiusData", "J.c.FIL", "$.STER", "$.VDW", "J.i18n.GT", "JM.Measurement", "$.ModelSet", "JS.SV", "$.T", "J.thread.TimeoutThread", "JU.BSUtil", "$.C", "$.CommandHistory", "$.Elements", "$.Escape", "$.GData", "$.JmolMolecule", "$.Logger", "$.Parser", "$.TempArray", "JV.ActionManager", "$.AnimationManager", "$.ColorManager", "$.FileManager", "$.GlobalSettings", "$.JC", "$.ModelManager", "$.SelectionManager", "$.ShapeManager", "$.StateManager", "$.StatusManager", "$.TransformManager", "JV.binding.Binding"], function(){
var c$ = Clazz_decorateAsClass(function(){
this.testAsync = false;
this.autoExit = false;
this.haveDisplay = false;
this.isJSNoAWT = false;
this.isWebGL = false;
this.isSingleThreaded = false;
this.queueOnHold = false;
this.fullName = "";
this.compiler = null;
this.definedAtomSets = null;
this.ms = null;
this.fm = null;
this.isApplet = false;
this.isJNLP = false;
this.isSyntaxAndFileCheck = false;
this.isSyntaxCheck = false;
this.listCommands = false;
this.mustRender = false;
this.htmlName = "";
this.appletName = "";
this.tryPt = 0;
this.insertedCommand = "";
this.gdata = null;
this.html5Applet = null;
this.acm = null;
this.am = null;
this.cm = null;
this.dm = null;
this.shm = null;
this.slm = null;
this.rm = null;
this.g = null;
this.sm = null;
this.tm = null;
this.syncId = "";
this.logFilePath = "";
this.allowScripting = false;
this.isPrintOnly = false;
this.isSignedApplet = false;
this.isSignedAppletLocal = false;
this.isSilent = false;
this.multiTouch = false;
this.noGraphicsAllowed = false;
this.useCommandThread = false;
this.commandOptions = null;
this.vwrOptions = null;
this.display = null;
this.modelAdapter = null;
this.access0 = null;
this.access = null;
this.internalAccessPath = null;
this.commandHistory = null;
this.mm = null;
this.stm = null;
this.scm = null;
this.eval = null;
this.tempArray = null;
this.async = false;
this.executor = null;
this.screenWidth = 0;
this.screenHeight = 0;
this.defaultVdw = null;
this.rd = null;
this.chainMap = null;
this.chainList = null;
this.errorMessage = null;
this.errorMessageUntranslated = null;
this.privateKey = 0;
this.dataOnly = false;
this.maximumSize = 2147483647;
this.gRight = null;
this.isStereoSlave = false;
this.imageFontScaling = 1;
this.antialiased = false;
this.prevFrame = -2147483648;
this.prevMorphModel = 0;
this.haveJSV = false;
this.jsv = null;
this.systemInfoShown = false;
this.outputManager = null;
this.jzt = null;
this.isPreviewOnly = false;
this.headless = false;
this.movableBitSet = null;
this.hasSelected = false;
this.mouse = null;
this.ligandModels = null;
this.ligandModelSet = null;
this.annotationParser = null;
this.dssrParser = null;
this.minimizer = null;
this.smilesMatcher = null;
this.jsc = null;
this.lastData = null;
this.motionEventNumber = 0;
this.inMotion = false;
this.refreshing = true;
this.axesAreTainted = false;
this.captureParams = null;
this.jsParams = null;
this.cirChecked = false;
this.hoverAtomIndex = -1;
this.hoverText = null;
this.hoverLabel = "%U";
this.hoverEnabled = true;
this.currentCursor = 0;
this.ptTemp = null;
this.selectionHalosEnabled = false;
this.frankOn = true;
this.noFrankEcho = true;
this.scriptEditorVisible = false;
this.appConsole = null;
this.scriptEditor = null;
this.jmolpopup = null;
this.modelkit = null;
this.headlessImageParams = null;
this.pm = null;
this.isTainted = true;
this.movingSelected = false;
this.showSelected = false;
this.ptScreen = null;
this.ptScreenNew = null;
this.ptNew = null;
this.atomHighlighted = -1;
this.creatingImage = false;
this.bsUserVdws = null;
this.userVdws = null;
this.userVdwMars = null;
this.currentShapeID = -1;
this.currentShapeState = null;
this.localFunctions = null;
this.$isKiosk = false;
this.displayLoadErrors = true;
this.$isParallel = false;
this.stateScriptVersionInt = 2147483647;
this.jsExporter3D = null;
this.timeouts = null;
this.chainCaseSpecified = false;
this.nmrCalculation = null;
this.logFileName = null;
this.jbr = null;
this.jcm = null;
this.jsonParser = null;
this.symStatic = null;
this.triangulator = null;
this.nboParser = null;
this.macros = null;
this.consoleFontScale = 1;
Clazz_instantialize(this, arguments);}, JV, "Viewer", J.api.JmolViewer, [J.atomdata.AtomDataServer, J.api.PlatformViewer]);
Clazz_prepareFields (c$, function(){
this.ptScreen =  new JU.P3();
this.ptScreenNew =  new JU.P3();
this.ptNew =  new JU.P3();
});
Clazz_makeConstructor(c$, 
function(){
Clazz_superConstructor (this, JV.Viewer, []);
});
Clazz_makeConstructor(c$, 
function(info){
Clazz_superConstructor (this, JV.Viewer, []);
this.setOptions(info);
}, "java.util.Map");
Clazz_defineMethod(c$, "finalize", 
function(){
if (JU.Logger.debugging) JU.Logger.debug("vwr finalize " + this);
Clazz_superCall(this, JV.Viewer, "finalize", []);
});
Clazz_defineMethod(c$, "setInsertedCommand", 
function(strScript){
this.insertedCommand = strScript;
}, "~S");
c$.getJmolVersion = Clazz_overrideMethod(c$, "getJmolVersion", 
function(){
return (JV.Viewer.version_date == null ? JV.Viewer.version_date = (JV.JC.version + "  " + JV.JC.date + (false ? "(D)" : "")).trim() : JV.Viewer.version_date);
});
c$.allocateViewer = Clazz_defineMethod(c$, "allocateViewer", 
function(display, modelAdapter, fullName, documentBase, codeBase, commandOptions, statusListener, implementedPlatform){
var info =  new java.util.Hashtable();
info.put("display", display);
info.put("adapter", modelAdapter);
info.put("statusListener", statusListener);
info.put("platform", implementedPlatform);
info.put("options", commandOptions);
info.put("fullName", fullName);
info.put("documentBase", documentBase);
info.put("codeBase", codeBase);
return  new JV.Viewer(info);
}, "~O,J.api.JmolAdapter,~S,java.net.URL,java.net.URL,~S,J.api.JmolStatusListener,J.api.GenericPlatform");
Clazz_defineMethod(c$, "haveAccess", 
function(a){
return this.access === a;
}, "JV.Viewer.ACCESS");
Clazz_overrideMethod(c$, "getModelAdapter", 
function(){
return (this.modelAdapter == null ? this.modelAdapter =  new J.adapter.smarter.SmarterJmolAdapter() : this.modelAdapter);
});
Clazz_overrideMethod(c$, "getSmartsMatch", 
function(smarts, bsSelected){
if (bsSelected == null) bsSelected = this.bsA();
return this.getSmilesMatcher().getSubstructureSet(smarts, this.ms.at, this.ms.ac, bsSelected, 2);
}, "~S,JU.BS");
Clazz_defineMethod(c$, "isSubstructure", 
function(smarts, smiles){
try {
var map = this.getSmilesMatcher().find(smarts, smiles, 10);
return map != null && map.length > 0;
} catch (e) {
if (Clazz_exceptionOf(e, Exception)){
return false;
} else {
throw e;
}
}
}, "~S,~S");
Clazz_defineMethod(c$, "hasStructure", 
function(pattern, smiles, isSmarts){
try {
var ret = this.getSmilesMatcher().hasStructure(pattern,  Clazz_newArray(-1, [smiles]), (isSmarts ? 2 : 1) | 8);
return ret[0] == 1;
} catch (e) {
if (Clazz_exceptionOf(e, Exception)){
return false;
} else {
throw e;
}
}
}, "~S,~S,~B");
Clazz_defineMethod(c$, "getSmartsMatchForNodes", 
function(smarts, atoms){
return this.getSmilesMatcher().getSubstructureSet(smarts, atoms, atoms.length, null, 2);
}, "~S,~A");
Clazz_defineMethod(c$, "getSmartsMap", 
function(smilesOrSmarts, bsSelected, flags){
if (bsSelected == null) bsSelected = this.bsA();
if (flags == 0) flags = 2;
return this.getSmilesMatcher().getCorrelationMaps(smilesOrSmarts, this.ms.at, this.ms.ac, bsSelected, flags);
}, "~S,JU.BS,~N");
Clazz_defineMethod(c$, "setOptions", 
function(info){
this.commandHistory =  new JU.CommandHistory();
this.rd =  new J.atomdata.RadiusData(null, 0, null, null);
this.defaultVdw = J.c.VDW.JMOL;
this.localFunctions =  new java.util.Hashtable();
this.privateKey = Math.random();
this.chainMap =  new java.util.Hashtable();
this.chainList =  new JU.Lst();
this.vwrOptions = info;
if (JU.Logger.debugging) {
JU.Logger.debug("Viewer constructor " + this);
}this.modelAdapter = info.get("adapter");
var statusListener = info.get("statusListener");
this.fullName = info.get("fullName");
if (this.fullName == null) this.fullName = "";
var o = info.get("codePath");
if (o == null) o = "../java/";
JV.Viewer.appletCodeBase = o.toString();
JV.Viewer.appletIdiomaBase = JV.Viewer.appletCodeBase.substring(0, JV.Viewer.appletCodeBase.lastIndexOf("/", JV.Viewer.appletCodeBase.length - 2) + 1) + "idioma";
o = info.get("documentBase");
JV.Viewer.appletDocumentBase = (o == null ? "" : o.toString());
o = info.get("options");
this.commandOptions = (o == null ? "" : o.toString());
if (info.containsKey("debug") || this.commandOptions.indexOf("-debug") >= 0) JU.Logger.setLogLevel(5);
if (this.isApplet && info.containsKey("maximumSize")) this.setMaximumSize((info.get("maximumSize")).intValue());
this.isJNLP = this.checkOption2("isJNLP", "-jnlp");
if (this.isJNLP) JU.Logger.info("setting JNLP mode TRUE");
this.isSignedApplet = this.isJNLP || this.checkOption2("signedApplet", "-signed");
this.isApplet = this.isSignedApplet || this.checkOption2("applet", "-applet");
this.allowScripting = !this.checkOption2("noscripting", "-noscripting");
var i = this.fullName.indexOf("__");
this.htmlName = (i < 0 ? this.fullName : this.fullName.substring(0, i));
this.appletName = JU.PT.split(this.htmlName + "_", "_")[0];
this.syncId = (i < 0 ? "" : this.fullName.substring(i + 2, this.fullName.length - 2));
this.access = this.access0 = (this.checkOption2("access:READSPT", "-r") ? JV.Viewer.ACCESS.READSPT : this.checkOption2("access:NONE", "-R") ? JV.Viewer.ACCESS.NONE : JV.Viewer.ACCESS.ALL);
this.isPreviewOnly = info.containsKey("previewOnly");
if (this.isPreviewOnly) info.remove("previewOnly");
this.isPrintOnly = this.checkOption2("printOnly", "-p");
this.dataOnly = this.checkOption2("isDataOnly", "\0");
this.autoExit = this.checkOption2("exit", "-x");
o = info.get("platform");
var platform = "unknown";
if (o == null) {
o = (this.commandOptions.contains("platform=") ? this.commandOptions.substring(this.commandOptions.indexOf("platform=") + 9) : "J.awt.Platform");
}if ((typeof(o)=='string')) {
platform = o;
this.isWebGL = (platform.indexOf(".awtjs.") >= 0);
JV.Viewer.isJS = this.isJSNoAWT = this.isWebGL || (platform.indexOf(".awtjs2d.") >= 0);
this.async = !this.dataOnly && !this.autoExit && (this.testAsync || JV.Viewer.isJS && info.containsKey("async"));
var applet = null;
var jmol = null;
var javaver = "?";
{
if(self.Jmol) { jmol = Jmol; applet =
Jmol._applets[this.htmlName.split("_object")[0]]; javaver =
Jmol._version; }
}if (javaver != null) {
this.html5Applet = applet;
JV.Viewer.jmolObject = jmol;
JV.Viewer.strJavaVersion = javaver;
JV.Viewer.strJavaVendor = "Java2Script " + (this.isWebGL ? "(WebGL)" : "(HTML5)");
}o = J.api.Interface.getInterface(platform, this, "setOptions");
}this.apiPlatform = o;
this.display = info.get("display");
this.isSingleThreaded = this.apiPlatform.isSingleThreaded();
this.noGraphicsAllowed = this.checkOption2("noDisplay", "-n");
this.headless = this.apiPlatform.isHeadless();
this.haveDisplay = (this.isWebGL || this.display != null && !this.noGraphicsAllowed && !this.headless && !this.dataOnly);
this.noGraphicsAllowed = new Boolean (this.noGraphicsAllowed & (this.display == null)).valueOf();
this.headless = new Boolean (this.headless | this.noGraphicsAllowed).valueOf();
if (this.haveDisplay) {
this.mustRender = true;
this.multiTouch = this.checkOption2("multiTouch", "-multitouch");
{
if (!this.isWebGL) this.display =
document.getElementById(this.display);
}} else {
this.display = null;
}this.apiPlatform.setViewer(this, this.display);
o = info.get("graphicsAdapter");
if (o == null && !this.isWebGL) o = J.api.Interface.getOption("g3d.Graphics3D", this, "setOptions");
this.gdata = (o == null && (this.isWebGL || !JV.Viewer.isJS) ?  new JU.GData() : o);
this.gdata.initialize(this, this.apiPlatform);
this.stm =  new JV.StateManager(this);
this.cm =  new JV.ColorManager(this, this.gdata);
this.sm =  new JV.StatusManager(this);
var is4D = info.containsKey("4DMouse");
this.tm = JV.TransformManager.getTransformManager(this, 2147483647, 0, is4D);
this.slm =  new JV.SelectionManager(this);
if (this.haveDisplay) {
this.acm = (this.multiTouch ? J.api.Interface.getOption("multitouch.ActionManagerMT", null, null) :  new JV.ActionManager());
this.acm.setViewer(this, this.commandOptions + "-multitouch-" + info.get("multiTouch"));
this.mouse = this.apiPlatform.getMouseManager(this.privateKey, this.display);
if (this.multiTouch && !this.checkOption2("-simulated", "-simulated")) this.apiPlatform.setTransparentCursor(this.display);
}this.mm =  new JV.ModelManager(this);
this.shm =  new JV.ShapeManager(this);
this.am =  new JV.AnimationManager(this);
this.tempArray =  new JU.TempArray();
o = info.get("repaintManager");
if (!"NONE".equals(o)) {
if (o == null) o = J.api.Interface.getOption("render.RepaintManager", this, "setOptions");
if (JV.Viewer.isJS || o != null && !o.equals("")) (this.rm = o).set(this, this.shm);
}this.ms =  new JM.ModelSet(this, null);
this.initialize(true, false);
this.fm =  new JV.FileManager(this);
this.definedAtomSets =  new java.util.Hashtable();
this.setJmolStatusListener(statusListener);
if (this.isApplet) {
JU.Logger.info("vwrOptions: \n" + JU.Escape.escapeMap(this.vwrOptions));
var path = this.vwrOptions.get("documentLocation");
if (!JV.Viewer.isJS && path != null && path.startsWith("file:/")) {
path = path.substring(0, path.substring(0, (path + "?").indexOf("?")).lastIndexOf("/"));
JU.Logger.info("setting current directory to " + path);
this.cd(path);
}path = JV.Viewer.appletDocumentBase;
i = path.indexOf("#");
if (i >= 0) path = path.substring(0, i);
i = path.lastIndexOf("?");
if (i >= 0) path = path.substring(0, i);
i = path.lastIndexOf("/");
if (i >= 0) path = path.substring(0, i);
JV.Viewer.jsDocumentBase = path;
this.fm.setAppletContext(JV.Viewer.appletDocumentBase);
var appletProxy = info.get("appletProxy");
if (appletProxy != null) this.setStringProperty("appletProxy", appletProxy);
if (this.isSignedApplet) {
this.showSystemInfo();
this.logFilePath = JU.PT.rep(JV.Viewer.appletCodeBase, "file://", "");
this.logFilePath = JU.PT.rep(this.logFilePath, "file:/", "");
if (this.logFilePath.indexOf("//") >= 0) this.logFilePath = null;
 else this.isSignedAppletLocal = true;
} else if (!JV.Viewer.isJS) {
this.logFilePath = null;
} new J.i18n.GT(this, info.get("language"));
if (JV.Viewer.isJS && this.haveDisplay) this.acm.createActions();
} else {
this.gdata.setBackgroundTransparent(this.checkOption2("backgroundTransparent", "-b"));
this.isSilent = this.checkOption2("silent", "-i");
if (this.isSilent) JU.Logger.setLogLevel(3);
 else JU.Logger.info("Jmol version " + JV.Viewer.getJmolVersion());
if (this.headless && !this.isSilent) JU.Logger.info("Operating headless display=" + this.display + " nographicsallowed=" + this.noGraphicsAllowed);
this.isSyntaxAndFileCheck = this.checkOption2("checkLoad", "-C");
this.isSyntaxCheck = this.isSyntaxAndFileCheck || this.checkOption2("check", "-c");
this.listCommands = this.checkOption2("listCommands", "-l");
this.cd(".");
if (this.headless) {
this.headlessImageParams = info.get("headlessImage");
o = info.get("headlessMaxTimeMs");
if (o == null) o = Integer.$valueOf(60000);
this.setTimeout("" + Math.random(), (o).intValue(), "exitJmol");
}}this.useCommandThread = !JV.Viewer.isJS && !this.headless && this.checkOption2("useCommandThread", "-threaded");
this.setStartupBooleans();
this.setIntProperty("_nProcessors", JV.Viewer.nProcessors);
this.zap(false, true, false);
this.g.setO("language", J.i18n.GT.getLanguage());
this.g.setO("_hoverLabel", this.hoverLabel);
this.stm.setJmolDefaults();
JU.Elements.covalentVersion = 1;
if (this.allowScripting) this.getScriptManager();
}, "java.util.Map");
Clazz_defineMethod(c$, "setMaximumSize", 
function(x){
this.maximumSize = Math.max(x, 100);
}, "~N");
Clazz_defineMethod(c$, "setStereo", 
function(isStereoSlave, gRight){
this.isStereoSlave = isStereoSlave;
this.gRight = gRight;
}, "~B,~O");
Clazz_defineMethod(c$, "getMenu", 
function(type){
this.getPopupMenu();
if (type.equals("\0")) {
this.popupMenu(this.screenWidth - 120, 0, 'j');
return "OK";
}return (this.jmolpopup == null ? "" : this.jmolpopup.jpiGetMenuAsString("Jmol version " + JV.Viewer.getJmolVersion() + "|_GET_MENU|" + type));
}, "~S");
Clazz_overrideMethod(c$, "resizeInnerPanel", 
function(width, height){
if (!this.autoExit && this.haveDisplay) return this.sm.resizeInnerPanel(width, height);
this.setScreenDimension(width, height);
return  Clazz_newIntArray(-1, [this.screenWidth, this.screenHeight]);
}, "~N,~N");
Clazz_overrideMethod(c$, "setScreenDimension", 
function(width, height){
height = Math.min(height, this.maximumSize);
width = Math.min(width, this.maximumSize);
if (this.tm.stereoDoubleFull || this.am.splitFrame) width = Clazz_doubleToInt((width + 1) / 2);
if (this.screenWidth == width && this.screenHeight == height) return;
this.resizeImage(width, height, false, false, true);
}, "~N,~N");
Clazz_defineMethod(c$, "resizeImage", 
function(width, height, isImageWrite, isExport, isReset){
if (!isImageWrite && this.creatingImage) return;
var wasAntialiased = this.antialiased;
this.antialiased = (isReset ? this.g.antialiasDisplay && this.checkMotionRendering(603979786) : isImageWrite && !isExport ? this.g.antialiasImages : false);
if (!isExport && !isImageWrite && (width > 0 || wasAntialiased != this.antialiased)) this.setShapeProperty(5, "clearBoxes", null);
this.imageFontScaling = (this.antialiased ? 2 : 1) * (isReset || this.tm.scale3D || width <= 0 ? 1 : (this.g.zoomLarge == (height > width) ? height : width) * 1 / this.getScreenDim());
if (width > 0) {
this.screenWidth = width;
this.screenHeight = height;
if (!isImageWrite) {
this.g.setI("_width", width);
this.g.setI("_height", height);
}} else {
width = (this.screenWidth == 0 ? this.screenWidth = 500 : this.screenWidth);
height = (this.screenHeight == 0 ? this.screenHeight = 500 : this.screenHeight);
}this.tm.setScreenParameters(width, height, isImageWrite || isReset ? this.g.zoomLarge : false, this.antialiased, false, false);
this.gdata.setWindowParameters(width, height, this.antialiased);
this.setModelkitPropertySafely("frameresized", null);
if (width > 0 && !isImageWrite) this.setStatusResized(width, height);
}, "~N,~N,~B,~B,~B");
Clazz_overrideMethod(c$, "getScreenWidth", 
function(){
return this.screenWidth;
});
Clazz_overrideMethod(c$, "getScreenHeight", 
function(){
return this.screenHeight;
});
Clazz_defineMethod(c$, "getScreenDim", 
function(){
return (this.g.zoomLarge == (this.screenHeight > this.screenWidth) ? this.screenHeight : this.screenWidth);
});
Clazz_defineMethod(c$, "setWidthHeightVar", 
function(){
this.g.setI("_width", this.screenWidth);
this.g.setI("_height", this.screenHeight);
});
Clazz_defineMethod(c$, "getBoundBoxCenterX", 
function(){
return Clazz_doubleToInt(this.screenWidth / 2);
});
Clazz_defineMethod(c$, "getBoundBoxCenterY", 
function(){
return Clazz_doubleToInt(this.screenHeight / 2);
});
Clazz_defineMethod(c$, "updateWindow", 
function(width, height){
if (!this.refreshing || this.creatingImage) return (this.refreshing ? false : !JV.Viewer.isJS);
if (this.isTainted || this.tm.slabEnabled) this.setModelVisibility();
this.isTainted = false;
if (this.rm != null) {
if (width != 0) this.setScreenDimension(width, height);
}return true;
}, "~N,~N");
Clazz_defineMethod(c$, "getRenderedImage", 
function(isStereo, isImageWrite){
var image = null;
try {
this.beginRendering(isStereo, isImageWrite);
this.render();
this.gdata.endRendering();
image = this.gdata.getScreenImage(isImageWrite);
} catch (e$$) {
if (Clazz_exceptionOf(e$$, Error)){
var er = e$$;
{
this.gdata.getScreenImage(isImageWrite);
this.handleError(er, false);
this.setErrorMessage("Error during rendering: " + er, null);
}
} else if (Clazz_exceptionOf(e$$, Exception)){
var e = e$$;
{
System.out.println("render error" + e);
}
} else {
throw e$$;
}
}
return image;
}, "~B,~B");
Clazz_defineMethod(c$, "beginRendering", 
function(isStereo, isImageWrite){
this.gdata.beginRendering(this.tm.getStereoRotationMatrix(isStereo), this.g.translucent, isImageWrite, !this.checkMotionRendering(1111490588));
}, "~B,~B");
Clazz_defineMethod(c$, "render", 
function(){
if (this.mm.modelSet == null || !this.mustRender || !this.refreshing && !this.creatingImage || this.rm == null) return;
var antialias2 = this.antialiased && this.g.antialiasTranslucent;
var navMinMax = this.shm.finalizeAtoms(this.tm.bsSelectedAtoms, true);
if (this.isWebGL) {
this.rm.renderExport(this.gdata, this.ms, this.jsParams);
this.notifyViewerRepaintDone();
return;
}this.rm.render(this.gdata, this.ms, true, navMinMax);
if (this.gdata.setPass2(antialias2)) {
this.tm.setAntialias(antialias2);
this.rm.render(this.gdata, this.ms, false, null);
this.tm.setAntialias(this.antialiased);
}});
Clazz_defineMethod(c$, "drawImage", 
function(graphic, img, x, y, isDTIorSplit){
if (graphic != null && img != null) {
this.apiPlatform.drawImage(graphic, img, x, y, this.screenWidth, this.screenHeight, isDTIorSplit);
}this.gdata.releaseScreenImage();
}, "~O,~O,~N,~N,~B");
Clazz_defineMethod(c$, "getScreenImage", 
function(){
return this.getScreenImageBuffer(null, true);
});
Clazz_overrideMethod(c$, "getScreenImageBuffer", 
function(g, isImageWrite){
if (this.isWebGL) return (isImageWrite ? this.apiPlatform.allocateRgbImage(0, 0, null, 0, false, true) : null);
var isTwoImages = this.haveTwoImages();
var isWidthCompressed = this.tm.stereoDoubleDTI;
var isBicolor = this.tm.stereoMode.isBiColor();
var isStereo = (this.tm.stereoMode !== J.c.STER.NONE);
var mergeImages = (g == null && isTwoImages);
var imageBuffer;
this.tm.splitFrameCurrentlyRendering = -1;
if (isBicolor) {
this.beginRendering(true, isImageWrite);
this.render();
this.gdata.endRendering();
this.gdata.snapshotAnaglyphChannelBytes();
this.beginRendering(false, isImageWrite);
this.render();
this.gdata.endRendering();
this.gdata.applyAnaglygh(this.tm.stereoMode, this.tm.stereoColors);
imageBuffer = this.gdata.getScreenImage(isImageWrite);
} else {
if (this.am.splitFrame) {
this.setCurrentModelIndex(this.am.getSplitFrameModelIndex(0));
this.tm.splitFrameCurrentlyRendering = 0;
this.setModelVisibility();
imageBuffer = this.getRenderedImage(false, isImageWrite);
} else {
imageBuffer = this.getRenderedImage(isStereo, isImageWrite);
}}var imageBuffer2 = null;
if (mergeImages) {
imageBuffer2 = this.apiPlatform.newBufferedImage(imageBuffer, (isWidthCompressed ? this.screenWidth : this.screenWidth << 1), this.screenHeight);
g = this.apiPlatform.getGraphics(imageBuffer2);
}if (g == null) return imageBuffer;
var x = 0;
if (isTwoImages) {
if (this.tm.stereoMode === J.c.STER.DTI) {
this.drawImage(g, imageBuffer, this.screenWidth >> 1, 0, true);
imageBuffer = this.getRenderedImage(false, false);
this.drawImage(g, imageBuffer, 0, 0, true);
g = null;
} else if (this.am.splitFrame) {
x = 0;
this.drawImage(g, imageBuffer, x, 0, false);
this.setCurrentModelIndex(this.am.getSplitFrameModelIndex(1));
this.tm.splitFrameCurrentlyRendering = 1;
this.setModelVisibility();
imageBuffer = this.getRenderedImage(isStereo, false);
this.setCurrentModelIndex(this.am.getSplitFrameModelIndex(0));
this.tm.splitFrameCurrentlyRendering = -1;
this.shm.setModelVisibility(this.am.getSplitFrameModels());
x = this.screenWidth;
this.am.setSplitFrameOffsetX(x);
} else {
this.drawImage(g, imageBuffer, this.screenWidth, 0, false);
imageBuffer = this.getRenderedImage(false, false);
}}if (g != null) this.drawImage(g, imageBuffer, x, 0, false);
return (mergeImages ? imageBuffer2 : imageBuffer);
}, "~O,~B");
Clazz_defineMethod(c$, "haveTwoImages", 
function(){
return this.tm.stereoDoubleFull || this.tm.stereoDoubleDTI || this.am.splitFrame;
});
Clazz_defineMethod(c$, "evalStringWaitStatusQueued", 
function(returnType, strScript, statusList, isQuiet, isQueued){
return (this.getScriptManager() == null ? null : this.scm.evalStringWaitStatusQueued(returnType, strScript, statusList, isQuiet, isQueued));
}, "~S,~S,~S,~B,~B");
Clazz_defineMethod(c$, "popupMenu", 
function(x, y, type){
if (!this.haveDisplay || !this.refreshing || this.isPreviewOnly || this.g.disablePopupMenu) return;
switch ((type).charCodeAt(0)) {
case 106:
try {
this.getPopupMenu();
this.jmolpopup.jpiShow(x, y);
} catch (e) {
JU.Logger.info(e.toString());
this.g.disablePopupMenu = true;
}
break;
case 97:
case 98:
case 109:
if (this.getModelkit(true) == null) {
return;
}this.modelkit.showMenu(x, y);
break;
}
}, "~N,~N,~S");
Clazz_defineMethod(c$, "getModelkit", 
function(andShow){
if (this.modelkit == null) {
this.modelkit = J.api.Interface.getInterface("J.modelkit.ModelKit", this, "script");
if (this.headless || !this.haveDisplay) {
this.modelkit.setProperty("headless", this);
} else {
this.modelkit.setMenu(this.apiPlatform.getMenuPopup(null, 'm'));
}} else if (andShow) {
this.modelkit.updateMenu();
}return this.modelkit;
}, "~B");
Clazz_defineMethod(c$, "getPopupMenu", 
function(){
if (this.g.disablePopupMenu) return null;
if (this.jmolpopup == null) {
this.jmolpopup = (this.allowScripting ? this.apiPlatform.getMenuPopup(this.menuStructure, 'j') : null);
if (this.jmolpopup == null) {
if (!this.async) this.g.disablePopupMenu = true;
return null;
}}if (this.isJSNoAWT) this.checkMenuUpdate();
return this.jmolpopup.jpiGetMenuAsObject();
});
Clazz_overrideMethod(c$, "setMenu", 
function(fileOrText, isFile){
if (isFile) JU.Logger.info("Setting menu " + (fileOrText.length == 0 ? "to Jmol defaults" : "from file " + fileOrText));
if (fileOrText.length == 0) fileOrText = null;
 else if (isFile) fileOrText = this.getFileAsString3(fileOrText, false, null);
this.getProperty("DATA_API", "setMenu", fileOrText);
this.sm.setCallbackFunction("menu", fileOrText);
}, "~S,~B");
Clazz_defineMethod(c$, "setStatusFrameChanged", 
function(isVib, doNotify){
if (isVib) {
this.prevFrame = -2147483648;
}this.tm.setVibrationPeriod(NaN);
var firstIndex = this.am.firstFrameIndex;
var lastIndex = this.am.lastFrameIndex;
var isMovie = this.am.isMovie;
var modelIndex = this.am.cmi;
if (firstIndex == lastIndex && !isMovie) modelIndex = firstIndex;
var frameID = this.getModelFileNumber(modelIndex);
var currentFrame = this.am.cmi;
var fileNo = frameID;
var modelNo = frameID % 1000000;
var firstNo = (isMovie ? firstIndex : this.getModelFileNumber(firstIndex));
var lastNo = (isMovie ? lastIndex : this.getModelFileNumber(lastIndex));
var strModelNo;
if (isMovie) {
strModelNo = "" + (currentFrame + 1);
} else if (fileNo == 0) {
strModelNo = this.getModelNumberDotted(firstIndex);
if (firstIndex != lastIndex) strModelNo += " - " + this.getModelNumberDotted(lastIndex);
if (Clazz_doubleToInt(firstNo / 1000000) == Clazz_doubleToInt(lastNo / 1000000)) fileNo = firstNo;
} else {
strModelNo = this.getModelNumberDotted(modelIndex);
}if (fileNo != 0) fileNo = (fileNo < 1000000 ? 1 : Clazz_doubleToInt(fileNo / 1000000));
if (!isMovie) {
this.g.setI("_currentFileNumber", fileNo);
this.g.setI("_currentModelNumberInFile", modelNo);
}var currentMorphModel = this.am.currentMorphModel;
this.g.setI("_currentFrame", currentFrame);
this.g.setI("_morphCount", this.am.morphCount);
this.g.setF("_currentMorphFrame", currentMorphModel);
this.g.setI("_frameID", frameID);
this.g.setI("_modelIndex", modelIndex);
this.g.setOrRemoveO("_modelNumber", strModelNo);
this.g.setOrRemoveO("_modelName", (modelIndex < 0 ? "" : this.getModelName(modelIndex)));
var title = (modelIndex < 0 ? "" : this.ms.getModelTitle(modelIndex));
this.g.setOrRemoveO("_modelTitle", title == null ? "" : title);
this.g.setOrRemoveO("_modelFile", (modelIndex < 0 ? "" : this.ms.getModelFileName(modelIndex)));
this.g.setOrRemoveO("_modelType", (modelIndex < 0 ? "" : this.ms.getModelFileType(modelIndex)));
if (currentFrame == this.prevFrame && currentMorphModel == this.prevMorphModel) return;
this.prevFrame = currentFrame;
this.prevMorphModel = currentMorphModel;
var entryName = this.getModelName(currentFrame);
if (isMovie) {
entryName = "" + (entryName === "" ? currentFrame + 1 : this.am.caf + 1) + ": " + entryName;
} else {
var script = "" + this.getModelNumberDotted(currentFrame);
if (!script.equals(entryName)) entryName = script + ": " + entryName;
}this.sm.setStatusFrameChanged(fileNo, modelNo, (this.am.animationDirection < 0 ? -firstNo : firstNo), (this.am.currentDirection < 0 ? -lastNo : lastNo), currentFrame, currentMorphModel, entryName);
if (this.doHaveJSV()) this.getJSV().setModel(modelIndex);
if (JV.Viewer.isJS) this.updateJSView(modelIndex, -1);
}, "~B,~B");
Clazz_defineMethod(c$, "doHaveJSV", 
function(){
return (this.haveJSV || (this.haveJSV = this.getBooleanProperty("_JSV")));
});
Clazz_defineMethod(c$, "getJSV", 
function(){
if (this.jsv == null) {
this.jsv = (J.api.Interface.getOption("jsv.JSV", this, "script")).setViewer(this);
}return this.jsv;
});
Clazz_defineMethod(c$, "getJDXBaseModelIndex", 
function(modelIndex){
if (!this.doHaveJSV()) return modelIndex;
return this.getJSV().getBaseModelIndex(modelIndex);
}, "~N");
Clazz_defineMethod(c$, "getJspecViewProperties", 
function(myParam){
return this.pluginRequest("JSV", "property", myParam);
}, "~S");
Clazz_defineMethod(c$, "scriptEcho", 
function(strEcho){
if (!JU.Logger.isActiveLevel(4)) return;
if (JV.Viewer.isJS) System.out.println(strEcho);
this.sm.setScriptEcho(strEcho, this.isScriptQueued());
if (this.listCommands && strEcho != null && strEcho.indexOf("$[") == 0) JU.Logger.info(strEcho);
}, "~S");
Clazz_defineMethod(c$, "isScriptQueued", 
function(){
return this.scm != null && this.scm.isScriptQueued();
});
Clazz_defineMethod(c$, "notifyError", 
function(errType, errMsg, errMsgUntranslated){
this.g.setO("_errormessage", errMsgUntranslated);
this.sm.notifyError(errType, errMsg, errMsgUntranslated);
}, "~S,~S,~S");
Clazz_defineMethod(c$, "jsEval", 
function(strEval){
return "" + this.sm.jsEval(strEval);
}, "~S");
Clazz_defineMethod(c$, "jsEvalSV", 
function(strEval){
return JS.SV.getVariable(JV.Viewer.isJS ? this.sm.jsEval(strEval) : this.jsEval(strEval));
}, "~S");
Clazz_defineMethod(c$, "setFileLoadStatus", 
function(ptLoad, fullPathName, fileName, modelName, strError, isAsync){
this.setErrorMessage(strError, null);
this.g.setI("_loadPoint", ptLoad.getCode());
var doCallback = (ptLoad !== J.c.FIL.CREATING_MODELSET);
if (doCallback) this.setStatusFrameChanged(false, false);
this.sm.setFileLoadStatus(fullPathName, fileName, modelName, strError, ptLoad.getCode(), doCallback, isAsync);
if (doCallback) {
if (this.doHaveJSV()) this.getJSV().setModel(this.am.cmi);
if (JV.Viewer.isJS) this.updateJSView(this.am.cmi, -2);
}}, "J.c.FIL,~S,~S,~S,~S,Boolean");
Clazz_defineMethod(c$, "getZapName", 
function(){
return (this.g.modelKitMode ? "Jmol Model Kit" : "zapped");
});
Clazz_defineMethod(c$, "setStatusMeasuring", 
function(status, intInfo, strMeasure, value){
this.sm.setStatusMeasuring(status, intInfo, strMeasure, value);
}, "~S,~N,~S,~N");
Clazz_defineMethod(c$, "notifyMinimizationStatus", 
function(){
var step = this.getP("_minimizationStep");
var ff = this.getP("_minimizationForceField");
var minStatus = this.getP("_minimizationStatus");
var starting = "starting".equals(minStatus);
var done = "done".equals(minStatus) || "failed".equals(minStatus);
var includeAtoms = (this.minimizer != null && (done || starting));
var bsAtoms = (includeAtoms ? this.minimizer.bsAtoms : null);
var atomIndex = (bsAtoms == null ? -1 : bsAtoms.nextSetBit(0));
var modelIndex = (atomIndex >= 0 ? this.getModelIndexForAtom(atomIndex) : -1);
if (starting && atomIndex >= 0) {
this.sm.setStatusStructureModified(atomIndex, modelIndex, 3, "minimize:" + minStatus, bsAtoms.cardinality(), bsAtoms);
}this.sm.notifyMinimizationStatus(minStatus, (typeof(step)=='string') ? Integer.$valueOf(0) : step, this.getP("_minimizationEnergy"), (step.toString().equals("0") ? Float.$valueOf(0) : this.getP("_minimizationEnergyDiff")), ff);
if (done && atomIndex >= 0) {
this.sm.setStatusStructureModified(atomIndex, modelIndex, -3, "minimize:" + minStatus, bsAtoms.cardinality(), bsAtoms);
}});
Clazz_defineMethod(c$, "notifyCalculation", 
function(type, atoms, result){
this.sm.notifyCalculation(type, atoms, result);
}, "~S,JU.BS,~S");
Clazz_defineMethod(c$, "setStatusAtomPicked", 
function(atomIndex, info, map, andSelect){
if (andSelect) this.setSelectionSet(JU.BSUtil.newAndSetBit(atomIndex));
if (info == null) {
info = this.g.pickLabel;
info = (info.length == 0 ? this.getAtomInfoXYZ(atomIndex, this.g.messageStyleChime ? 4 : 2) + (this.getOperativeSymmetry() == null ? "" : " (" + this.getAtomInfoXYZ(atomIndex, 3) + ")") : this.ms.getAtomInfo(atomIndex, info, this.ptTemp));
}this.setPicked(atomIndex, false);
if (atomIndex < 0) {
var m = this.getPendingMeasurement();
if (m != null) info = info.substring(0, info.length - 1) + ",\"" + m.getString() + "\"]";
}this.g.setO("_pickinfo", info);
this.sm.setStatusAtomPicked(atomIndex, info, map);
if (atomIndex < 0) return;
var syncMode = this.sm.getSyncMode();
if (syncMode == 1 && this.doHaveJSV()) this.getJSV().atomPicked(atomIndex);
if (JV.Viewer.isJS) this.updateJSView(this.ms.at[atomIndex].mi, atomIndex);
}, "~N,~S,java.util.Map,~B");
Clazz_overrideMethod(c$, "getProperty", 
function(returnType, infoType, paramInfo){
if (!"DATA_API".equals(returnType)) return this.getPropertyManager().getProperty(returnType, infoType, paramInfo);
switch (("scriptCheck.........consoleText.........scriptEditor........scriptEditorState...getAppConsole.......getScriptEditor.....setMenu.............spaceGroupInfo......disablePopupMenu....defaultDirectory....getPopupMenu........shapeManager........getPreference.......").indexOf(infoType)) {
case 0:
return this.scriptCheckRet(paramInfo, true);
case 20:
return (this.appConsole == null ? "" : this.appConsole.getText());
case 40:
this.showEditor(paramInfo);
return null;
case 60:
this.scriptEditorVisible = (paramInfo).booleanValue();
return null;
case 80:
if (this.$isKiosk) {
this.appConsole = null;
} else if (Clazz_instanceOf(paramInfo,"J.api.JmolAppConsoleInterface")) {
this.appConsole = paramInfo;
} else if (paramInfo != null && !(paramInfo).booleanValue()) {
this.appConsole = null;
} else if (this.appConsole == null && paramInfo != null && (paramInfo).booleanValue()) {
if (JV.Viewer.isJS) {
this.appConsole = J.api.Interface.getOption("consolejs.AppletConsole", this, "script");
}{
}if (this.appConsole != null) this.appConsole.start(this);
}this.scriptEditor = (JV.Viewer.isJS || this.appConsole == null ? null : this.appConsole.getScriptEditor());
return this.appConsole;
case 100:
if (this.appConsole == null && paramInfo != null && (paramInfo).booleanValue()) {
this.getProperty("DATA_API", "getAppConsole", Boolean.TRUE);
this.scriptEditor = (this.appConsole == null ? null : this.appConsole.getScriptEditor());
}return this.scriptEditor;
case 120:
if (this.jmolpopup != null) this.jmolpopup.jpiDispose();
this.jmolpopup = null;
return this.menuStructure = paramInfo;
case 140:
return this.getSymTemp().getSpaceGroupInfo(this.ms, null, -1, false, null);
case 160:
this.g.disablePopupMenu = true;
return null;
case 180:
return this.g.defaultDirectory;
case 200:
if ((typeof(paramInfo)=='string')) return this.getMenu(paramInfo);
return this.getPopupMenu();
case 220:
return this.shm.getProperty(paramInfo);
case 240:
return this.sm.syncSend("getPreference", paramInfo, 1);
}
JU.Logger.error("ERROR in getProperty DATA_API: " + infoType);
return null;
}, "~S,~S,~O");
Clazz_defineMethod(c$, "showSystemInfo", 
function(){
if (!this.isSilent && !this.systemInfoShown) {
JU.Logger.info("(C) 2015 Jmol Development" + "\nJmol Version: " + JV.Viewer.getJmolVersion() + "\njava.vendor: " + JV.Viewer.strJavaVendor + "\njava.version: " + JV.Viewer.strJavaVersion + "\nos: " + JV.Viewer.strOSName + " " + System.getProperty("os.arch", "") + "\nAccess: " + this.access + "\nmemory: " + this.getP("_memory") + "\nprocessors available: " + JV.Viewer.nProcessors + "\nuseCommandThread: " + this.useCommandThread + (!this.isApplet ? "" : "\nappletId:" + this.htmlName + (this.isSignedApplet ? " (signed)" : "")));
}});
Clazz_defineMethod(c$, "notifyMouseClicked", 
function(x, y, action, mode){
var modifiers = JV.binding.Binding.getButtonMods(action);
var clickCount = JV.binding.Binding.getClickCount(action);
this.g.setI("_mouseX", x);
this.g.setI("_mouseY", this.screenHeight - y);
this.g.setI("_mouseAction", action);
this.g.setI("_mouseModifiers", modifiers);
this.g.setI("_clickCount", clickCount);
return this.sm.setStatusClicked(x, this.screenHeight - y, action, clickCount, mode);
}, "~N,~N,~N,~N");
Clazz_defineMethod(c$, "getOutputManager", 
function(){
if (this.outputManager != null) return this.outputManager;
return (this.outputManager = J.api.Interface.getInterface("JV.OutputManager" + (JV.Viewer.isJS ? "JS" : "Awt"), this, "file")).setViewer(this, this.privateKey);
});
Clazz_defineMethod(c$, "getJzt", 
function(){
return (this.jzt == null ? this.jzt = J.api.Interface.getInterface("JU.ZipTools", this, "zip") : this.jzt);
});
Clazz_defineMethod(c$, "readFileAsMap", 
function(bis, map, name){
this.getJzt().readFileAsMap(bis, map, name);
}, "java.io.BufferedInputStream,java.util.Map,~S");
Clazz_defineMethod(c$, "getZipDirectoryAsString", 
function(fileName){
var t = this.fm.getBufferedInputStreamOrErrorMessageFromName(fileName, fileName, false, false, null, false, true);
return this.getJzt().getZipDirectoryAsStringAndClose(t);
}, "~S");
Clazz_overrideMethod(c$, "getImageAsBytes", 
function(type, width, height, quality, errMsg){
return this.getOutputManager().getImageAsBytes(type, width, height, quality, errMsg);
}, "~S,~N,~N,~N,~A");
Clazz_overrideMethod(c$, "releaseScreenImage", 
function(){
this.gdata.releaseScreenImage();
});
Clazz_defineMethod(c$, "setDisplay", 
function(canvas){
this.display = canvas;
this.apiPlatform.setViewer(this, canvas);
}, "~O");
Clazz_defineMethod(c$, "newMeasurementData", 
function(id, points){
return (J.api.Interface.getInterface("JM.MeasurementData", this, "script")).init(id, this, points);
}, "~S,JU.Lst");
Clazz_defineMethod(c$, "getDataManager", 
function(){
return (this.dm == null ? (this.dm = (J.api.Interface.getInterface("JV.DataManager", this, "script")).set(this)) : this.dm);
});
Clazz_defineMethod(c$, "getScriptManager", 
function(){
if (this.allowScripting && this.scm == null) {
this.scm = J.api.Interface.getInterface("JS.ScriptManager", this, "setOptions");
if (JV.Viewer.isJS && this.scm == null) throw  new NullPointerException();
if (this.scm == null) {
this.allowScripting = false;
return null;
}this.eval = this.scm.setViewer(this);
if (this.useCommandThread) this.scm.startCommandWatcher(true);
}return this.scm;
});
Clazz_defineMethod(c$, "checkOption2", 
function(key1, key2){
return (this.vwrOptions.containsKey(key1) && !this.vwrOptions.get(key1).toString().equals("false") || this.commandOptions.indexOf(key2) >= 0);
}, "~S,~S");
Clazz_defineMethod(c$, "setStartupBooleans", 
function(){
this.setBooleanProperty("_applet", this.isApplet);
this.setBooleanProperty("_JSV", false);
this.setBooleanProperty("_signedApplet", this.isSignedApplet);
this.setBooleanProperty("_headless", this.headless);
this.setStringProperty("_restrict", "\"" + this.access + "\"");
this.setBooleanProperty("_useCommandThread", this.useCommandThread);
this.setBooleanPropertyTok("doubleprecision", 603979831, false);
});
Clazz_defineMethod(c$, "getExportDriverList", 
function(){
return (this.haveAccess(JV.Viewer.ACCESS.ALL) ? this.g.getParameter("exportDrivers", true) : "");
});
Clazz_overrideMethod(c$, "dispose", 
function(){
this.gRight = null;
if (this.mouse != null) {
this.acm.dispose();
this.mouse.dispose();
this.mouse = null;
}this.clearScriptQueue();
this.clearThreads();
this.haltScriptExecution();
if (this.scm != null) this.scm.clear(true);
this.gdata.destroy();
if (this.jmolpopup != null) this.jmolpopup.jpiDispose();
if (this.modelkit != null) this.modelkit.dispose();
try {
if (this.appConsole != null) {
this.appConsole.dispose();
this.appConsole = null;
}if (this.scriptEditor != null) {
this.scriptEditor.dispose();
this.scriptEditor = null;
}} catch (e) {
if (Clazz_exceptionOf(e, Exception)){
} else {
throw e;
}
}
});
Clazz_defineMethod(c$, "reset", 
function(includingSpin){
this.ms.setBoundBox(null, null, true, 0);
this.axesAreTainted = true;
this.tm.homePosition(includingSpin);
if (this.ms.setCrystallographicDefaults()) {
this.stm.setCrystallographicDefaults();
this.setNewRotationCenter(this.getUnitCellCenter());
} else {
this.setAxesMode(603979809);
}this.prevFrame = -2147483648;
if (!this.tm.spinOn) this.setSync();
}, "~B");
Clazz_overrideMethod(c$, "homePosition", 
function(){
this.evalString("reset spin");
});
Clazz_defineMethod(c$, "initialize", 
function(clearUserVariables, isPyMOL){
this.g =  new JV.GlobalSettings(this, this.g, clearUserVariables);
this.setStartupBooleans();
this.setWidthHeightVar();
if (this.haveDisplay) {
this.g.setB("_is2D", JV.Viewer.isJS && !this.isWebGL);
this.g.setB("_multiTouchClient", this.acm.isMTClient());
this.g.setB("_multiTouchServer", this.acm.isMTServer());
}this.cm.setDefaultColors(false);
this.setObjectColor("background", "black");
this.setObjectColor("axis1", "red");
this.setObjectColor("axis2", "green");
this.setObjectColor("axis3", "blue");
this.am.setAnimationOn(false);
this.am.setAnimationFps(this.g.animationFps);
this.sm.playAudio(null);
this.sm.allowStatusReporting = this.g.statusReporting;
this.setBooleanPropertyTok("antialiasDisplay", 603979786, (isPyMOL ? true : this.g.antialiasDisplay));
this.stm.resetLighting();
this.tm.setDefaultPerspective();
}, "~B,~B");
Clazz_defineMethod(c$, "saveModelOrientation", 
function(modelIndex){
this.ms.saveModelOrientation(modelIndex, this.stm.getOrientation());
}, "~N");
Clazz_defineMethod(c$, "restoreModelOrientation", 
function(modelIndex){
var o = this.ms.getModelOrientation(modelIndex);
if (o != null) o.restore(-1, true);
}, "~N");
Clazz_defineMethod(c$, "restoreModelRotationOnly", 
function(modelIndex){
var o = this.ms.getModelOrientation(modelIndex);
if (o != null) o.restore(-1, false);
}, "~N");
Clazz_defineMethod(c$, "getGLmolView", 
function(){
var tm = this.tm;
var center = tm.fixedRotationCenter;
var q = tm.getRotationQ();
var xtrans = tm.xTranslationFraction;
var ytrans = tm.yTranslationFraction;
var scale = tm.scalePixelsPerAngstrom;
var zoom = tm.zmPctSet;
var cd = tm.cameraDistance;
var pc = tm.screenPixelCount;
var pd = tm.perspectiveDepth;
var width = tm.width;
var height = tm.height;
{
return { center:center, quaternion:q, xtrans:xtrans,
ytrans:ytrans, scale:scale, zoom:zoom, cameraDistance:cd,
pixelCount:pc, perspective:pd, width:width, height:height };
}});
Clazz_defineMethod(c$, "setRotationRadius", 
function(angstroms, doAll){
if (doAll) angstroms = this.tm.setRotationRadius(angstroms, false);
if (this.ms.setRotationRadius(this.am.cmi, angstroms)) this.g.setF("rotationRadius", angstroms);
}, "~N,~B");
Clazz_defineMethod(c$, "setCenterBitSet", 
function(bsCenter, doScale){
if (this.isJmolDataFrame()) return;
this.tm.setNewRotationCenter((JU.BSUtil.cardinalityOf(bsCenter) > 0 ? this.ms.getAtomSetCenter(bsCenter) : null), doScale);
}, "JU.BS,~B");
Clazz_defineMethod(c$, "setNewRotationCenter", 
function(center){
if (!this.isJmolDataFrame()) this.tm.setNewRotationCenter(center, true);
}, "JU.P3");
Clazz_defineMethod(c$, "navigate", 
function(keyWhere, modifiers){
if (this.isJmolDataFrame()) return;
this.tm.navigateKey(keyWhere, modifiers);
if (!this.tm.vibrationOn && keyWhere != 0) this.refresh(1, "Viewer:navigate()");
}, "~N,~N");
Clazz_defineMethod(c$, "move", 
function(eval, dRot, dZoom, dTrans, dSlab, secondsTotal, fps){
this.tm.move(eval, dRot, dZoom, dTrans, dSlab, secondsTotal, fps);
this.moveUpdate(secondsTotal);
}, "J.api.JmolScriptEvaluator,JU.V3,~N,JU.V3,~N,~N,~N");
Clazz_defineMethod(c$, "moveTo", 
function(eval, secondsTotal, center, rotAxis, degrees, rotationMatrix, zoom, xTrans, yTrans, rotationRadius, navCenter, xNav, yNav, navDepth, cameraDepth, cameraX, cameraY){
if (!this.haveDisplay) secondsTotal = 0;
this.setTainted(true);
this.tm.moveTo(eval, secondsTotal, center, rotAxis, degrees, rotationMatrix, zoom, xTrans, yTrans, rotationRadius, navCenter, xNav, yNav, navDepth, cameraDepth, cameraX, cameraY);
}, "J.api.JmolScriptEvaluator,~N,JU.P3,JU.V3,~N,JU.M3,~N,~N,~N,~N,JU.P3,~N,~N,~N,~N,~N,~N");
Clazz_defineMethod(c$, "moveUpdate", 
function(secondsTotal){
if (secondsTotal > 0) this.requestRepaintAndWait("moveUpdate");
 else if (secondsTotal == 0) this.setSync();
}, "~N");
Clazz_defineMethod(c$, "navigatePt", 
function(center){
this.tm.setNavigatePt(center);
this.setSync();
}, "JU.P3");
Clazz_defineMethod(c$, "navigateAxis", 
function(rotAxis, degrees){
this.tm.navigateAxis(rotAxis, degrees);
this.setSync();
}, "JU.V3,~N");
Clazz_defineMethod(c$, "navTranslatePercent", 
function(x, y){
if (this.isJmolDataFrame()) return;
this.tm.navTranslatePercentOrTo(0, x, y);
this.setSync();
}, "~N,~N");
Clazz_defineMethod(c$, "zoomBy", 
function(pixels){
this.tm.zoomBy(pixels);
this.refresh(2, this.sm.syncingMouse ? "Mouse: zoomBy " + pixels : "");
}, "~N");
Clazz_defineMethod(c$, "zoomByFactor", 
function(factor, x, y){
this.tm.zoomByFactor(factor, x, y);
this.refresh(2, !this.sm.syncingMouse ? "" : "Mouse: zoomByFactor " + factor + (x == 2147483647 ? "" : " " + x + " " + y));
}, "~N,~N,~N");
Clazz_defineMethod(c$, "rotateXYBy", 
function(degX, degY){
this.tm.rotateXYBy(degX, degY, null);
this.refresh(2, this.sm.syncingMouse ? "Mouse: rotateXYBy " + degX + " " + degY : "");
}, "~N,~N");
Clazz_defineMethod(c$, "spinXYBy", 
function(xDelta, yDelta, speed){
this.tm.spinXYBy(xDelta, yDelta, speed);
if (xDelta == 0 && yDelta == 0) return;
this.refresh(2, this.sm.syncingMouse ? "Mouse: spinXYBy " + xDelta + " " + yDelta + " " + speed : "");
}, "~N,~N,~N");
Clazz_defineMethod(c$, "rotateZBy", 
function(zDelta, x, y){
this.tm.rotateZBy(zDelta, x, y);
this.refresh(2, this.sm.syncingMouse ? "Mouse: rotateZBy " + zDelta + (x == 2147483647 ? "" : " " + x + " " + y) : "");
}, "~N,~N,~N");
Clazz_defineMethod(c$, "rotateSelected", 
function(deltaX, deltaY, bsSelected){
if (this.isJmolDataFrame()) return;
this.tm.rotateXYBy(deltaX, deltaY, this.setMovableBitSet(bsSelected, true));
this.refreshMeasures(true);
this.refresh(2, this.sm.syncingMouse ? "Mouse: rotateMolecule " + deltaX + " " + deltaY : "");
}, "~N,~N,JU.BS");
Clazz_defineMethod(c$, "setMovableBitSet", 
function(bsSelected, checkMolecule){
if (bsSelected == null) bsSelected = this.bsA();
bsSelected = JU.BSUtil.copy(bsSelected);
JU.BSUtil.andNot(bsSelected, this.getMotionFixedAtoms(null, null));
if (checkMolecule && !this.g.allowMoveAtoms) bsSelected = this.ms.getMoleculeBitSet(bsSelected);
return this.movableBitSet = bsSelected;
}, "JU.BS,~B");
Clazz_defineMethod(c$, "translateXYBy", 
function(xDelta, yDelta){
this.tm.translateXYBy(xDelta, yDelta);
this.refresh(2, this.sm.syncingMouse ? "Mouse: translateXYBy " + xDelta + " " + yDelta : "");
}, "~N,~N");
Clazz_overrideMethod(c$, "rotateFront", 
function(){
this.tm.resetRotation();
this.refresh(1, "Viewer:rotateFront()");
});
Clazz_defineMethod(c$, "translate", 
function(xyz, x, type, bsAtoms){
var xy = (type == '\0' ? x : type == '%' ? this.tm.percentToPixels(xyz, x) : this.tm.angstromsToPixels(x * (type == 'n' ? 10 : 1)));
if (bsAtoms != null) {
if (x == 0) return;
this.tm.setSelectedTranslation(bsAtoms, xyz, xy, x);
} else {
switch ((xyz).charCodeAt(0)) {
case 88:
case 120:
if (type == '\0') this.tm.translateToPercent('x', x);
 else this.tm.translateXYBy(Clazz_floatToInt(xy), 0);
break;
case 89:
case 121:
if (type == '\0') this.tm.translateToPercent('y', x);
 else this.tm.translateXYBy(0, Clazz_floatToInt(xy));
break;
case 90:
case 122:
if (type == '\0') this.tm.translateToPercent('z', x);
 else this.tm.translateZBy(Clazz_floatToInt(xy));
break;
}
}this.refresh(1, "Viewer:translate()");
}, "~S,~N,~S,JU.BS");
Clazz_defineMethod(c$, "slabByPixels", 
function(pixels){
this.tm.slabByPercentagePoints(pixels);
this.refresh(3, "slabByPixels");
}, "~N");
Clazz_defineMethod(c$, "depthByPixels", 
function(pixels){
this.tm.depthByPercentagePoints(pixels);
this.refresh(3, "depthByPixels");
}, "~N");
Clazz_defineMethod(c$, "slabDepthByPixels", 
function(pixels){
this.tm.slabDepthByPercentagePoints(pixels);
this.refresh(3, "slabDepthByPixels");
}, "~N");
Clazz_defineMethod(c$, "finalizeTransformParameters", 
function(){
this.tm.finalizeTransformParameters();
this.gdata.setSlabAndZShade(this.tm.slabValue, this.tm.depthValue, (this.tm.zShadeEnabled ? this.tm.zSlabValue : 2147483647), this.tm.zDepthValue, this.g.zShadePower);
});
Clazz_defineMethod(c$, "getScalePixelsPerAngstrom", 
function(asAntialiased){
return this.tm.scalePixelsPerAngstrom * (asAntialiased || !this.antialiased ? 1 : 0.5);
}, "~B");
Clazz_defineMethod(c$, "setSpin", 
function(key, value){
if (!JU.PT.isOneOf(key, ";x;y;z;fps;X;Y;Z;FPS;")) return;
var i = "x;y;z;fps;X;Y;Z;FPS".indexOf(key);
switch (i) {
case 0:
this.tm.setSpinXYZ(value, NaN, NaN);
break;
case 2:
this.tm.setSpinXYZ(NaN, value, NaN);
break;
case 4:
this.tm.setSpinXYZ(NaN, NaN, value);
break;
case 6:
default:
this.tm.setSpinFps(value);
break;
case 10:
this.tm.setNavXYZ(value, NaN, NaN);
break;
case 12:
this.tm.setNavXYZ(NaN, value, NaN);
break;
case 14:
this.tm.setNavXYZ(NaN, NaN, value);
break;
case 16:
this.tm.setNavFps(value);
break;
}
this.g.setI((i < 10 ? "spin" : "nav") + key, value);
}, "~S,~N");
Clazz_defineMethod(c$, "getSpinState", 
function(){
return this.getStateCreator().getSpinState(false);
});
Clazz_defineMethod(c$, "getOrientation", 
function(type, name, bs, points){
switch (type) {
case 1312817669:
case 1814695966:
case 1073741864:
case 1111492629:
case 1111492630:
case 1111492631:
case 134221850:
if (bs == null) bs = this.bsA();
if (bs.isEmpty()) return (type == 1312817669 ? "0" : type == 1814695966 || type == 1073741864 ? null :  new JU.Quat());
var q = this.ms.getBoundBoxOrientation(type, bs, points);
return (name === "best" && type != 1312817669 ? (q).div(this.tm.getRotationQ()) : q);
case 1073742034:
return this.stm.getSavedOrientationText(name);
default:
return this.tm.getOrientationText(type, name === "best");
}
}, "~N,~S,JU.BS,~A");
Clazz_defineMethod(c$, "getCurrentColorRange", 
function(){
return this.cm.getPropertyColorRange();
});
Clazz_defineMethod(c$, "setDefaultColors", 
function(isRasmol){
this.cm.setDefaultColors(isRasmol);
this.g.setB("colorRasmol", isRasmol);
this.g.setO("defaultColorScheme", (isRasmol ? "rasmol" : "jmol"));
}, "~B");
Clazz_defineMethod(c$, "setElementArgb", 
function(elementNumber, argb){
this.g.setO("=color " + JU.Elements.elementNameFromNumber(elementNumber), JU.Escape.escapeColor(argb));
this.cm.setElementArgb(elementNumber, argb);
}, "~N,~N");
Clazz_overrideMethod(c$, "setVectorScale", 
function(scale){
this.g.setF("vectorScale", scale);
this.g.vectorScale = scale;
}, "~N");
Clazz_overrideMethod(c$, "setVibrationScale", 
function(scale){
this.tm.setVibrationScale(scale);
this.g.vibrationScale = scale;
this.g.setF("vibrationScale", scale);
}, "~N");
Clazz_overrideMethod(c$, "setVibrationPeriod", 
function(period){
if (Double.isNaN(period)) {
period = this.g.vibrationPeriod;
}this.tm.setVibrationPeriod(period);
period = Math.abs(period);
this.g.vibrationPeriod = period;
this.g.setF("vibrationPeriod", period);
}, "~N");
Clazz_defineMethod(c$, "setObjectColor", 
function(name, colorName){
if (colorName == null || colorName.length == 0) return;
this.setObjectArgb(name, JU.CU.getArgbFromString(colorName));
}, "~S,~S");
Clazz_defineMethod(c$, "setObjectVisibility", 
function(name, b){
var objId = JV.StateManager.getObjectIdFromName(name);
if (objId >= 0) {
this.setShapeProperty(objId, "display", b ? Boolean.TRUE : Boolean.FALSE);
}}, "~S,~B");
Clazz_defineMethod(c$, "setObjectArgb", 
function(name, argb){
var objId = JV.StateManager.getObjectIdFromName(name);
if (objId < 0) {
if (name.equalsIgnoreCase("axes")) {
this.setObjectArgb("axis1", argb);
this.setObjectArgb("axis2", argb);
this.setObjectArgb("axis3", argb);
}return;
}this.g.objColors[objId] = argb;
switch (objId) {
case 0:
this.gdata.setBackgroundArgb(argb);
this.cm.setColixBackgroundContrast(argb);
break;
}
this.g.setO(name + "Color", JU.Escape.escapeColor(argb));
}, "~S,~N");
Clazz_defineMethod(c$, "setBackgroundImage", 
function(fileName, image){
this.g.backgroundImageFileName = fileName;
this.gdata.setBackgroundImage(image);
}, "~S,~O");
Clazz_defineMethod(c$, "getObjectColix", 
function(objId){
var argb = this.g.objColors[objId];
return (argb == 0 ? this.cm.colixBackgroundContrast : JU.C.getColix(argb));
}, "~N");
Clazz_overrideMethod(c$, "setColorBackground", 
function(colorName){
this.setObjectColor("background", colorName);
}, "~S");
Clazz_overrideMethod(c$, "getBackgroundArgb", 
function(){
return this.g.objColors[(0)];
});
Clazz_defineMethod(c$, "setObjectMad10", 
function(iShape, name, mad10){
var objId = JV.StateManager.getObjectIdFromName(name.equalsIgnoreCase("axes") ? "axis" : name);
if (objId < 0) return;
if (mad10 == -2 || mad10 == -4) {
var m = mad10 + 3;
mad10 = this.getObjectMad10(objId);
if (mad10 == 0) mad10 = m;
}this.g.setB("show" + name, mad10 != 0);
this.g.objStateOn[objId] = (mad10 != 0);
if (mad10 == 0) return;
this.g.objMad10[objId] = mad10;
this.setShapeSize(iShape, mad10, null);
}, "~N,~S,~N");
Clazz_defineMethod(c$, "getObjectMad10", 
function(objId){
return (this.g.objStateOn[objId] ? this.g.objMad10[objId] : 0);
}, "~N");
Clazz_defineMethod(c$, "setPropertyColorScheme", 
function(scheme, isTranslucent, isOverloaded){
this.g.propertyColorScheme = scheme;
if (scheme.startsWith("translucent ")) {
isTranslucent = true;
scheme = scheme.substring(12).trim();
}this.cm.setPropertyColorScheme(scheme, isTranslucent, isOverloaded);
}, "~S,~B,~B");
Clazz_defineMethod(c$, "getLightingState", 
function(){
return this.getStateCreator().getLightingState(true);
});
Clazz_defineMethod(c$, "getColorPointForPropertyValue", 
function(val){
return JU.CU.colorPtFromInt(this.gdata.getColorArgbOrGray(this.cm.ce.getColorIndex(val)), null);
}, "~N");
Clazz_defineMethod(c$, "select", 
function(bs, isGroup, addRemove, isQuiet){
if (isGroup) bs = this.getUndeletedGroupAtomBits(bs);
this.slm.select(bs, addRemove, isQuiet);
this.shm.setShapeSizeBs(1, 2147483647, null, null);
this.hasSelected = true;
}, "JU.BS,~B,~N,~B");
Clazz_overrideMethod(c$, "setSelectionSet", 
function(set){
this.selectStatus(set, false, 0, true, true);
}, "JU.BS");
Clazz_defineMethod(c$, "selectBonds", 
function(bs){
this.shm.setShapeSizeBs(1, 2147483647, null, bs);
}, "JU.BS");
Clazz_defineMethod(c$, "displayAtoms", 
function(bs, isDisplay, isGroup, addRemove, isQuiet){
if (isGroup) bs = this.getUndeletedGroupAtomBits(bs);
if (isDisplay) this.slm.display(this.ms, bs, addRemove, isQuiet);
 else this.slm.hide(this.ms, bs, addRemove, isQuiet);
}, "JU.BS,~B,~B,~N,~B");
Clazz_defineMethod(c$, "getUndeletedGroupAtomBits", 
function(bs){
bs = this.ms.getAtoms(1086324742, bs);
JU.BSUtil.andNot(bs, this.slm.bsDeleted);
return bs;
}, "JU.BS");
Clazz_defineMethod(c$, "reportSelection", 
function(msg){
if (this.selectionHalosEnabled) this.setTainted(true);
if (this.isScriptQueued() || this.g.debugScript) this.scriptStatus(msg);
}, "~S");
Clazz_defineMethod(c$, "clearAtomSets", 
function(){
this.slm.setSelectionSubset(null);
this.definedAtomSets.clear();
if (this.haveDisplay) this.acm.exitMeasurementMode("clearAtomSets");
});
Clazz_defineMethod(c$, "getDefinedAtomSet", 
function(name){
var o = this.definedAtomSets.get(name.toLowerCase());
return (Clazz_instanceOf(o,"JU.BS") ? o :  new JU.BS());
}, "~S");
Clazz_overrideMethod(c$, "selectAll", 
function(){
this.slm.selectAll(false);
});
Clazz_overrideMethod(c$, "clearSelection", 
function(){
this.slm.clearSelection(true);
this.g.setB("hideNotSelected", false);
});
Clazz_defineMethod(c$, "bsA", 
function(){
return this.slm.getSelectedAtoms(false);
});
Clazz_overrideMethod(c$, "addSelectionListener", 
function(listener){
this.slm.addListener(listener);
}, "J.api.JmolSelectionListener");
Clazz_overrideMethod(c$, "removeSelectionListener", 
function(listener){
this.slm.addListener(listener);
}, "J.api.JmolSelectionListener");
Clazz_defineMethod(c$, "getAtomBitSetEval", 
function(eval, atomExpression){
return (this.allowScripting ? this.getScriptManager().getAtomBitSetEval(eval, atomExpression) :  new JU.BS());
}, "J.api.JmolScriptEvaluator,~O");
Clazz_defineMethod(c$, "processTwoPointGesture", 
function(touches){
this.mouse.processTwoPointGesture(touches);
}, "~A");
Clazz_defineMethod(c$, "processMouseEvent", 
function(id, x, y, modifiers, time){
return this.mouse.processEvent(id, x, y, modifiers, time);
}, "~N,~N,~N,~N,~N");
Clazz_defineMethod(c$, "processKeyEvent", 
function(event){
this.mouse.processKeyEvent(event);
}, "~O");
Clazz_defineMethod(c$, "getRubberBandSelection", 
function(){
return (this.haveDisplay ? this.acm.getRubberBand() : null);
});
Clazz_defineMethod(c$, "isBound", 
function(mouseAction, jmolAction){
return (this.haveDisplay && this.acm.bnd(mouseAction, [jmolAction]));
}, "~N,~N");
Clazz_defineMethod(c$, "getCursorX", 
function(){
return (this.haveDisplay ? this.am.setSplitFrameMouse(this.acm.getCurrentX()) : 0);
});
Clazz_defineMethod(c$, "getCursorY", 
function(){
return (this.haveDisplay ? this.acm.getCurrentY() : 0);
});
Clazz_defineMethod(c$, "getDefaultDirectory", 
function(){
return this.g.defaultDirectory;
});
Clazz_defineMethod(c$, "getLocalUrl", 
function(fileName){
return this.apiPlatform.getLocalUrl(fileName);
}, "~S");
Clazz_defineMethod(c$, "getFileAsString", 
function(fileName){
return this.getAsciiFileOrNull(fileName);
}, "~S");
Clazz_overrideMethod(c$, "getBufferedInputStream", 
function(fullPathName){
return this.fm.getBufferedInputStream(fullPathName);
}, "~S");
Clazz_defineMethod(c$, "setLoadParameters", 
function(htParams, isAppend){
if (htParams == null) htParams =  new java.util.Hashtable();
htParams.put("vwr", this);
if (this.g.atomTypes.length > 0) htParams.put("atomTypes", this.g.atomTypes);
if (!htParams.containsKey("lattice")) htParams.put("lattice", this.g.ptDefaultLattice);
if (this.g.applySymmetryToBonds) htParams.put("applySymmetryToBonds", Boolean.TRUE);
if (this.g.pdbGetHeader) htParams.put("getHeader", Boolean.TRUE);
if (this.g.pdbSequential) htParams.put("isSequential", Boolean.TRUE);
if (this.g.legacyJavaFloat || this.g.doublePrecision) htParams.put("highPrecision", Boolean.TRUE);
if (!this.g.doublePrecision) htParams.put("lowPrecision", Boolean.TRUE);
htParams.put("stateScriptVersionInt", Integer.$valueOf(this.stateScriptVersionInt));
if (!htParams.containsKey("filter")) {
var filter = this.g.defaultLoadFilter;
if (filter.length > 0) htParams.put("filter", filter);
}var merging = (isAppend && !this.g.appendNew && this.ms.ac > 0);
htParams.put("baseAtomIndex", Integer.$valueOf(isAppend ? this.ms.ac : 0));
htParams.put("baseBondIndex", Integer.$valueOf(isAppend ? this.ms.bondCount : 0));
htParams.put("baseModelIndex", Integer.$valueOf(this.ms.ac == 0 ? 0 : this.ms.mc + (merging ? -1 : 0)));
if (merging) htParams.put("merging", Boolean.TRUE);
return htParams;
}, "java.util.Map,~B");
Clazz_overrideMethod(c$, "openFileAsyncSpecial", 
function(fileName, flags){
this.fm.openFileAsync(fileName, flags, null);
}, "~S,~N");
Clazz_overrideMethod(c$, "openFileAsyncSpecialType", 
function(fileName, flags, fileType){
this.fm.openFileAsync(fileName, flags, fileType);
}, "~S,~N,~S");
Clazz_overrideMethod(c$, "openFile", 
function(fileName){
this.zap(true, true, false);
return this.loadModelFromFileRepaint(null, fileName, null, null);
}, "~S");
Clazz_overrideMethod(c$, "openFiles", 
function(fileNames){
this.zap(true, true, false);
return this.loadModelFromFileRepaint(null, null, fileNames, null);
}, "~A");
Clazz_defineMethod(c$, "openReader", 
function(fullPathName, fileName, reader){
this.zap(true, true, false);
return this.loadModelFromFileRepaint(fullPathName, fileName, null, reader);
}, "~S,~S,~O");
Clazz_overrideMethod(c$, "openDOM", 
function(DOMNode){
this.zap(true, true, false);
return this.loadModelFromFileRepaint("?", "?", null, DOMNode);
}, "~O");
Clazz_defineMethod(c$, "loadModelFromFileRepaint", 
function(fullPathName, fileName, fileNames, reader){
var ret = this.loadModelFromFile(fullPathName, fileName, fileNames, reader, false, null, null, null, 0, " ");
this.refresh(1, "loadModelFromFileRepaint");
return ret;
}, "~S,~S,~A,~O");
Clazz_defineMethod(c$, "loadModelFromFile", 
function(fullPathName, fileName, fileNames, reader, isAppend, htParams, loadScript, sOptions, tokType, filecat){
if (htParams == null) htParams = this.setLoadParameters(null, isAppend);
if (tokType != 0) htParams.put("dataType", JS.T.nameOf(tokType));
if (filecat !== " ") htParams.put("concatenate", Boolean.TRUE);
var atomSetCollection;
var saveInfo = this.fm.getFileInfo();
if (fileNames != null) {
if (loadScript == null) {
loadScript =  new JU.SB().append("load ").append(isAppend ? "append " : "").append("files");
for (var i = 0; i < fileNames.length; i++) loadScript.append(i == 0 || filecat == null ? " " : filecat).append("/*file*/$FILENAME" + (i + 1) + "$");

if (sOptions.length() > 0) loadScript.append(" /*options*/ ").append(sOptions.toString());
}var timeBegin = System.currentTimeMillis();
atomSetCollection = this.fm.createAtomSetCollectionFromFiles(fileNames, this.setLoadParameters(htParams, isAppend), isAppend);
var ms = System.currentTimeMillis() - timeBegin;
JU.Logger.info("openFiles(" + fileNames.length + ") " + ms + " ms");
fileNames = htParams.get("fullPathNames");
var fileTypes = htParams.get("fileTypes");
var s = loadScript.toString();
for (var i = 0; i < fileNames.length; i++) {
var fname = fileNames[i];
if (fileTypes != null && fileTypes[i] != null) fname = fileTypes[i] + "::" + fname;
s = JU.PT.rep(s, "$FILENAME" + (i + 1) + "$", JU.PT.esc(JV.FileManager.fixDOSName(fname)));
}
loadScript =  new JU.SB().append(s);
} else if (reader == null) {
if (loadScript == null) loadScript =  new JU.SB().append("load /*file*/$FILENAME$");
atomSetCollection = this.openFileFull(fileName, isAppend, htParams, loadScript);
} else if (Clazz_instanceOf(reader,"java.io.Reader") || Clazz_instanceOf(reader,"java.io.BufferedInputStream") || JU.AU.isAB(reader)) {
atomSetCollection = this.fm.createAtomSetCollectionFromReader(fullPathName, fileName, reader, this.setLoadParameters(htParams, isAppend));
} else {
return "ERROR - invalid reader";
}if (tokType != 0) {
this.fm.setFileInfo(saveInfo);
return this.loadAtomDataAndReturnError(atomSetCollection, tokType);
}if (htParams.containsKey("isData")) return atomSetCollection;
if (loadScript != null && !((typeof(atomSetCollection)=='string'))) {
var fname = htParams.get("fullPathName");
if (fname == null) fname = "";
if (htParams.containsKey("loadScript")) loadScript = htParams.get("loadScript");
htParams.put("loadScript", loadScript =  new JU.SB().append(JU.PT.rep(loadScript.toString(), "$FILENAME$", JU.PT.esc(JV.FileManager.fixDOSName(fname)))));
}return this.createModelSetAndReturnError(atomSetCollection, isAppend, loadScript, htParams);
}, "~S,~S,~A,~O,~B,java.util.Map,JU.SB,JU.SB,~N,~S");
Clazz_defineMethod(c$, "setLigandModel", 
function(key, data){
if (this.ligandModels == null) this.ligandModels =  new java.util.Hashtable();
this.ligandModels.put(key, data);
}, "~S,~S");
Clazz_defineMethod(c$, "getLigandModel", 
function(id, prefix, suffix, terminator){
if (id == null) {
if (this.ligandModelSet != null) {
var e = this.ligandModels.entrySet().iterator();
while (e.hasNext()) {
var entry = e.next();
if (Clazz_instanceOf(entry.getValue(), Boolean)) e.remove();
}
}return null;
}id = id.$replace('\\', '/');
var isLigand = prefix.equals("ligand_");
id = (id.indexOf("/cif") >= 0 ? id : isLigand ? id.toUpperCase() : id.substring(id.lastIndexOf("/") + 1));
if (this.ligandModelSet == null) this.ligandModelSet =  new java.util.Hashtable();
this.ligandModelSet.put(id, Boolean.TRUE);
if (this.ligandModels == null) this.ligandModels =  new java.util.Hashtable();
var pngPt = id.indexOf("|");
if (pngPt >= 0) id = id.substring(id.indexOf("|") + 1);
var model = (terminator == null ? this.ligandModels.get(id) : null);
var data;
var fname = null;
if (Clazz_instanceOf(model, Boolean)) return null;
if (model == null && (terminator == null || pngPt >= 0)) model = this.ligandModels.get(id + suffix);
var isError = false;
var isNew = (model == null);
if (isNew) {
var s;
if (isLigand) {
fname = this.setLoadFormat(false, "#" + id, '#', false);
if (fname.length == 0) return null;
this.scriptEcho("fetching " + fname);
s = this.getFileAsString3(fname, false, null);
} else {
this.scriptEcho("fetching " + prefix);
s = this.getFileAsString3(prefix, false, null);
var pt = (terminator == null ? -1 : s.indexOf(terminator));
if (pt >= 0) s = s.substring(0, pt);
}isError = (s.indexOf("java.") == 0);
model = s;
if (!isError) this.ligandModels.put(id + suffix, model);
}if (!isLigand) {
if (!isNew) this.scriptEcho(prefix + " loaded from cache");
return model;
}if (!isError && (typeof(model)=='string')) {
data = model;
if (data.length != 0) {
var htParams =  new java.util.Hashtable();
htParams.put("modelOnly", Boolean.TRUE);
model = this.getModelAdapter().getAtomSetCollectionReader("ligand", null, JU.Rdr.getBR(data), htParams);
isError = ((typeof(model)=='string'));
if (!isError) {
model = this.getModelAdapter().getAtomSetCollection(model);
isError = ((typeof(model)=='string'));
if (fname != null && !isError) this.scriptEcho(this.getModelAdapter().getAtomSetCollectionAuxiliaryInfo(model).get("modelLoadNote"));
}}}if (isError) {
this.scriptEcho(model.toString());
this.ligandModels.put(id, Boolean.FALSE);
return null;
}return model;
}, "~S,~S,~S,~S");
Clazz_defineMethod(c$, "openFileFull", 
function(fileName, isAppend, htParams, loadScript){
if (fileName == null) return null;
if (fileName.equals("String[]")) {
return null;
}var atomSetCollection;
var msg = "openFile(" + fileName + ")";
JU.Logger.startTimer(msg);
htParams = this.setLoadParameters(htParams, isAppend);
var isLoadVariable = fileName.startsWith("@");
var haveFileData = (htParams.containsKey("fileData"));
if (fileName.indexOf('$') == 0) htParams.put("smilesString", fileName.substring(1));
var isString = (fileName.equals("string") || fileName.equals("Jmol Model Kit"));
var strModel = null;
if (haveFileData) {
strModel = htParams.get("fileData");
if (htParams.containsKey("isData")) {
var o = this.loadInlineScript(strModel, '\0', isAppend, htParams);
this.lastData = (this.g.preserveState ? this.getDataManager().createFileData(strModel) : null);
return o;
}} else if (isString) {
strModel = this.ms.getInlineData(-1);
if (strModel == null) if (this.g.modelKitMode) strModel = "5\n\nC 0 0 0\nH .63 .63 .63\nH -.63 -.63 .63\nH -.63 .63 -.63\nH .63 -.63 -.63";
 else return "cannot find string data";
if (loadScript != null) htParams.put("loadScript", loadScript =  new JU.SB().append(JU.PT.rep(loadScript.toString(), "/*file*/$FILENAME$", "/*data*/data \"model inline\"\n" + strModel + "end \"model inline\"")));
}if (strModel != null) {
if (!isAppend) this.zap(true, false, false);
if (!isLoadVariable && (!haveFileData || isString)) this.getStateCreator().getInlineData(loadScript, strModel, isAppend, htParams.get("appendToModelIndex"), this.g.defaultLoadFilter);
atomSetCollection = this.fm.createAtomSetCollectionFromString(strModel, htParams, isAppend);
} else {
atomSetCollection = this.fm.createAtomSetCollectionFromFile(fileName, htParams, isAppend);
}JU.Logger.checkTimer(msg, false);
return atomSetCollection;
}, "~S,~B,java.util.Map,JU.SB");
Clazz_overrideMethod(c$, "openStringInline", 
function(strModel){
var ret = this.openStringInlineParamsAppend(strModel, null, false);
this.refresh(1, "openStringInline");
return ret;
}, "~S");
Clazz_defineMethod(c$, "loadInline", 
function(strModel){
return this.loadInlineScriptRepaint(strModel, this.g.inlineNewlineChar, false);
}, "~S");
Clazz_defineMethod(c$, "loadInline", 
function(strModel, newLine){
return this.loadInlineScriptRepaint(strModel, newLine, false);
}, "~S,~S");
Clazz_overrideMethod(c$, "loadInlineAppend", 
function(strModel, isAppend){
return this.loadInlineScriptRepaint(strModel, '\0', isAppend);
}, "~S,~B");
Clazz_defineMethod(c$, "loadInlineScriptRepaint", 
function(strModel, newLine, isAppend){
var ret = this.loadInlineScript(strModel, newLine, isAppend, null);
this.refresh(1, "loadInlineScript");
return ret;
}, "~S,~S,~B");
Clazz_defineMethod(c$, "loadInline", 
function(arrayModels){
return this.loadInline(arrayModels, false);
}, "~A");
Clazz_defineMethod(c$, "loadInline", 
function(arrayModels, isAppend){
if (arrayModels == null || arrayModels.length == 0) return null;
var ret = this.openStringsInlineParamsAppend(arrayModels,  new java.util.Hashtable(), isAppend);
this.refresh(1, "loadInline String[]");
return ret;
}, "~A,~B");
Clazz_defineMethod(c$, "loadInline", 
function(arrayData, isAppend){
if (arrayData == null || arrayData.size() == 0) return null;
if (!isAppend) this.zap(true, false, false);
var list =  new JU.Lst();
for (var i = 0; i < arrayData.size(); i++) list.addLast(arrayData.get(i));

var atomSetCollection = this.fm.createAtomSeCollectionFromArrayData(list, this.setLoadParameters(null, isAppend), isAppend);
var ret = this.createModelSetAndReturnError(atomSetCollection, isAppend, null,  new java.util.Hashtable());
this.refresh(1, "loadInline");
return ret;
}, "java.util.List,~B");
Clazz_defineMethod(c$, "loadInlineScript", 
function(strModel, newLine, isAppend, htParams){
if (strModel == null || strModel.length == 0) return null;
if (!strModel.startsWith(";base64,")) {
strModel = JV.Viewer.fixInlineString(strModel, newLine);
if (newLine.charCodeAt(0) != 0) JU.Logger.info("loading model inline, " + strModel.length + " bytes, with newLine character " + (newLine).charCodeAt(0) + " isAppend=" + isAppend);
if (JU.Logger.debugging) JU.Logger.debug(strModel);
var datasep = this.getDataSeparator();
var i;
if (datasep != null && datasep !== "" && (i = strModel.indexOf(datasep)) >= 0 && strModel.indexOf("# Jmol state") < 0) {
var n = 2;
while ((i = strModel.indexOf(datasep, i + 1)) >= 0) n++;

var strModels =  new Array(n);
var pt = 0;
var pt0 = 0;
for (i = 0; i < n; i++) {
pt = strModel.indexOf(datasep, pt0);
if (pt < 0) pt = strModel.length;
strModels[i] = strModel.substring(pt0, pt);
pt0 = pt + datasep.length;
}
return this.openStringsInlineParamsAppend(strModels, htParams, isAppend);
}}return this.openStringInlineParamsAppend(strModel, htParams, isAppend);
}, "~S,~S,~B,java.util.Map");
c$.fixInlineString = Clazz_defineMethod(c$, "fixInlineString", 
function(strModel, newLine){
var i;
if (strModel.indexOf("\\/n") >= 0) {
strModel = JU.PT.rep(strModel, "\n", "");
strModel = JU.PT.rep(strModel, "\\/n", "\n");
newLine = String.fromCharCode( 0);
}if (newLine.charCodeAt(0) != 0 && newLine != '\n') {
var repEmpty = (strModel.indexOf('\n') >= 0);
var len = strModel.length;
for (i = 0; i < len && strModel.charAt(i) == ' '; ++i) {
}
if (i < len && strModel.charAt(i) == newLine) strModel = strModel.substring(i + 1);
if (repEmpty) strModel = JU.PT.rep(strModel, "" + newLine, "");
 else strModel = strModel.$replace(newLine, '\n');
}return strModel;
}, "~S,~S");
Clazz_defineMethod(c$, "openStringInlineParamsAppend", 
function(strModel, htParams, isAppend){
{
return this.openStringInlineParamsAppend0(strModel, htParams, isAppend);
}}, "~S,java.util.Map,~B");
Clazz_defineMethod(c$, "openStringInlineParamsAppend0", 
function(strModel, htParams, isAppend){
htParams = this.setLoadParameters(htParams, isAppend);
var loadScript = htParams.get("loadScript");
var isLoadCommand = htParams.containsKey("isData");
if (!strModel.startsWith(";base64,")) {
var type = this.getModelAdapter().getFileTypeName(htParams.get("filter"));
if (type == null && (type = this.getModelAdapter().getFileTypeName(JU.Rdr.getBR(strModel))) == null) return "unknown file type";
if (type.equals("spt")) {
return "cannot open script inline";
}}if (loadScript == null) loadScript =  new JU.SB();
if (!isAppend) this.zap(true, false, false);
if (!isLoadCommand) {
this.getStateCreator().getInlineData(loadScript, strModel, isAppend, htParams.get("appendToModelIndex"), this.g.defaultLoadFilter);
}var atomSetCollection = this.fm.createAtomSetCollectionFromString(strModel, htParams, isAppend);
return this.createModelSetAndReturnError(atomSetCollection, isAppend, loadScript, htParams);
}, "~S,java.util.Map,~B");
Clazz_defineMethod(c$, "openStringsInlineParamsAppend", 
function(arrayModels, htParams, isAppend){
var loadScript =  new JU.SB();
if (!isAppend) this.zap(true, false, false);
var atomSetCollection = this.fm.createAtomSeCollectionFromStrings(arrayModels, loadScript, this.setLoadParameters(htParams, isAppend), isAppend);
return this.createModelSetAndReturnError(atomSetCollection, isAppend, loadScript, htParams);
}, "~A,java.util.Map,~B");
Clazz_defineMethod(c$, "getInlineChar", 
function(){
return this.g.inlineNewlineChar;
});
Clazz_defineMethod(c$, "getDataSeparator", 
function(){
return this.g.getParameter("dataseparator", true);
});
Clazz_defineMethod(c$, "createModelSetAndReturnError", 
function(atomSetCollection, isAppend, loadScript, htParams){
{
return this.createModelSetAndReturnError0(atomSetCollection, isAppend, loadScript, htParams);
}}, "~O,~B,JU.SB,java.util.Map");
Clazz_defineMethod(c$, "createModelSetAndReturnError0", 
function(atomSetCollection, isAppend, loadScript, htParams){
JU.Logger.startTimer("creating model");
var fullPathName = this.fm.getFullPathName(false);
var fileName = this.fm.getFileName();
var errMsg;
if (loadScript == null) {
this.setBooleanPropertyTok("preserveState", 603979898, false);
loadScript =  new JU.SB().append("load \"???\"");
}if ((typeof(atomSetCollection)=='string')) {
errMsg = atomSetCollection;
this.setFileLoadStatus(J.c.FIL.NOT_LOADED, fullPathName, null, null, errMsg, null);
if (this.displayLoadErrors && !isAppend && !errMsg.equals("#CANCELED#") && !errMsg.startsWith("File reader was not found:")) this.zapMsg(errMsg);
return errMsg;
}if (isAppend) this.clearAtomSets();
 else if (this.g.modelKitMode && !fileName.equals("Jmol Model Kit")) this.setModelKitMode(false);
this.setFileLoadStatus(J.c.FIL.CREATING_MODELSET, fullPathName, fileName, null, null, null);
this.pushHoldRepaintWhy("createModelSet");
this.setErrorMessage(null, null);
try {
var bsNew =  new JU.BS();
this.mm.createModelSet(fullPathName, fileName, loadScript, atomSetCollection, bsNew, isAppend);
if (!bsNew.isEmpty()) {
var jmolScript = this.ms.getInfoM("jmolscript");
if (this.ms.getMSInfoB("doMinimize")) {
try {
var eval = htParams.get("eval");
var stereo = this.getAtomBitSet("_C & connected(3) & !connected(double)");
stereo.and(bsNew);
if (stereo.nextSetBit(0) >= 0) {
bsNew.or(this.addHydrogens(stereo, 41));
}this.minimize(eval, 2147483647, 0, bsNew, null, null, 0, 185);
} catch (e) {
if (Clazz_exceptionOf(e, Exception)){
} else {
throw e;
}
}
} else {
this.addHydrogens(bsNew, 9);
}if (jmolScript != null) this.ms.msInfo.put("jmolscript", jmolScript);
}this.initializeModel(isAppend);
} catch (er) {
if (Clazz_exceptionOf(er, Error)){
this.handleError(er, true);
errMsg = this.getShapeErrorState();
errMsg = ("ERROR creating model: " + er + (errMsg.length == 0 ? "" : "|" + errMsg));
this.zapMsg(errMsg);
this.setErrorMessage(errMsg, null);
} else {
throw er;
}
}
this.popHoldRepaint("createModelSet \u0001## REPAINT_IGNORE ##");
errMsg = this.getErrorMessage();
this.setFileLoadStatus(J.c.FIL.CREATED, fullPathName, fileName, this.ms.modelSetName, errMsg, htParams.get("async"));
if (isAppend) {
this.selectAll();
this.setTainted(true);
this.axesAreTainted = true;
}atomSetCollection = null;
JU.Logger.checkTimer("creating model", false);
System.gc();
return errMsg;
}, "~O,~B,JU.SB,java.util.Map");
Clazz_defineMethod(c$, "loadAtomDataAndReturnError", 
function(atomSetCollection, tokType){
if ((typeof(atomSetCollection)=='string')) return atomSetCollection;
this.setErrorMessage(null, null);
try {
var script = this.mm.createAtomDataSet(atomSetCollection, tokType);
switch (tokType) {
case 1145047049:
if (script != null) this.runScriptCautiously(script);
break;
case 4166:
this.setStatusFrameChanged(true, false);
break;
case 1648363544:
this.shm.deleteVdwDependentShapes(null);
break;
}
} catch (er) {
if (Clazz_exceptionOf(er, Error)){
this.handleError(er, true);
var errMsg = this.getShapeErrorState();
errMsg = ("ERROR adding atom data: " + er + (errMsg.length == 0 ? "" : "|" + errMsg));
this.zapMsg(errMsg);
this.setErrorMessage(errMsg, null);
this.setParallel(false);
} else {
throw er;
}
}
return this.getErrorMessage();
}, "~O,~N");
Clazz_defineMethod(c$, "getCurrentFileAsString", 
function(state){
var filename = this.fm.getFullPathName(false);
if (filename.equals("string") || filename.equals("Jmol Model Kit")) return this.ms.getInlineData(this.am.cmi);
if (filename.equals("String[]")) return filename;
if (filename === "JSNode") return "<DOM NODE>";
return this.getFileAsString4(filename, -1, true, false, false, state);
}, "~S");
Clazz_defineMethod(c$, "getFullPathNameOrError", 
function(filename){
var data =  new Array(2);
this.fm.getFullPathNameOrError(filename, false, data);
return data;
}, "~S");
Clazz_defineMethod(c$, "getFileAsString3", 
function(name, checkProtected, state){
return this.getFileAsString4(name, -1, false, false, checkProtected, state);
}, "~S,~B,~S");
Clazz_defineMethod(c$, "getFileAsString4", 
function(name, nBytesMax, doSpecialLoad, allowBinary, checkProtected, state){
if (name == null) return this.getCurrentFileAsString(state);
var data =  Clazz_newArray(-1, [name, null]);
this.fm.getFileDataAsString(data, nBytesMax, doSpecialLoad, allowBinary, checkProtected);
return data[1];
}, "~S,~N,~B,~B,~B,~S");
Clazz_defineMethod(c$, "getAsciiFileOrNull", 
function(name){
return this.fm.getAsciiFileOrNull(name);
}, "~S");
Clazz_defineMethod(c$, "autoCalculate", 
function(tokProperty, dataType){
switch (tokProperty) {
case 1111490575:
this.ms.getSurfaceDistanceMax();
break;
case 1111490574:
this.ms.calculateStraightnessAll();
break;
case 1111490587:
this.ms.calculateDssrProperty(dataType);
}
}, "~N,~S");
Clazz_defineMethod(c$, "calculateStraightness", 
function(){
this.ms.haveStraightness = false;
this.ms.calculateStraightnessAll();
});
Clazz_defineMethod(c$, "calculateSurface", 
function(bsSelected, envelopeRadius){
if (bsSelected == null) bsSelected = this.bsA();
if (envelopeRadius == 3.4028235E38 || envelopeRadius == -1) this.ms.addStateScript("calculate surfaceDistance " + (envelopeRadius == 3.4028235E38 ? "FROM" : "WITHIN"), null, bsSelected, null, "", false, true);
return this.ms.calculateSurface(bsSelected, envelopeRadius);
}, "JU.BS,~N");
Clazz_defineMethod(c$, "getStructureList", 
function(){
return this.g.getStructureList();
});
Clazz_defineMethod(c$, "setStructureList", 
function(list, type){
this.g.setStructureList(list, type);
this.ms.setStructureList(this.getStructureList());
}, "~A,J.c.STR");
Clazz_defineMethod(c$, "calculateStructures", 
function(bsAtoms, asDSSP, setStructure, version){
if (bsAtoms == null) bsAtoms = this.bsA();
return this.ms.calculateStructures(bsAtoms, asDSSP, !this.am.animationOn, this.g.dsspCalcHydrogen, setStructure, version);
}, "JU.BS,~B,~B,~N");
Clazz_defineMethod(c$, "getAnnotationParserIfPresent", 
function(type){
return (type == 1111490587 ? this.dssrParser : this.annotationParser);
}, "~N");
Clazz_defineMethod(c$, "getAnnotationParser", 
function(type){
if (type == 1111490587) {
return (this.dssrParser == null ? (this.dssrParser = J.api.Interface.getOption("dssx.DSSR1", this, "script")) : this.dssrParser);
}return (this.annotationParser == null ? (this.annotationParser = J.api.Interface.getOption("dssx.AnnotationParser", this, "script")) : this.annotationParser);
}, "~N");
Clazz_overrideMethod(c$, "getSelectedAtomIterator", 
function(bsSelected, isGreaterOnly, modelZeroBased, isMultiModel){
return this.ms.getSelectedAtomIterator(bsSelected, isGreaterOnly, modelZeroBased, false, isMultiModel);
}, "JU.BS,~B,~B,~B");
Clazz_overrideMethod(c$, "setIteratorForAtom", 
function(iterator, atomIndex, distance){
this.ms.setIteratorForAtom(iterator, -1, atomIndex, distance, null);
}, "J.api.AtomIndexIterator,~N,~N");
Clazz_overrideMethod(c$, "setIteratorForPoint", 
function(iterator, modelIndex, pt, distance){
this.ms.setIteratorForPoint(iterator, modelIndex, pt, distance);
}, "J.api.AtomIndexIterator,~N,JU.T3,~N");
Clazz_overrideMethod(c$, "fillAtomData", 
function(atomData, mode){
atomData.programInfo = "Jmol Version " + JV.Viewer.getJmolVersion();
atomData.fileName = this.fm.getFileName();
this.ms.fillAtomData(atomData, mode);
}, "J.atomdata.AtomData,~N");
Clazz_defineMethod(c$, "addStateScript", 
function(script, addFrameNumber, postDefinitions){
return this.ms.addStateScript(script, null, null, null, null, addFrameNumber, postDefinitions);
}, "~S,~B,~B");
Clazz_defineMethod(c$, "getMinimizer", 
function(createNew){
return (this.minimizer == null && createNew ? (this.minimizer = J.api.Interface.getInterface("JM.Minimizer", this, "script")).setProperty("vwr", this) : this.minimizer);
}, "~B");
Clazz_defineMethod(c$, "getSmilesMatcher", 
function(){
return (this.smilesMatcher == null ? (this.smilesMatcher = J.api.Interface.getInterface("JS.SmilesMatcher", this, "script")) : this.smilesMatcher);
});
Clazz_defineMethod(c$, "clearModelDependentObjects", 
function(){
this.setFrameOffsets(null, false);
this.stopMinimization();
this.minimizer = null;
this.smilesMatcher = null;
if (this.modelkit != null) this.modelkit.clearAtomConstraints();
});
Clazz_defineMethod(c$, "zap", 
function(notify, resetUndo, zapModelKit){
{
this.zap0(notify, resetUndo, zapModelKit);
}}, "~B,~B,~B");
Clazz_defineMethod(c$, "zap0", 
function(notify, resetUndo, zapModelKit){
this.clearThreads();
if (this.mm.modelSet == null) {
this.mm.zap();
} else {
this.ligandModelSet = null;
this.clearModelDependentObjects();
this.fm.clear();
this.clearRepaintManager(-1);
this.am.clear();
this.tm.clear();
this.slm.clear();
this.hasSelected = true;
this.clearAllMeasurements();
this.clearMinimization();
this.gdata.clear();
this.mm.zap();
if (this.scm != null) this.scm.clear(false);
if (this.nmrCalculation != null) this.getNMRCalculation().setChemicalShiftReference(null, 0);
if (this.haveDisplay) {
this.mouse.clear();
this.clearTimeouts();
this.acm.clear();
}this.stm.clear(this.g);
this.tempArray.clear();
this.chainMap.clear();
this.chainList.clear();
this.chainCaseSpecified = false;
this.definedAtomSets.clear();
this.lastData = null;
if (this.dm != null) this.dm.clear();
if (!this.g.doublePrecision && this.g.legacyJavaFloat) this.setBooleanPropertyTok("legacyjavafloat", 603979874, false);
if (resetUndo) {
if (zapModelKit) this.g.removeParam("_pngjFile");
if (zapModelKit && this.g.modelKitMode) {
this.loadDefaultModelKitModel(null);
} else {
this.setPickingMode(null, 1);
}this.undoMoveAction(4165, -2);
}System.gc();
}this.initializeModel(false);
if (notify) {
this.setFileLoadStatus(J.c.FIL.ZAPPED, null, (resetUndo ? "resetUndo" : this.getZapName()), null, null, null);
}if (JU.Logger.debugging) JU.Logger.checkMemory();
}, "~B,~B,~B");
Clazz_defineMethod(c$, "loadDefaultModelKitModel", 
function(htParams){
if (this.getModelkit(false).isHidden() || this.getOperativeSymmetry() != null) return;
this.openStringInlineParamsAppend(this.getModelkit(false).getDefaultModel(), htParams, true);
this.setRotationRadius(5.0, true);
this.setStringProperty("picking", "assignAtom_C");
this.setStringProperty("picking", "assignBond_p");
}, "java.util.Map");
Clazz_defineMethod(c$, "zapMsg", 
function(msg){
this.zap(true, true, false);
this.echoMessage(msg);
}, "~S");
Clazz_defineMethod(c$, "echoMessage", 
function(msg){
var iShape = 31;
this.shm.loadShape(iShape);
this.setShapeProperty(iShape, "font", this.getFont3D("SansSerif", "Plain", 20));
this.setShapeProperty(iShape, "target", "error");
this.setShapeProperty(iShape, "text", msg);
}, "~S");
Clazz_defineMethod(c$, "initializeModel", 
function(isAppend){
this.clearThreads();
if (isAppend) {
this.am.initializePointers(1);
return;
}this.reset(true);
this.selectAll();
this.setModelkitPropertySafely("initializemodel", null);
this.movingSelected = false;
this.slm.noneSelected = Boolean.FALSE;
this.setHoverEnabled(true);
this.setSelectionHalosEnabled(false);
this.tm.setCenter();
this.am.initializePointers(1);
this.setBooleanPropertyTok("multipleBondBananas", 603979886, false);
if (!this.ms.getMSInfoB("isPyMOL")) {
this.clearAtomSets();
this.setCurrentModelIndex(0);
}this.setBackgroundModelIndex(-1);
this.setFrankOn(this.getShowFrank());
this.shm.setScale();
this.startHoverWatcher(true);
this.setTainted(true);
this.finalizeTransformParameters();
}, "~B");
Clazz_defineMethod(c$, "startHoverWatcher", 
function(tf){
if (tf && this.inMotion || !this.haveDisplay || tf && (!this.hoverEnabled && !this.sm.haveHoverCallback() || this.am.animationOn)) return;
this.acm.startHoverWatcher(tf);
}, "~B");
Clazz_overrideMethod(c$, "getModelSetPathName", 
function(){
return this.mm.modelSetPathName;
});
Clazz_overrideMethod(c$, "getModelSetFileName", 
function(){
return (this.mm.fileName == null ? this.getZapName() : this.mm.fileName);
});
Clazz_defineMethod(c$, "getUnitCellInfoText", 
function(){
var c = this.getCurrentUnitCell();
return (c == null ? "not applicable" : c.getUnitCellInfo(true));
});
Clazz_defineMethod(c$, "getUnitCellInfo", 
function(infoType){
var symmetry = this.getCurrentUnitCell();
return (symmetry == null ? NaN : symmetry.getUnitCellInfoType(infoType));
}, "~N");
Clazz_defineMethod(c$, "getUnitCellInfoStr", 
function(type){
var symmetry = this.getCurrentUnitCell();
return (symmetry == null ? NaN : symmetry.getUnitCellInfoStr(type));
}, "~S");
Clazz_defineMethod(c$, "getV0abc", 
function(iModel, def){
var uc = (iModel < 0 ? this.getCurrentUnitCell() : this.getUnitCell(iModel));
if (uc == null) uc = this.getSymTemp();
return (uc == null ? null : uc.getV0abc(def, null));
}, "~N,~O");
Clazz_defineMethod(c$, "getCurrentUnitCell", 
function(){
var sym = this.getUnitCell(this.am.cmi);
if (sym == null) return null;
var offset = sym.getCartesianOffset();
var iAtom = this.am.getUnitCellAtomIndex();
return (iAtom >= 0 && (offset == null || offset.length() == 0) ? this.ms.getUnitCellForAtom(iAtom) : sym);
});
Clazz_defineMethod(c$, "getUnitCell", 
function(modelIndex){
if (modelIndex >= 0) return this.ms.getUnitCell(modelIndex);
var models = this.getVisibleFramesBitSet();
var ucLast = null;
for (var i = models.nextSetBit(0); i >= 0; i = models.nextSetBit(i + 1)) {
var uc = this.ms.getUnitCell(i);
if (uc == null) continue;
if (ucLast == null) {
ucLast = uc;
continue;
}if (!ucLast.unitCellEquals(uc)) return null;
}
return ucLast;
}, "~N");
Clazz_defineMethod(c$, "getPolymerPointsAndVectors", 
function(bs, vList){
this.ms.getPolymerPointsAndVectors(bs, vList, this.g.traceAlpha, this.g.sheetSmoothing);
}, "JU.BS,JU.Lst");
Clazz_defineMethod(c$, "getHybridizationAndAxes", 
function(atomIndex, z, x, lcaoType){
return this.ms.getHybridizationAndAxes(atomIndex, 0, z, x, lcaoType, true, true, false, null);
}, "~N,JU.V3,JU.V3,~S");
Clazz_defineMethod(c$, "getAllAtoms", 
function(){
return this.getModelUndeletedAtomsBitSet(-1);
});
Clazz_defineMethod(c$, "getFrameAtoms", 
function(){
return this.getModelUndeletedAtomsBitSetBs(this.getVisibleFramesBitSet());
});
Clazz_defineMethod(c$, "getVisibleFrameAtomsNoSplitData", 
function(){
return this.getModelUndeletedAtomsBitSetBs(this.getVisibleFramesBitSetNoJmolData());
});
Clazz_overrideMethod(c$, "getVisibleFramesBitSet", 
function(){
var bs = JU.BSUtil.copy(this.am.bsVisibleModels);
if (this.ms.trajectory != null) this.ms.trajectory.selectDisplayed(bs);
return bs;
});
Clazz_defineMethod(c$, "getVisibleFramesBitSetNoJmolData", 
function(){
var bs = this.getVisibleFramesBitSet();
if (this.am.splitFrame) {
for (var i = 0; i < 2; i++) {
var mi = this.am.getSplitFrameModelIndex(i);
if (this.ms.isJmolDataFrame(mi)) bs.clear(mi);
}
}return bs;
});
Clazz_defineMethod(c$, "getModelUndeletedAtomsBitSet", 
function(modelIndex){
return this.slm.excludeAtoms(this.ms.getModelAtomBitSetIncludingDeleted(modelIndex, true), false);
}, "~N");
Clazz_defineMethod(c$, "getModelUndeletedAtomsBitSetBs", 
function(bsModels){
return this.slm.excludeAtoms(this.ms.getModelAtomBitSetIncludingDeletedBs(bsModels), false);
}, "JU.BS");
Clazz_overrideMethod(c$, "getBoundBoxCenter", 
function(){
return this.ms.getBoundBoxCenter(this.am.cmi);
});
Clazz_defineMethod(c$, "calcBoundBoxDimensions", 
function(bs, scale){
this.ms.calcBoundBoxDimensions(bs, scale);
this.axesAreTainted = true;
}, "JU.BS,~N");
Clazz_overrideMethod(c$, "getBoundBoxCornerVector", 
function(){
return this.ms.getBoundBoxCornerVector();
});
Clazz_overrideMethod(c$, "getModelSetProperties", 
function(){
return this.ms.modelSetProperties;
});
Clazz_overrideMethod(c$, "getModelProperties", 
function(modelIndex){
return this.ms.am[modelIndex].properties;
}, "~N");
Clazz_defineMethod(c$, "getModelForAtomIndex", 
function(iatom){
return this.ms.am[this.ms.at[iatom].mi];
}, "~N");
Clazz_defineMethod(c$, "getModelIndexForAtom", 
function(iatom){
return this.ms.at[iatom].mi;
}, "~N");
Clazz_overrideMethod(c$, "getModelSetAuxiliaryInfo", 
function(){
return this.ms.getModelSetAuxiliaryInfo(null);
});
Clazz_overrideMethod(c$, "getModelNumber", 
function(modelIndex){
return (modelIndex < 0 ? modelIndex : this.ms.getModelNumber(modelIndex));
}, "~N");
Clazz_defineMethod(c$, "getModelFileNumber", 
function(modelIndex){
return (modelIndex < 0 ? 0 : this.ms.modelFileNumbers[modelIndex]);
}, "~N");
Clazz_overrideMethod(c$, "getModelNumberDotted", 
function(modelIndex){
return modelIndex < 0 ? "0" : this.ms.getModelNumberDotted(modelIndex);
}, "~N");
Clazz_overrideMethod(c$, "getModelName", 
function(modelIndex){
return this.ms.getModelName(modelIndex);
}, "~N");
Clazz_defineMethod(c$, "modelHasVibrationVectors", 
function(modelIndex){
return (this.ms.getLastVibrationVector(modelIndex, 4166) >= 0);
}, "~N");
Clazz_defineMethod(c$, "getBondsForSelectedAtoms", 
function(bsAtoms){
return this.ms.getBondsForSelectedAtoms(bsAtoms, this.g.bondModeOr || JU.BSUtil.cardinalityOf(bsAtoms) == 1);
}, "JU.BS");
Clazz_defineMethod(c$, "frankClicked", 
function(x, y){
return !this.g.disablePopupMenu && this.getShowFrank() && this.shm.checkFrankclicked(x, y);
}, "~N,~N");
Clazz_defineMethod(c$, "frankClickedModelKit", 
function(x, y){
return !this.g.disablePopupMenu && this.isModelKitOpen() && x >= 0 && y >= 0 && x < 40 && y < 104;
}, "~N,~N");
Clazz_overrideMethod(c$, "findNearestAtomIndex", 
function(x, y){
return this.findNearestAtomIndexMovable(x, y, false);
}, "~N,~N");
Clazz_defineMethod(c$, "findNearestAtomIndexMovable", 
function(x, y, mustBeMovable){
return (!this.g.atomPicking ? -1 : this.ms.findNearestAtomIndex(x, y, mustBeMovable ? this.slm.getMotionFixedAtoms() : null, (this.antialiased ? this.g.minPixelSelRadius << 1 : this.g.minPixelSelRadius)));
}, "~N,~N,~B");
Clazz_defineMethod(c$, "toCartesian", 
function(pt, ignoreOffset){
this.toCartesianUC(null, pt, ignoreOffset);
}, "JU.T3,~B");
Clazz_defineMethod(c$, "toCartesianUC", 
function(unitCell, pt, ignoreOffset){
if (unitCell == null) unitCell = this.getCurrentUnitCell();
if (unitCell != null) {
unitCell.toCartesian(pt, ignoreOffset);
if (!this.g.legacyJavaFloat) JU.PT.fixPtFloats(pt, 10000.0);
}}, "J.api.SymmetryInterface,JU.T3,~B");
Clazz_defineMethod(c$, "toFractional", 
function(pt, ignoreOffset){
this.toFractionalUC(null, pt, ignoreOffset);
}, "JU.T3,~B");
Clazz_defineMethod(c$, "toFractionalUC", 
function(unitCell, pt, ignoreOffset){
if (unitCell == null) unitCell = this.getCurrentUnitCell();
if (unitCell != null) {
unitCell.toFractional(pt, ignoreOffset);
if (!this.g.legacyJavaFloat) JU.PT.fixPtFloats(pt, 100000.0);
}}, "J.api.SymmetryInterface,JU.T3,~B");
Clazz_defineMethod(c$, "toUnitCell", 
function(pt, offset){
var unitCell = this.getCurrentUnitCell();
if (unitCell != null) unitCell.toUnitCell(pt, offset);
}, "JU.P3,JU.P3");
Clazz_defineMethod(c$, "setCurrentCage", 
function(isosurfaceId){
var data =  Clazz_newArray(-1, [isosurfaceId, null]);
this.shm.getShapePropertyData(24, "unitCell", data);
this.ms.setModelCage(this.am.cmi, data[1], true);
}, "~S");
Clazz_defineMethod(c$, "addUnitCellOffset", 
function(pt){
var unitCell = this.getCurrentUnitCell();
if (unitCell == null) return;
pt.add(unitCell.getCartesianOffset());
}, "JU.P3");
Clazz_defineMethod(c$, "setAtomData", 
function(type, name, coordinateData, isDefault){
this.ms.setAtomData(type, name, coordinateData, isDefault);
if (type == 2) this.checkCoordinatesChanged(null);
this.refreshMeasures(true);
}, "~N,~S,~S,~B");
Clazz_overrideMethod(c$, "setCenterSelected", 
function(){
this.setCenterBitSet(this.bsA(), true);
});
Clazz_defineMethod(c$, "setApplySymmetryToBonds", 
function(TF){
this.g.applySymmetryToBonds = TF;
}, "~B");
Clazz_overrideMethod(c$, "setBondTolerance", 
function(bondTolerance){
this.g.setF("bondTolerance", bondTolerance);
this.g.bondTolerance = bondTolerance;
}, "~N");
Clazz_overrideMethod(c$, "setMinBondDistance", 
function(minBondDistance){
this.g.setF("minBondDistance", minBondDistance);
this.g.minBondDistance = minBondDistance;
}, "~N");
Clazz_defineMethod(c$, "getAtomsNearPt", 
function(distance, coord, bs){
if (bs == null) bs =  new JU.BS();
this.ms.getAtomsWithin(distance, coord, bs, -1);
return bs;
}, "~N,JU.P3,JU.BS");
Clazz_defineMethod(c$, "getBranchBitSet", 
function(atomIndex, atomIndexNot, allowCyclic){
if (atomIndex < 0 || atomIndex >= this.ms.ac) return  new JU.BS();
return JU.JmolMolecule.getBranchBitSet(this.ms.at, atomIndex, this.getModelUndeletedAtomsBitSet(this.ms.at[atomIndex].mi), null, atomIndexNot, allowCyclic, true);
}, "~N,~N,~B");
Clazz_overrideMethod(c$, "getElementsPresentBitSet", 
function(modelIndex){
return this.ms.getElementsPresentBitSet(modelIndex);
}, "~N");
Clazz_defineMethod(c$, "getFileHeader", 
function(){
return this.ms.getFileHeader(this.am.cmi);
});
Clazz_defineMethod(c$, "getFileData", 
function(){
return this.ms.getFileData(this.am.cmi);
});
Clazz_defineMethod(c$, "getCifData", 
function(modelIndex){
return this.fm.readCifData(this.ms.getModelFileName(modelIndex), this.ms.getModelFileType(modelIndex).toUpperCase());
}, "~N");
Clazz_overrideMethod(c$, "readCifData", 
function(fileName, rdrOrStringData, type){
if (rdrOrStringData == null) rdrOrStringData = this.getAsciiFileOrNull(fileName);
return this.fm.readCifDataKey(rdrOrStringData, type, null);
}, "~S,~O,~S");
Clazz_defineMethod(c$, "getStateCreator", 
function(){
if (this.jsc == null) (this.jsc = J.api.Interface.getInterface("JV.StateCreator", this, "script")).setViewer(this);
return this.jsc;
});
Clazz_defineMethod(c$, "getWrappedStateScript", 
function(){
return this.getOutputManager().getWrappedState(null, null, null, null);
});
Clazz_overrideMethod(c$, "getStateInfo", 
function(){
return this.getStateInfo3(null, 0, 0);
});
Clazz_defineMethod(c$, "getStateInfo3", 
function(type, width, height){
return (this.g.preserveState ? this.getStateCreator().getStateScript(type, width, height) : "");
}, "~S,~N,~N");
Clazz_defineMethod(c$, "getStructureState", 
function(){
return this.getStateCreator().getModelState(null, false, true);
});
Clazz_defineMethod(c$, "getCoordinateState", 
function(bsSelected){
return this.getStateCreator().getAtomicPropertyState(2, bsSelected);
}, "JU.BS");
Clazz_defineMethod(c$, "setCurrentColorRange", 
function(label){
var data = this.getDataObj(label, null, 1);
var bs = (data == null ? null : (this.getDataObj(label, null, -1))[2]);
if (bs != null && this.g.rangeSelected) bs.and(this.bsA());
this.cm.setPropertyColorRangeData(data, bs);
}, "~S");
Clazz_defineMethod(c$, "setData", 
function(key, data, dataType, matchField, matchFieldColumnCount, dataField, dataFieldColumnCount){
this.getDataManager().setData(key, this.lastData = data, dataType, this.ms.ac, matchField, matchFieldColumnCount, dataField, dataFieldColumnCount);
}, "~S,~A,~N,~N,~N,~N,~N");
Clazz_defineMethod(c$, "getDataObj", 
function(key, bsSelected, dataType){
if (dataType == 4) return this.ms.getDSSRProperties(key);
return (key == null && dataType == -2 ? this.lastData : this.getDataManager().getData(key, bsSelected, dataType));
}, "~S,JU.BS,~N");
Clazz_defineMethod(c$, "autoHbond", 
function(bsFrom, bsTo, onlyIfHaveCalculated){
if (bsFrom == null) bsFrom = bsTo = this.bsA();
return this.ms.autoHbond(bsFrom, bsTo, onlyIfHaveCalculated);
}, "JU.BS,JU.BS,~B");
Clazz_defineMethod(c$, "getDefaultMeasurementLabel", 
function(nPoints){
switch (nPoints) {
case 2:
return this.g.defaultDistanceLabel;
case 3:
return this.g.defaultAngleLabel;
default:
return this.g.defaultTorsionLabel;
}
}, "~N");
Clazz_overrideMethod(c$, "getMeasurementCount", 
function(){
var count = this.getShapePropertyAsInt(6, "count");
return count <= 0 ? 0 : count;
});
Clazz_overrideMethod(c$, "getMeasurementStringValue", 
function(i){
return "" + this.shm.getShapePropertyIndex(6, "stringValue", i);
}, "~N");
Clazz_defineMethod(c$, "getMeasurementInfoAsString", 
function(){
return this.getShapeProperty(6, "infostring");
});
Clazz_overrideMethod(c$, "getMeasurementCountPlusIndices", 
function(i){
return this.shm.getShapePropertyIndex(6, "countPlusIndices", i);
}, "~N");
Clazz_defineMethod(c$, "setPendingMeasurement", 
function(mp){
this.shm.loadShape(6);
this.setShapeProperty(6, "pending", mp);
}, "JM.MeasurementPending");
Clazz_defineMethod(c$, "getPendingMeasurement", 
function(){
return this.getShapeProperty(6, "pending");
});
Clazz_defineMethod(c$, "clearAllMeasurements", 
function(){
this.setShapeProperty(6, "clear", null);
});
Clazz_overrideMethod(c$, "clearMeasurements", 
function(){
this.evalString("measures delete");
});
Clazz_defineMethod(c$, "setAnimation", 
function(tok){
switch (tok) {
case 1073742098:
this.am.reverseAnimation();
case 1073742096:
case 4143:
if (!this.am.animationOn) this.am.resumeAnimation();
return;
case 20487:
if (this.am.animationOn && !this.am.animationPaused) this.am.pauseAnimation();
return;
case 1073742037:
this.am.setAnimationNext();
return;
case 1073742108:
this.am.setAnimationPrevious();
return;
case 1073741942:
case 1073742125:
this.am.rewindAnimation();
return;
case 1073741993:
this.am.setAnimationLast();
return;
}
}, "~N");
Clazz_overrideMethod(c$, "setAnimationFps", 
function(fps){
this.am.setAnimationFps(fps);
}, "~N");
Clazz_defineMethod(c$, "setAnimationMode", 
function(mode){
if (mode.equalsIgnoreCase("once")) {
this.am.setAnimationReplayMode(1073742070, 0, 0);
} else if (mode.equalsIgnoreCase("loop")) {
this.am.setAnimationReplayMode(528411, 1, 1);
} else if (mode.startsWith("pal")) {
this.am.setAnimationReplayMode(1073742082, 1, 1);
}}, "~S");
Clazz_defineMethod(c$, "setAnimationOn", 
function(animationOn){
var wasAnimating = this.am.animationOn;
if (animationOn == wasAnimating) return;
this.am.setAnimationOn(animationOn);
}, "~B");
Clazz_defineMethod(c$, "setAnimationRange", 
function(modelIndex1, modelIndex2){
this.am.setAnimationRange(modelIndex1, modelIndex2);
}, "~N,~N");
Clazz_defineMethod(c$, "defineAtomSets", 
function(info){
this.definedAtomSets.putAll(info);
}, "java.util.Map");
Clazz_defineMethod(c$, "setAnimDisplay", 
function(bs){
this.am.setDisplay(bs);
if (!this.am.animationOn) this.am.morph(this.am.currentMorphModel + 1);
}, "JU.BS");
Clazz_defineMethod(c$, "setCurrentModelIndex", 
function(modelIndex){
if (modelIndex == -2147483648) {
this.prevFrame = -2147483648;
this.setCurrentModelIndexClear(this.am.cmi, true);
return;
}this.am.setModel(modelIndex, true);
}, "~N");
Clazz_defineMethod(c$, "getTrajectoryState", 
function(){
return (this.ms.trajectory == null ? "" : this.ms.trajectory.getState());
});
Clazz_defineMethod(c$, "setFrameOffsets", 
function(bsAtoms, isFull){
this.tm.bsFrameOffsets = null;
if (isFull) this.clearModelDependentObjects();
 else this.tm.bsFrameOffsets = bsAtoms;
this.tm.frameOffsets = this.ms.getFrameOffsets(bsAtoms, isFull);
}, "JU.BS,~B");
Clazz_defineMethod(c$, "setCurrentModelIndexClear", 
function(modelIndex, clearBackground){
this.am.setModel(modelIndex, clearBackground);
}, "~N,~B");
Clazz_defineMethod(c$, "haveFileSet", 
function(){
return (this.ms.mc > 1 && this.getModelNumber(2147483647) > 2000000);
});
Clazz_defineMethod(c$, "setBackgroundModelIndex", 
function(modelIndex){
this.am.setBackgroundModelIndex(modelIndex);
this.g.setO("backgroundModel", this.ms.getModelNumberDotted(modelIndex));
}, "~N");
Clazz_defineMethod(c$, "setFrameVariables", 
function(){
this.g.setO("animationMode", JS.T.nameOf(this.am.animationReplayMode));
this.g.setI("animationFps", this.am.animationFps);
this.g.setO("_firstFrame", this.am.getModelSpecial(-1));
this.g.setO("_lastFrame", this.am.getModelSpecial(1));
this.g.setF("_animTimeSec", this.am.getAnimRunTimeSeconds());
this.g.setB("_animMovie", this.am.isMovie);
});
Clazz_defineMethod(c$, "getInMotion", 
function(includeAnim){
return (this.inMotion || includeAnim && this.am.animationOn);
}, "~B");
Clazz_overrideMethod(c$, "getMotionEventNumber", 
function(){
return this.motionEventNumber;
});
Clazz_overrideMethod(c$, "setInMotion", 
function(inMotion){
if ( new Boolean (this.inMotion ^ inMotion).valueOf()) {
this.inMotion = inMotion;
this.resizeImage(0, 0, false, false, true);
if (inMotion) {
this.startHoverWatcher(false);
++this.motionEventNumber;
} else {
this.startHoverWatcher(true);
this.refresh(3, "vwr setInMotion " + inMotion);
}}}, "~B");
Clazz_defineMethod(c$, "setRefreshing", 
function(TF){
this.refreshing = TF;
}, "~B");
Clazz_defineMethod(c$, "getRefreshing", 
function(){
return this.refreshing;
});
Clazz_overrideMethod(c$, "pushHoldRepaint", 
function(){
this.pushHoldRepaintWhy(null);
});
Clazz_defineMethod(c$, "pushHoldRepaintWhy", 
function(why){
if (this.rm != null) this.rm.pushHoldRepaint(why);
}, "~S");
Clazz_overrideMethod(c$, "popHoldRepaint", 
function(why){
if (this.rm != null) {
this.rm.popHoldRepaint(why.indexOf("\u0001## REPAINT_IGNORE ##") < 0, why);
}}, "~S");
Clazz_overrideMethod(c$, "refresh", 
function(mode, strWhy){
if (this.rm == null || !this.refreshing || mode == 6 && this.getInMotion(true) || !this.isWebGL && mode == 7) return;
if (this.isWebGL) {
switch (mode) {
case 1:
case 2:
case 7:
this.tm.finalizeTransformParameters();
if (this.html5Applet == null) return;
this.html5Applet._refresh();
if (mode == 7) return;
break;
}
} else {
this.rm.repaintIfReady("refresh " + mode + " " + strWhy);
}if (this.sm.doSync()) this.sm.setSync(mode == 2 ? strWhy : null);
}, "~N,~S");
Clazz_defineMethod(c$, "requestRepaintAndWait", 
function(why){
if (this.rm == null) return;
if (!this.haveDisplay) {
this.setModelVisibility();
this.shm.finalizeAtoms(null, true);
return;
}this.rm.requestRepaintAndWait(why);
this.setSync();
}, "~S");
Clazz_defineMethod(c$, "clearShapeRenderers", 
function(){
this.clearRepaintManager(-1);
});
Clazz_defineMethod(c$, "isRepaintPending", 
function(){
return (this.rm == null ? false : this.rm.isRepaintPending());
});
Clazz_overrideMethod(c$, "notifyViewerRepaintDone", 
function(){
if (this.rm != null) this.rm.repaintDone();
this.am.repaintDone();
});
Clazz_defineMethod(c$, "areAxesTainted", 
function(){
var TF = this.axesAreTainted;
this.axesAreTainted = false;
return TF;
});
Clazz_overrideMethod(c$, "generateOutputForExport", 
function(params){
return (this.noGraphicsAllowed || this.rm == null ? null : this.getOutputManager().getOutputFromExport(params));
}, "java.util.Map");
Clazz_defineMethod(c$, "clearRepaintManager", 
function(iShape){
if (this.rm != null) this.rm.clear(iShape);
}, "~N");
Clazz_defineMethod(c$, "renderScreenImage", 
function(g, width, height){
this.renderScreenImageStereo(g, false, width, height);
}, "~O,~N,~N");
Clazz_defineMethod(c$, "renderScreenImageStereo", 
function(gLeft, checkStereoSlave, width, height){
if (this.updateWindow(width, height)) {
if (!checkStereoSlave || this.gRight == null) {
this.getScreenImageBuffer(gLeft, false);
} else {
this.drawImage(this.gRight, this.getRenderedImage(true, false), 0, 0, this.tm.stereoDoubleDTI);
this.drawImage(gLeft, this.getRenderedImage(false, false), 0, 0, this.tm.stereoDoubleDTI);
}}if (this.isCapturing()) this.doCapture();
this.notifyViewerRepaintDone();
}, "~O,~B,~N,~N");
Clazz_defineMethod(c$, "isCapturing", 
function(){
return (this.captureParams != null && Boolean.FALSE !== this.captureParams.get("captureEnabled"));
});
Clazz_defineMethod(c$, "doCapture", 
function(){
this.captureParams.remove("imagePixels");
var t = (this.captureParams.get("endTime")).longValue();
if (t > 0 && System.currentTimeMillis() + 50 > t) this.captureParams.put("captureMode", "end");
this.processWriteOrCapture(this.captureParams);
});
Clazz_defineMethod(c$, "updateJS", 
function(){
if (this.isWebGL) {
if (this.jsParams == null) {
this.jsParams =  new java.util.Hashtable();
this.jsParams.put("type", "JS");
}if (this.updateWindow(0, 0)) this.render();
this.notifyViewerRepaintDone();
} else {
if (this.isStereoSlave) return;
this.renderScreenImageStereo(this.apiPlatform.getGraphics(null), true, 0, 0);
}});
Clazz_defineMethod(c$, "updateJSView", 
function(imodel, iatom){
if (this.html5Applet == null) return;
var applet = this.html5Applet;
var doViewPick = true;
{
doViewPick = (applet != null && applet._viewSet != null);
}if (doViewPick) this.html5Applet._atomPickedCallback(imodel, iatom);
}, "~N,~N");
Clazz_overrideMethod(c$, "evalFile", 
function(strFilename){
return this.evalFileArgs(strFilename, null);
}, "~S");
Clazz_overrideMethod(c$, "evalFileArgs", 
function(strFilename, args){
return (this.allowScripting && this.getScriptManager() != null ? this.scm.evalFileArgs(strFilename, args) : null);
}, "~S,~S");
Clazz_defineMethod(c$, "getInsertedCommand", 
function(){
var s = this.insertedCommand;
this.insertedCommand = "";
if (JU.Logger.debugging && s !== "") JU.Logger.debug("inserting: " + s);
return s;
});
Clazz_overrideMethod(c$, "script", 
function(strScript){
return this.evalStringQuietSync(strScript, false, true);
}, "~S");
Clazz_overrideMethod(c$, "evalString", 
function(strScript){
return this.evalStringQuietSync(strScript, false, true);
}, "~S");
Clazz_overrideMethod(c$, "evalStringQuiet", 
function(strScript){
return this.evalStringQuietSync(strScript, true, true);
}, "~S");
Clazz_defineMethod(c$, "evalStringQuietSync", 
function(strScript, isQuiet, allowSyncScript){
return (this.getScriptManager() == null ? null : this.scm.evalStringQuietSync(strScript, isQuiet, allowSyncScript));
}, "~S,~B,~B");
Clazz_defineMethod(c$, "clearScriptQueue", 
function(){
if (this.scm != null) this.scm.clearQueue();
});
Clazz_defineMethod(c$, "setScriptQueue", 
function(TF){
this.g.useScriptQueue = TF;
if (!TF) this.clearScriptQueue();
}, "~B");
Clazz_overrideMethod(c$, "checkHalt", 
function(str, isInsert){
return (this.scm != null && this.scm.checkHalt(str, isInsert));
}, "~S,~B");
Clazz_overrideMethod(c$, "scriptWait", 
function(strScript){
return this.evalWait("JSON", strScript, "+scriptStarted,+scriptStatus,+scriptEcho,+scriptTerminated");
}, "~S");
Clazz_overrideMethod(c$, "scriptWaitStatus", 
function(strScript, statusList){
return this.evalWait("object", strScript, statusList);
}, "~S,~S");
Clazz_defineMethod(c$, "evalWait", 
function(returnType, strScript, statusList){
if (this.getScriptManager() == null) return null;
this.scm.waitForQueue();
var doTranslateTemp = J.i18n.GT.setDoTranslate(false);
var ret = this.evalStringWaitStatusQueued(returnType, strScript, statusList, false, false);
J.i18n.GT.setDoTranslate(doTranslateTemp);
return ret;
}, "~S,~S,~S");
Clazz_defineMethod(c$, "exitJmol", 
function(){
if (this.isApplet && !this.isJNLP) return;
if (this.headlessImageParams != null) {
try {
if (this.headless) this.outputToFile(this.headlessImageParams);
} catch (e) {
if (Clazz_exceptionOf(e, Exception)){
} else {
throw e;
}
}
}if (JU.Logger.debugging) JU.Logger.debug("exitJmol -- exiting");
System.out.flush();
System.exit(0);
});
Clazz_defineMethod(c$, "scriptCheckRet", 
function(strScript, returnContext){
return (this.getScriptManager() == null ? null : this.scm.scriptCheckRet(strScript, returnContext));
}, "~S,~B");
Clazz_overrideMethod(c$, "scriptCheck", 
function(strScript){
return this.scriptCheckRet(strScript, false);
}, "~S");
Clazz_overrideMethod(c$, "isScriptExecuting", 
function(){
return (this.eval != null && this.eval.isExecuting());
});
Clazz_overrideMethod(c$, "haltScriptExecution", 
function(){
if (this.eval != null) {
this.eval.haltExecution();
this.eval.stopScriptThreads();
}this.setStringPropertyTok("pathForAllFiles", 545259572, "");
this.clearTimeouts();
});
Clazz_defineMethod(c$, "pauseScriptExecution", 
function(){
if (this.eval != null) this.eval.pauseExecution(true);
});
Clazz_defineMethod(c$, "resolveDatabaseFormat", 
function(fileName){
return (JV.Viewer.hasDatabasePrefix(fileName) || fileName.indexOf("cactus.nci.nih.gov/chemical/structure") >= 0 ? this.setLoadFormat(false, fileName, fileName.charAt(0), false) : fileName);
}, "~S");
c$.hasDatabasePrefix = Clazz_defineMethod(c$, "hasDatabasePrefix", 
function(fileName){
return (fileName.length != 0 && JV.Viewer.isDatabaseCode(fileName.charAt(0)));
}, "~S");
c$.isDatabaseCode = Clazz_defineMethod(c$, "isDatabaseCode", 
function(ch){
return (ch == '*' || ch == '$' || ch == '=' || ch == ':');
}, "~S");
Clazz_defineMethod(c$, "setLoadFormat", 
function(isSurface, name, type, withPrefix){
var format = null;
var id = name.substring(1);
var suffix = "";
if (name.endsWith("#_DOCACHE_")) {
suffix = "#_DOCACHE_";
name = name.substring(0, name.length - suffix.length);
id = id.substring(0, id.length - suffix.length);
}switch ((type).charCodeAt(0)) {
case 99:
return name + suffix;
case 104:
if (this.g.checkCIR) this.checkCIR(false);
return this.g.nihResolverFormat + name.substring(name.indexOf("/structure") + 10) + suffix;
case 61:
if (name.startsWith("==")) {
id = id.substring(1);
if (id.equals("?") && (id = this.getDBID("chemical component from RCSB")) == null) return null;
type = '#';
} else {
if (id.equals("?") && (id = this.getDBID("PDB ID from RCSB")) == null) return null;
if (id.indexOf("/") > 0) {
try {
var pt = id.indexOf("/");
var database = id.substring(0, pt);
id = id.substring(pt + 1);
if (database.equalsIgnoreCase("aflowlib")) {
var index = 1;
pt = id.indexOf('.');
if (pt >= 0) {
index = JU.PT.parseInt(id.substring(pt + 1));
id = id.substring(0, pt);
}if (id.indexOf("_") < 0) id = this.getSymTemp().getSpaceGroupJSON("AFLOWLIB", id, index);
}id = JV.JC.resolveDataBase(database, id, null);
if (id != null && id.startsWith("'")) id = this.evaluateExpression(id).toString();
name = (id == null || id.length == 0 ? name : id);
} catch (e) {
if (Clazz_exceptionOf(e, Exception)){
} else {
throw e;
}
}
return name + suffix;
}name = null;
if (!isSurface && id.endsWith(".bcif")) {
id = id.substring(0, id.indexOf(".bcif"));
name = JV.JC.resolveDataBase("bcif", id.toLowerCase(), null);
}if (id.endsWith(".mmtf")) {
id = id.substring(0, id.indexOf(".mmtf"));
name = JV.JC.resolveDataBase("mmtf", id.toUpperCase(), null);
}if (name != null) return name + suffix;
format = this.g.loadFormat;
}case 35:
if (format == null) format = this.g.pdbLoadLigandFormat;
return JV.JC.resolveDataBase(null, id, format) + suffix;
case 42:
if (id.equals("?") && (id = this.getDBID("PDB ID from EBI")) == null) return null;
var ret = null;
var pt = name.lastIndexOf("/");
if (name.startsWith("*dom/")) {
id = name.substring(pt + 1);
format = (pt > 4 ? name.substring(5) : "mappings");
ret = JU.PT.rep(JV.JC.resolveDataBase("map", id, null), "%TYPE", format);
} else if (name.startsWith("*val/")) {
id = name.substring(pt + 1);
format = (pt > 4 ? name.substring(5) : "validation/outliers/all");
ret = JU.PT.rep(JV.JC.resolveDataBase("map", id, null), "%TYPE", format);
} else if (name.startsWith("*rna3d/")) {
id = name.substring(pt + 1);
format = (pt > 6 ? name.substring(6) : "loops");
ret = JU.PT.rep(JV.JC.resolveDataBase("rna3d", id, null), "%TYPE", format);
} else if (name.startsWith("*dssr--")) {
id = name.substring(pt + 1);
id = JV.JC.resolveDataBase("dssr", id, null);
ret = id + "%20" + JU.PT.rep(name.substring(5, pt), " ", "%20");
} else if (name.startsWith("*dssr/")) {
id = name.substring(pt + 1);
ret = JV.JC.resolveDataBase("dssr", id, null);
} else if (name.startsWith("*dssr1/")) {
id = name.substring(pt + 1);
ret = JV.JC.resolveDataBase("dssr1", id, null);
}if (ret != null) return ret + suffix;
var pdbe = "pdbe";
if (id.length == 5 && id.charAt(4) == '*') {
pdbe = "pdbe2";
id = id.substring(0, 4);
}return JV.JC.resolveDataBase(pdbe, id, null) + suffix;
case 58:
format = this.g.pubChemFormat;
if (id.equals("?") && (id = this.getDBID("structure from PubChem")) == null) return null;
if (id === "") {
try {
id = "smiles:" + this.getOpenSmiles(this.bsA());
} catch (e) {
if (Clazz_exceptionOf(e, Exception)){
} else {
throw e;
}
}
}var fl = id.toLowerCase();
var fi = -2147483648;
try {
fi = Integer.parseInt(id);
} catch (e) {
if (Clazz_exceptionOf(e, Exception)){
} else {
throw e;
}
}
if (fi != -2147483648) {
id = "cid/" + fi;
} else {
if (fl.startsWith("smiles:")) {
format += "?POST?smiles=" + id.substring(7);
id = "smiles";
} else if (id.startsWith("inchi:")) {
format += "?POST?inchi=" + id.substring(6);
id = "inchi";
} else if (id.startsWith("cid:") || id.startsWith("inchikey:") || id.startsWith("cas:")) {
id = id.$replace(':', '/');
} else {
if (fl.startsWith("name:")) id = id.substring(5);
id = "name/" + JU.PT.escapeUrl(id);
}}return JU.PT.formatStringS(format, "FILE", id) + suffix;
case 36:
this.checkCIR(false);
if (id.equals("?") && (id = this.getDBID("structure from NCI/CADD")) == null) return null;
if (name.equals("$")) {
try {
id = this.getOpenSmiles(this.bsA());
} catch (e) {
if (Clazz_exceptionOf(e, Exception)){
} else {
throw e;
}
}
} else if (name.startsWith("$$")) {
id = id.substring(1);
if (id.length == 0) {
try {
id = this.getOpenSmiles(this.bsA());
} catch (e) {
if (Clazz_exceptionOf(e, Exception)){
} else {
throw e;
}
}
}id = JU.PT.escapeUrl(id);
return JV.JC.resolveDataBase("smiles2d", id, null) + suffix;
}case 77:
case 78:
case 50:
case 73:
case 75:
case 83:
case 84:
case 47:
id = JU.PT.escapeUrl(id);
switch ((type).charCodeAt(0)) {
case 77:
case 78:
format = this.g.nihResolverFormat + "/%FILE/names";
break;
case 50:
format = this.g.nihResolverFormat + "/%FILE/image";
break;
case 73:
case 84:
format = this.g.nihResolverFormat + "/%FILE/file?format=stdinchi";
break;
case 75:
case 83:
format = this.g.nihResolverFormat + "/%FILE/stdinchikey";
break;
case 47:
format = this.g.nihResolverFormat + "/%FILE/";
break;
default:
format = this.g.smilesUrlFormat;
break;
}
return (withPrefix ? "MOL3D::" : "") + JU.PT.formatStringS(format, "FILE", id) + suffix;
case 63:
case 45:
case 95:
var isDiff = id.startsWith("*") || id.startsWith("=");
if (isDiff) id = id.substring(1);
var ciftype = null;
pt = id.indexOf(".");
if (pt >= 0) {
ciftype = id.substring(pt + 1);
id = id.substring(0, pt);
}var checkXray = id.startsWith("density");
if (checkXray) id = "em" + id.substring(7);
if (id.equals("emdb") || id.equals("em")) id += "/";
if (id.startsWith("em/")) id = "emdb" + id.substring(2);
if (id.startsWith("emdb/")) {
id = id.substring(5);
if (id.length == 0) id = "=";
 else if (id.startsWith("*")) id = "=" + id.substring(1);
var emdext = "#-sigma=10";
if (id.startsWith("=")) {
id = (id.equals("=") ? this.getPdbID() : id.substring(1));
if (id == null || type == '?') return id;
var q = JV.JC.resolveDataBase("emdbquery", id, null);
var data = this.fm.cacheGet(q, false);
if (data == null) {
this.showString("retrieving " + q, false);
data = this.getFileAsString(q);
if (data == null) {
this.showString("EM retrieve failed for " + id, false);
if (!checkXray) return null;
data = "FAILED";
} else {
this.showString(data, false);
}this.fm.cachePut(q, data);
}pt = data.indexOf("EMD-");
if (pt >= 0) {
id = data.substring(pt + 4);
pt = id.indexOf('\n');
if (pt > 0) id = id.substring(0, pt);
pt = id.indexOf(",");
if (pt > 0) {
emdext = "#-cutoff=" + id.substring(pt + 1);
id = id.substring(0, pt);
}} else {
if (!checkXray) return null;
emdext = null;
}}if (emdext != null) return JV.JC.resolveDataBase("emdbmap" + (type == '-' ? "server" : ""), id, null) + emdext + suffix;
}id = JV.JC.resolveDataBase((isDiff ? "pdbemapdiff" : "pdbemap") + (type == '-' ? "server" : ""), id, null);
if ("cif".equals(ciftype)) {
id = id.$replace("bcif", "cif");
}break;
}
return id + suffix;
}, "~B,~S,~S,~B");
Clazz_defineMethod(c$, "getDBID", 
function(type){
return this.prompt("load a " + type, "", false);
}, "~S");
Clazz_defineMethod(c$, "checkCIR", 
function(forceCheck){
if (this.cirChecked && !forceCheck || this.g.resolverResolver == null) return;
try {
this.g.removeParam("_cirStatus");
var m = this.getModelSetAuxiliaryInfo();
m.remove("cirInfo");
var map = this.parseJSONMap(this.getFileAsString(this.g.resolverResolver));
m.put("cirInfo", map);
this.ms.msInfo = m;
var s = map.get("status");
this.g.setO("_cirStatus", s);
this.g.setCIR(map.get("rfc6570Template"), !this.isSilent);
if (!this.isSilent) JU.Logger.info("Viewer.checkCIR _.cirInfo.status = " + s);
} catch (t) {
System.out.println("Viewer.checkCIR failed at " + this.g.resolverResolver + ": " + t);
}
this.cirChecked = true;
}, "~B");
Clazz_defineMethod(c$, "getStandardLabelFormat", 
function(type){
switch (type) {
default:
case 0:
return "%[identify]";
case 1:
return this.g.defaultLabelXYZ;
case 2:
return this.g.defaultLabelPDB;
}
}, "~N");
Clazz_defineMethod(c$, "getAdditionalHydrogens", 
function(bsAtoms, vConnections, flags){
if (bsAtoms == null) bsAtoms = this.bsA();
var nTotal =  Clazz_newIntArray (1, 0);
var pts = this.ms.calculateHydrogens(bsAtoms, nTotal, vConnections, flags);
var points =  new Array(nTotal[0]);
for (var i = 0, pt = 0; i < pts.length; i++) if (pts[i] != null) for (var j = 0; j < pts[i].length; j++) points[pt++] = pts[i][j];


return points;
}, "JU.BS,JU.Lst,~N");
Clazz_overrideMethod(c$, "setMarBond", 
function(marBond){
this.g.bondRadiusMilliAngstroms = marBond;
this.g.setI("bondRadiusMilliAngstroms", marBond);
this.setShapeSize(1, marBond * 2, JU.BSUtil.setAll(this.ms.ac));
}, "~N");
Clazz_defineMethod(c$, "setHoverLabel", 
function(strLabel){
this.shm.loadShape(35);
this.setShapeProperty(35, "label", strLabel);
this.setHoverEnabled(strLabel != null);
this.g.setO("_hoverLabel", this.hoverLabel = strLabel);
if (!this.hoverEnabled && !this.sm.haveHoverCallback()) this.startHoverWatcher(false);
}, "~S");
Clazz_defineMethod(c$, "setHoverEnabled", 
function(tf){
this.hoverEnabled = tf;
this.g.setB("_hoverEnabled", tf);
}, "~B");
Clazz_defineMethod(c$, "hoverOn", 
function(atomIndex, isLabel){
this.hoverOnPtr(atomIndex, isLabel, false);
}, "~N,~B");
Clazz_defineMethod(c$, "hoverOnPtr", 
function(atomIndex, isLabel, withPointer){
if (atomIndex < 0) {
this.hoverOff();
return;
}this.g.removeParam("_objecthovered");
this.g.setI("_atomhovered", atomIndex);
this.g.setO("_hoverLabel", this.hoverLabel);
this.g.setUserVariable("hovered", JS.SV.getVariable(JU.BSUtil.newAndSetBit(atomIndex)));
if (this.sm.haveHoverCallback()) this.sm.setStatusAtomHovered(atomIndex, this.getAtomInfoXYZ(atomIndex, 2));
if (!this.hoverEnabled || this.eval != null && this.isScriptExecuting() || atomIndex == this.hoverAtomIndex || this.g.hoverDelayMs == 0 || !this.slm.isInSelectionSubset(atomIndex)) return;
var label = (isLabel ? J.i18n.GT.$("Drag to move label") : this.isModelKitOpen() || this.isModelkitPickingActive() ? this.getModelkit(false).setProperty("hoverlabel", Integer.$valueOf(atomIndex)) : null);
this.shm.loadShape(35);
if (label != null && (!isLabel || this.ms.at[atomIndex].isVisible(512))) {
this.setShapeProperty(35, "specialLabel", label);
}this.setShapeProperty(35, "pointer", Boolean.$valueOf(withPointer));
this.setShapeProperty(35, "text", this.hoverText = null);
this.setShapeProperty(35, "target", Integer.$valueOf(this.hoverAtomIndex = atomIndex));
this.refresh(3, "hover on atom");
}, "~N,~B,~B");
Clazz_defineMethod(c$, "showHover", 
function(){
return !this.tm.isNavigating() && (!this.am.splitFrame || this.am.currentSplitFrame == this.tm.splitFrameCurrentlyRendering);
});
Clazz_defineMethod(c$, "isModelkitPickingActive", 
function(){
if (this.acm.getAtomPickingMode() == 32) return true;
switch (this.acm.getBondPickingMode()) {
case 34:
case 33:
case 8:
case 35:
return this.g.bondPicking;
}
return false;
});
Clazz_defineMethod(c$, "isModelkitPickingRotateBond", 
function(){
return (this.acm != null && this.acm.getBondPickingMode() == 34);
});
Clazz_defineMethod(c$, "hoverOnPt", 
function(x, y, text, id, pt){
if (this.eval != null && this.isScriptExecuting()) return;
this.g.setO("_hoverLabel", text);
if (id != null && pt != null) {
this.g.setO("_objecthovered", id);
this.g.setI("_atomhovered", -1);
this.g.setUserVariable("hovered", JS.SV.getVariable(pt));
if (this.sm.haveHoverCallback()) this.sm.setStatusObjectHovered(id, text, pt);
}if (!this.hoverEnabled) return;
this.shm.loadShape(35);
if (this.gdata.antialiasEnabled) {
x <<= 1;
y <<= 1;
}this.setShapeProperty(35, "xy", JU.P3i.new3(x, y, 0));
this.setShapeProperty(35, "target", null);
this.setShapeProperty(35, "specialLabel", null);
this.setShapeProperty(35, "text", text);
this.hoverAtomIndex = -1;
this.hoverText = text;
this.refresh(3, "hover on point");
}, "~N,~N,~S,~S,JU.T3");
Clazz_defineMethod(c$, "hoverOff", 
function(){
try {
if ((this.isModelKitOpen() || this.modelkit != null && this.modelkit.wasRotating()) && !this.isModelkitPickingRotateBond()) this.highlight(null);
if (!this.hoverEnabled) return;
var isHover = (this.hoverText != null || this.hoverAtomIndex >= 0);
if (this.hoverAtomIndex >= 0) {
this.setShapeProperty(35, "target", null);
this.hoverAtomIndex = -1;
if (this.sm.haveHoverCallback()) this.sm.setStatusAtomHovered(-1, null);
}if (this.hoverText != null) {
this.setShapeProperty(35, "text", null);
this.hoverText = null;
}this.setShapeProperty(35, "specialLabel", null);
if (isHover) this.refresh(3, "hover off");
} catch (e) {
if (Clazz_exceptionOf(e, Exception)){
} else {
throw e;
}
}
});
Clazz_overrideMethod(c$, "setDebugScript", 
function(debugScript){
this.g.debugScript = debugScript;
this.g.setB("debugScript", debugScript);
if (this.eval != null) this.eval.setDebugging();
}, "~B");
Clazz_defineMethod(c$, "clearClickCount", 
function(){
this.setTainted(true);
});
Clazz_defineMethod(c$, "setCursor", 
function(cursor){
if (this.$isKiosk || this.currentCursor == cursor || this.multiTouch || !this.haveDisplay) return;
this.apiPlatform.setCursor(this.currentCursor = cursor, this.display);
}, "~N");
Clazz_defineMethod(c$, "setPickingMode", 
function(strMode, pickingMode){
if (!this.haveDisplay) return;
var mode = this.acm.getAtomPickingMode();
this.showSelected = false;
var option = null;
if (strMode != null) {
var pt = strMode.indexOf("_");
if (pt >= 0) {
option = strMode.substring(pt + 1);
strMode = strMode.substring(0, pt);
}pickingMode = JV.ActionManager.getPickingMode(strMode);
}if (pickingMode < 0) pickingMode = 1;
this.acm.setPickingMode(pickingMode);
var name = JV.ActionManager.getPickingModeName(this.acm.getAtomPickingMode());
this.g.setO("picking", name);
if (this.modelkit != null) {
this.modelkit.setProperty("atompickingmode", name);
this.acm.setPickingMode(pickingMode);
switch (pickingMode) {
case 1:
if (pickingMode != mode) this.setModelKitMode(false);
break;
case 8:
case 35:
this.modelkit.setProperty("bondpickingmode", strMode.toLowerCase());
break;
}
}if (option == null || option.length == 0) return;
option = Character.toUpperCase(option.charAt(0)) + (option.length == 1 ? "" : option.substring(1, 2));
switch (pickingMode) {
case 32:
this.getModelkit(false).setProperty("atomtype", option);
break;
case 33:
this.setBooleanPropertyTok("bondPicking", 603979814, true);
this.getModelkit(false).setProperty("bondtype", option);
break;
default:
JU.Logger.error("Bad picking mode: " + strMode + "_" + option);
}
}, "~S,~N");
Clazz_defineMethod(c$, "getPickingMode", 
function(){
return (this.haveDisplay ? this.acm.getAtomPickingMode() : 0);
});
Clazz_defineMethod(c$, "setPickingStyle", 
function(style, pickingStyle){
if (!this.haveDisplay) return;
if (style != null) pickingStyle = JV.ActionManager.getPickingStyleIndex(style);
if (pickingStyle < 0) pickingStyle = 0;
this.acm.setPickingStyle(pickingStyle);
this.g.setO("pickingStyle", JV.ActionManager.getPickingStyleName(this.acm.getPickingStyle()));
}, "~S,~N");
Clazz_defineMethod(c$, "getDrawHover", 
function(){
return this.haveDisplay && this.g.drawHover;
});
Clazz_defineMethod(c$, "getAtomInfo", 
function(atomOrPointIndex){
if (this.ptTemp == null) this.ptTemp =  new JU.P3();
return (atomOrPointIndex >= 0 ? this.ms.getAtomInfo(atomOrPointIndex, null, this.ptTemp) : this.shm.getShapePropertyIndex(6, "pointInfo", -atomOrPointIndex));
}, "~N");
Clazz_defineMethod(c$, "getAtomInfoXYZ", 
function(atomIndex, mode){
var atom = this.ms.at[atomIndex];
if (mode == 4) return this.getChimeMessenger().getInfoXYZ(atom);
if (this.ptTemp == null) this.ptTemp =  new JU.P3();
return atom.getIdentityXYZ(this.ptTemp, mode);
}, "~N,~N");
Clazz_defineMethod(c$, "setSync", 
function(){
if (this.sm.doSync()) this.sm.setSync(null);
});
Clazz_overrideMethod(c$, "setJmolCallbackListener", 
function(listener){
this.sm.cbl = listener;
}, "J.api.JmolCallbackListener");
Clazz_overrideMethod(c$, "setJmolStatusListener", 
function(listener){
this.sm.cbl = this.sm.jsl = listener;
}, "J.api.JmolStatusListener");
Clazz_defineMethod(c$, "getStatusChanged", 
function(statusNameList){
return (statusNameList == null ? null : this.sm.getStatusChanged(statusNameList));
}, "~S");
Clazz_defineMethod(c$, "menuEnabled", 
function(){
return (!this.g.disablePopupMenu && this.getPopupMenu() != null);
});
Clazz_defineMethod(c$, "setStatusDragDropped", 
function(mode, x, y, fileName, retType){
if (mode == 0) {
this.g.setO("_fileDropped", fileName);
this.g.setUserVariable("doDrop", JS.SV.vT);
this.g.setUserVariable("dropFileType", JS.SV.newS(""));
this.g.setUserVariable("dropFileName", JS.SV.newS(fileName));
}var handled = this.sm.setStatusDragDropped(mode, x, y, fileName, retType);
var type = this.getP("dropFileType").toString();
if (type.length > 0 && retType != null) {
retType[0] = type;
}return (!handled || this.getP("doDrop").toString().equals("true"));
}, "~N,~N,~N,~S,~A");
Clazz_defineMethod(c$, "setStatusResized", 
function(width, height){
this.sm.setStatusResized(width, height);
}, "~N,~N");
Clazz_defineMethod(c$, "scriptStatus", 
function(strStatus){
this.setScriptStatus(strStatus, "", 0, null);
}, "~S");
Clazz_defineMethod(c$, "scriptStatusMsg", 
function(strStatus, statusMessage){
this.setScriptStatus(strStatus, statusMessage, 0, null);
}, "~S,~S");
Clazz_defineMethod(c$, "setScriptStatus", 
function(strStatus, statusMessage, msWalltime, strErrorMessageUntranslated){
this.sm.setScriptStatus(strStatus, statusMessage, msWalltime, strErrorMessageUntranslated);
}, "~S,~S,~N,~S");
Clazz_overrideMethod(c$, "showUrl", 
function(urlString){
if (urlString == null) return;
if (urlString.indexOf(":") < 0) {
var base = this.fm.getAppletDocumentBase();
if (base === "") base = this.fm.getFullPathName(false);
if (base.indexOf("/") >= 0) {
base = base.substring(0, base.lastIndexOf("/") + 1);
} else if (base.indexOf("\\") >= 0) {
base = base.substring(0, base.lastIndexOf("\\") + 1);
}urlString = base + urlString;
}JU.Logger.info("showUrl:" + urlString);
this.sm.showUrl(urlString);
}, "~S");
Clazz_defineMethod(c$, "setMeshCreator", 
function(meshCreator){
this.shm.loadShape(24);
this.setShapeProperty(24, "meshCreator", meshCreator);
}, "~O");
Clazz_defineMethod(c$, "showConsole", 
function(showConsole){
if (!this.haveDisplay) return;
try {
var firstTime = (this.appConsole == null);
if (firstTime && showConsole) {
this.getConsole();
}this.appConsole.setVisible(true);
} catch (e) {
}
}, "~B");
Clazz_defineMethod(c$, "getConsole", 
function(){
var addCallBack = (this.sm.cbl == null && this.appConsole == null);
this.getProperty("DATA_API", "getAppConsole", Boolean.TRUE);
if (addCallBack && Clazz_instanceOf(this.appConsole,"J.api.JmolCallbackListener")) this.setJmolCallbackListener(this.appConsole);
return this.appConsole;
});
Clazz_overrideMethod(c$, "getParameter", 
function(key){
return this.getP(key);
}, "~S");
Clazz_defineMethod(c$, "getP", 
function(key){
return this.g.getParameter(key, true);
}, "~S");
Clazz_defineMethod(c$, "getPOrNull", 
function(key){
return this.g.getParameter(key, false);
}, "~S");
Clazz_defineMethod(c$, "unsetProperty", 
function(key){
key = key.toLowerCase();
if (key.equals("all") || key.equals("variables")) this.fm.setPathForAllFiles("");
this.g.unsetUserVariable(key);
}, "~S");
Clazz_overrideMethod(c$, "notifyStatusReady", 
function(isReady){
System.out.println("Jmol applet " + this.fullName + (isReady ? " ready" : " destroyed"));
if (!isReady) this.dispose();
this.sm.setStatusAppletReady(this.fullName, isReady);
}, "~B");
Clazz_overrideMethod(c$, "getBooleanProperty", 
function(key){
key = key.toLowerCase();
if (this.g.htBooleanParameterFlags.containsKey(key)) return this.g.htBooleanParameterFlags.get(key).booleanValue();
if (key.endsWith("p!")) {
if (this.acm == null) return false;
var s = this.acm.getPickingState().toLowerCase();
key = key.substring(0, key.length - 2) + ";";
return (s.indexOf(key) >= 0);
}if (key.equalsIgnoreCase("executionPaused")) return (this.eval != null && this.eval.isPaused());
if (key.equalsIgnoreCase("executionStepping")) return (this.eval != null && this.eval.isStepping());
if (key.equalsIgnoreCase("haveBFactors")) return (this.ms.getBFactors() != null);
if (key.equalsIgnoreCase("colorRasmol")) return this.cm.isDefaultColorRasmol;
if (key.equalsIgnoreCase("frank")) return this.getShowFrank();
if (key.equalsIgnoreCase("spinOn")) return this.tm.spinOn;
if (key.equalsIgnoreCase("isNavigating")) return this.tm.isNavigating();
if (key.equalsIgnoreCase("showSelections")) return this.selectionHalosEnabled;
if (this.g.htUserVariables.containsKey(key)) {
var t = this.g.getUserVariable(key);
if (t.tok == 1073742335) return true;
if (t.tok == 1073742334) return false;
}JU.Logger.error("vwr.getBooleanProperty(" + key + ") - unrecognized");
return false;
}, "~S");
Clazz_overrideMethod(c$, "getInt", 
function(tok){
switch (tok) {
case 553648159:
return this.g.occupancyThreshold;
case 553648132:
return this.am.animationFps;
case 553648139:
return this.g.dotDensity;
case 553648140:
return this.g.dotScale;
case 553648142:
return this.g.helixStep;
case 553648145:
return this.g.infoFontSize;
case 553648147:
return this.g.labelPointerWidth;
case 553648149:
return this.g.meshScale;
case 553648150:
return this.g.minimizationReportSteps;
case 553648153:
return this.g.minPixelSelRadius;
case 553648154:
return this.g.percentVdwAtom;
case 553648157:
return this.g.pickingSpinRate;
case 553648166:
return this.g.ribbonAspectRatio;
case 536870922:
return this.g.scriptDelay;
case 553648152:
return this.g.minimizationMaxAtoms;
case 553648170:
return this.g.smallMoleculeMaxAtoms;
case 553648183:
return this.g.strutSpacing;
case 553648184:
return this.stm.getUndoMax();
case 553648185:
return this.g.vectorTrail;
}
JU.Logger.error("viewer.getInt(" + JS.T.nameOf(tok) + ") - not listed");
return 0;
}, "~N");
Clazz_defineMethod(c$, "getDelayMaximumMs", 
function(){
return (this.haveDisplay ? this.g.delayMaximumMs : 1);
});
Clazz_defineMethod(c$, "getHermiteLevel", 
function(){
return (this.tm.spinOn && this.g.hermiteLevel > 0 ? 0 : this.g.hermiteLevel);
});
Clazz_defineMethod(c$, "getHoverDelay", 
function(){
return (this.isModelKitOpen() || this.isModelkitPickingActive() || this.getDrawHover() ? 20 : this.g.hoverDelayMs);
});
Clazz_overrideMethod(c$, "getBoolean", 
function(tok){
switch (tok) {
case 603979970:
return this.g.useMinimizationThread;
case 603979891:
return this.g.nboCharges;
case 603979856:
return this.g.hiddenLinesDashed;
case 1073742086:
return this.ms.getMSInfoB(JV.JC.getBoolName(4));
case 603979802:
return this.g.autoplayMovie;
case 603979797:
return !this.headless && this.g.allowAudio;
case 603979780:
return this.g.allowGestures;
case 603979784:
return this.g.allowMultiTouch;
case 603979785:
return this.g.allowRotateSelected;
case 603979792:
return this.g.appendNew;
case 603979794:
return this.g.applySymmetryToBonds;
case 603979796:
return this.g.atomPicking;
case 603979798:
return this.g.autoBond;
case 603979800:
return this.g.autoFps;
case 603979806:
return this.g.axesOrientationRasmol;
case 603979811:
return this.g.cartoonSteps;
case 603979810:
return this.g.cartoonBlocks;
case 603979812:
return this.g.bondModeOr;
case 603979815:
return this.g.cartoonBaseEdges;
case 603979816:
return this.g.cartoonFancy;
case 603979817:
return this.g.cartoonLadders;
case 603979818:
return this.g.cartoonRibose;
case 603979819:
return this.g.cartoonRockets;
case 603979822:
return this.g.chainCaseSensitive || this.chainCaseSpecified;
case 603979821:
return this.g.checkCIR;
case 603979823:
return this.g.cipRule6Full;
case 603979825:
return this.g.debugScript;
case 603979826:
return this.g.defaultStructureDSSP;
case 603979827:
return this.g.disablePopupMenu;
case 603979828:
return this.g.displayCellParameters;
case 603979830:
return this.g.dotSurface;
case 603979829:
return this.g.dotsSelectedOnly;
case 603979831:
return this.g.doublePrecision;
case 603979834:
return this.g.drawPicking;
case 603979838:
return this.g.elementKey;
case 603979846:
return this.g.fontCaching;
case 603979847:
return this.g.fontScaling;
case 603979848:
return this.g.forceAutoBond;
case 603979849:
return false;
case 603979850:
return this.g.greyscaleRendering;
case 603979852:
return this.g.hbondsBackbone;
case 603979853:
return this.g.hbondsRasmol;
case 603979854:
return this.g.hbondsSolid;
case 1612709894:
return this.g.rasmolHeteroSetting;
case 603979858:
return this.g.hideNameInPopup;
case 603979863:
return this.g.highResolutionFlag;
case 1612709900:
return this.g.rasmolHydrogenSetting;
case 603979866:
return this.g.isosurfaceKey;
case 603979868:
return this.g.jmolInJSpecView;
case 603979869:
return this.g.justifyMeasurements;
case 603979872:
return this.g.legacyAutoBonding;
case 603979873:
return this.g.legacyHAddition;
case 603979874:
return this.g.legacyJavaFloat;
case 603979876:
return this.g.logGestures;
case 603979877:
return this.g.measureAllModels;
case 603979878:
return this.g.measurementLabels;
case 603979879:
return this.g.messageStyleChime;
case 603979882:
return this.g.mode2d;
case 603983903:
return this.g.modelKitMode;
case 603979886:
return this.g.multipleBondBananas;
case 603979889:
return this.g.navigationMode;
case 603979890:
return this.g.navigationPeriodic;
case 603979893:
return this.g.partialDots;
case 603979894:
return this.g.pdbAddHydrogens;
case 603979896:
return this.g.pdbSequential;
case 603979898:
return this.g.preserveState;
case 603979900:
return this.refreshing;
case 603979901:
return this.g.ribbonBorder;
case 603979902:
return this.g.rocketBarrels;
case 603979892:
return this.g.noDelay;
case 603979906:
return this.g.selectAllModels;
case 603979920:
return this.g.showHiddenSelectionHalos;
case 603979922:
return this.g.showHydrogens;
case 603979926:
return this.g.showMeasurements;
case 603979927:
return this.g.showModVecs;
case 603979928:
return this.g.showMultipleBonds;
case 603979934:
return this.g.showTiming;
case 603979937:
return this.g.showUnitCellDetails;
case 603979939:
return this.g.slabByAtom;
case 603979940:
return this.g.slabByMolecule;
case 603979944:
return this.g.smartAromatic;
case 603979948:
return this.g.dotSolvent;
case 603979952:
return this.g.ssbondsBackbone;
case 603979955:
return this.g.strutsMultiple;
case 603979956:
return this.g.symmetryHermannMauguin;
case 603979960:
return this.g.testFlag1;
case 603979962:
return this.g.testFlag2;
case 603979964:
return this.g.testFlag3;
case 603979965:
return this.g.testFlag4;
case 603979966:
return this.g.traceAlpha;
case 1111490588:
return this.g.translucent;
case 603979968:
return this.g.twistedSheets;
case 603979972:
return this.g.vectorsCentered;
case 603979973:
return this.g.vectorSymmetry;
case 603979975:
return this.g.waitForMoveTo;
case 603979978:
return this.g.zeroBasedXyzRasmol;
}
JU.Logger.error("viewer.getBoolean(" + JS.T.nameOf(tok) + ") - not listed");
return false;
}, "~N");
Clazz_defineMethod(c$, "allowEmbeddedScripts", 
function(){
return (this.g.allowEmbeddedScripts && !this.isPreviewOnly);
});
Clazz_defineMethod(c$, "getDragSelected", 
function(){
return (this.g.dragSelected && !this.g.modelKitMode);
});
Clazz_defineMethod(c$, "getBondsPickable", 
function(){
return (this.g.bondPicking || this.isModelkitPickingActive() || this.isModelKitOpen() && this.getModelkitPropertySafely("ismolecular") === Boolean.TRUE);
});
Clazz_defineMethod(c$, "isModelKitOpen", 
function(){
return this.g.modelKitMode && this.modelkit != null && !this.modelkit.isHidden();
});
Clazz_defineMethod(c$, "useMinimizationThread", 
function(){
return (this.g.useMinimizationThread && !this.autoExit);
});
Clazz_overrideMethod(c$, "getFloat", 
function(tok){
switch (tok) {
case 1153433601:
return this.g.particleRadius;
case 570425345:
return this.g.axesOffset;
case 570425346:
return this.g.axesScale;
case 570425348:
return this.g.bondTolerance;
case 570425353:
return this.g.defaultTranslucent;
case 570425352:
return this.g.defaultDrawArrowScale;
case 570425354:
return this.g.dipoleScale;
case 570425355:
return this.g.drawFontSize;
case 570425357:
return this.g.exportScale;
case 570425359:
return this.g.hbondsAngleMinimum;
case 570425361:
return this.g.hbondHXDistanceMaximum;
case 570425360:
return this.g.hbondNODistanceMaximum;
case 570425363:
return this.g.loadAtomDataTolerance;
case 570425364:
return this.g.minBondDistance;
case 1275072532:
return this.g.modulationScale;
case 570425370:
return this.g.multipleBondSpacing;
case 570425369:
return this.g.multipleBondRadiusFactor;
case 570425374:
return this.g.navigationSpeed;
case 570425382:
return this.g.pointGroupDistanceTolerance;
case 570425384:
return this.g.pointGroupLinearTolerance;
case 570425388:
return this.tm.modelRadius;
case 570425392:
return this.g.sheetSmoothing;
case 570425394:
return this.g.solventProbeRadius;
case 570425403:
return this.g.starWidth;
case 570425406:
return this.g.strutDefaultRadius;
case 570425408:
return this.g.strutLengthMaximum;
case 1648361473:
return this.g.vectorScale;
case 570425412:
return this.g.vibrationPeriod;
case 570425347:
return this.g.cartoonBlockHeight;
}
JU.Logger.error("viewer.getFloat(" + JS.T.nameOf(tok) + ") - not listed");
return 0;
}, "~N");
Clazz_overrideMethod(c$, "setStringProperty", 
function(key, value){
if (value == null || key == null || key.length == 0) return;
if (key.charAt(0) == '_') {
this.g.setO(key, value);
return;
}var tok = JS.T.getTokFromName(key);
switch (JS.T.getParamType(tok)) {
case 603979776:
this.setBooleanPropertyTok(key, tok, JS.SV.newV(4, value).asBoolean());
break;
case 553648128:
this.setIntPropertyTok(key, tok, JS.SV.newV(4, value).asInt());
break;
case 570425344:
if (!"NaN".equals(value)) this.setFloatPropertyTok(key, tok, JU.PT.parseFloat(value));
break;
default:
this.setStringPropertyTok(key, tok, value);
}
}, "~S,~S");
Clazz_defineMethod(c$, "setStringPropertyTok", 
function(key, tok, value){
switch (tok) {
case 545259567:
this.g.macroDirectory = value = (value == null || value.length == 0 ? "https://chemapps.stolaf.edu/jmol/macros" : value);
this.macros = null;
break;
case 545259570:
this.g.nihResolverFormat = value;
break;
case 545259521:
this.setAnimationMode(value);
return;
case 545259569:
this.g.nmrPredictFormat = value;
break;
case 545259548:
this.g.defaultDropScript = value;
break;
case 545259572:
value = this.fm.setPathForAllFiles(value);
break;
case 545259558:
this.setUnits(value, false);
return;
case 545259560:
if (!this.g.forceField.equals(value)) {
this.g.forceField = value = ("UFF".equalsIgnoreCase(value) ? "UFF" : "UFF2D".equalsIgnoreCase(value) ? "UFF2D" : "MMFF2D".equalsIgnoreCase(value) ? "MMFF2D" : "MMFF");
this.minimizer = null;
}break;
case 545259571:
this.g.nmrUrlFormat = value;
break;
case 545259568:
this.setUnits(value, true);
return;
case 545259565:
this.g.pdbLoadLigandFormat = value;
break;
case 545259543:
this.g.defaultLabelPDB = value;
break;
case 545259544:
this.g.defaultLabelXYZ = value;
break;
case 545259549:
this.g.defaultLoadFilter = value;
break;
case 545259566:
value = this.getOutputManager().setLogFile(value);
if (value == null) return;
break;
case 545259559:
break;
case 545259524:
this.g.atomTypes = value;
break;
case 545259538:
break;
case 545259576:
this.g.pickLabel = value;
break;
case 545259580:
if (value.length == 2 && value.startsWith("R")) this.g.quaternionFrame = value.substring(0, 2);
 else this.g.quaternionFrame = "" + (value.toLowerCase() + "p").charAt(0);
if (!JU.PT.isOneOf(this.g.quaternionFrame, "RC;RP;a;b;c;n;p;q;x;")) this.g.quaternionFrame = "p";
this.ms.haveStraightness = false;
break;
case 545259555:
this.setVdwStr(value);
return;
case 545259563:
 new J.i18n.GT(this, value);
var language = J.i18n.GT.getLanguage();
this.modelkit = null;
if (this.jmolpopup != null) {
this.jmolpopup.jpiDispose();
this.jmolpopup = null;
this.getPopupMenu();
}this.sm.setCallbackFunction("language", language);
value = J.i18n.GT.getLanguage();
break;
case 545259564:
this.g.loadFormat = value;
break;
case 545259534:
this.setObjectColor("background", value);
return;
case 545259528:
this.setObjectColor("axis1", value);
return;
case 545259530:
this.setObjectColor("axis2", value);
return;
case 545259532:
this.setObjectColor("axis3", value);
return;
case 545259536:
this.setObjectColor("boundbox", value);
return;
case 545259586:
this.setObjectColor("unitcell", value);
return;
case 545259578:
this.setPropertyColorScheme(value, false, false);
break;
case 545259562:
this.shm.loadShape(35);
this.setShapeProperty(35, "atomLabel", value);
break;
case 545259547:
this.g.defaultDistanceLabel = value;
break;
case 545259542:
this.g.defaultAngleLabel = value;
break;
case 545259554:
this.g.defaultTorsionLabel = value;
break;
case 545259550:
this.g.defaultLoadScript = value;
break;
case 545259522:
this.fm.setAppletProxy(value);
break;
case 545259546:
if (value == null) value = "";
value = value.$replace('\\', '/');
this.g.defaultDirectory = value;
break;
case 545259561:
this.g.helpPath = value;
break;
case 545259552:
if (!value.equalsIgnoreCase("RasMol") && !value.equalsIgnoreCase("PyMOL")) value = "Jmol";
this.setDefaultsType(value);
break;
case 545259545:
this.setDefaultColors(value.equalsIgnoreCase("rasmol"));
return;
case 545259573:
this.setPickingMode(value, 0);
return;
case 545259574:
this.setPickingStyle(value, 0);
return;
case 545259540:
break;
default:
if (key.toLowerCase().endsWith("callback")) {
this.sm.setCallbackFunction(key, (value.length == 0 || value.equalsIgnoreCase("none") ? null : value));
break;
}if (!this.g.htNonbooleanParameterValues.containsKey(key.toLowerCase())) {
this.g.setUserVariable(key, JS.SV.newV(4, value));
return;
}break;
}
this.g.setO(key, value);
}, "~S,~N,~S");
Clazz_overrideMethod(c$, "setFloatProperty", 
function(key, value){
if (key == null || key.length == 0) return;
if (key.charAt(0) == '_') {
this.g.setF(key, value);
return;
}var tok = JS.T.getTokFromName(key);
switch (JS.T.getParamType(tok)) {
case 545259520:
this.setStringPropertyTok(key, tok, "" + value);
break;
case 603979776:
this.setBooleanPropertyTok(key, tok, value != 0);
break;
case 553648128:
this.setIntPropertyTok(key, tok, Clazz_floatToInt(value));
break;
case 570425344:
if (Float.isNaN(value)) return;
default:
this.setFloatPropertyTok(key, tok, value);
}
}, "~S,~N");
Clazz_defineMethod(c$, "setFloatPropertyTok", 
function(key, tok, value){
switch (tok) {
case 570425347:
this.g.cartoonBlockHeight = value;
break;
case 570425366:
this.ms.setModulation(null, false, null, false);
this.g.modulationScale = value = Math.max(0.1, value);
this.ms.setModulation(null, true, null, false);
break;
case 570425381:
this.g.particleRadius = Math.abs(value);
break;
case 570425355:
this.g.drawFontSize = value;
this.shm.setShapePropertyBs(22, "font", null, null);
break;
case 570425357:
this.g.exportScale = value;
break;
case 570425403:
this.g.starWidth = value;
break;
case 570425369:
this.g.multipleBondRadiusFactor = value;
break;
case 570425370:
this.g.multipleBondSpacing = value;
break;
case 570425393:
this.tm.setSlabRange(value);
break;
case 570425365:
this.g.minimizationCriterion = value;
break;
case 570425358:
if (this.haveDisplay) this.acm.setGestureSwipeFactor(value);
break;
case 570425367:
if (this.haveDisplay) this.acm.setMouseDragFactor(value);
break;
case 570425368:
if (this.haveDisplay) this.acm.setMouseWheelFactor(value);
break;
case 570425408:
this.g.strutLengthMaximum = value;
break;
case 570425406:
this.g.strutDefaultRadius = value;
break;
case 570425376:
this.setSpin("X", Clazz_floatToInt(value));
break;
case 570425378:
this.setSpin("Y", Clazz_floatToInt(value));
break;
case 570425380:
this.setSpin("Z", Clazz_floatToInt(value));
break;
case 570425371:
if (Float.isNaN(value)) return;
this.setSpin("FPS", Clazz_floatToInt(value));
break;
case 570425363:
this.g.loadAtomDataTolerance = value;
break;
case 570425359:
this.g.hbondsAngleMinimum = value;
break;
case 570425361:
this.g.hbondHXDistanceMaximum = value;
break;
case 570425360:
this.g.hbondNODistanceMaximum = value;
break;
case 570425382:
this.g.pointGroupDistanceTolerance = value;
break;
case 570425384:
this.g.pointGroupLinearTolerance = value;
break;
case 570425356:
this.g.ellipsoidAxisDiameter = value;
break;
case 570425398:
this.setSpin("x", Clazz_floatToInt(value));
break;
case 570425400:
this.setSpin("y", Clazz_floatToInt(value));
break;
case 570425402:
this.setSpin("z", Clazz_floatToInt(value));
break;
case 570425396:
this.setSpin("fps", Clazz_floatToInt(value));
break;
case 570425352:
this.g.defaultDrawArrowScale = value;
break;
case 570425353:
this.g.defaultTranslucent = value;
break;
case 570425345:
this.setAxesScale(tok, value);
break;
case 570425346:
this.setAxesScale(tok, value);
break;
case 570425416:
this.tm.visualRangeAngstroms = value;
this.refresh(1, "set visualRange");
break;
case 570425372:
this.setNavigationDepthPercent(value);
break;
case 570425374:
this.g.navigationSpeed = value;
break;
case 570425373:
this.tm.setNavigationSlabOffsetPercent(value);
break;
case 570425350:
this.tm.setCameraDepthPercent(value, false);
this.refresh(1, "set cameraDepth");
return;
case 570425388:
this.setRotationRadius(value, true);
return;
case 570425362:
this.g.hoverDelayMs = Clazz_floatToInt(value * 1000);
break;
case 570425392:
this.g.sheetSmoothing = value;
break;
case 570425354:
value = JV.Viewer.checkFloatRange(value, -10, 10);
this.g.dipoleScale = value;
break;
case 570425404:
this.tm.setStereoDegrees(value);
break;
case 1648361473:
this.setVectorScale(value);
return;
case 570425412:
this.setVibrationPeriod(value);
return;
case 570425414:
this.setVibrationScale(value);
return;
case 570425348:
this.setBondTolerance(value);
return;
case 570425364:
this.setMinBondDistance(value);
return;
case 570425390:
this.tm.setScaleAngstromsPerInch(value);
break;
case 570425394:
value = JV.Viewer.checkFloatRange(value, 0, 10);
this.g.solventProbeRadius = value;
break;
default:
if (!this.g.htNonbooleanParameterValues.containsKey(key.toLowerCase())) {
this.g.setUserVariable(key, JS.SV.newF(value));
return;
}}
this.g.setF(key, value);
}, "~S,~N,~N");
Clazz_overrideMethod(c$, "setIntProperty", 
function(key, value){
if (value == -2147483648 || key == null || key.length == 0) return;
if (key.charAt(0) == '_') {
this.g.setI(key, value);
return;
}var tok = JS.T.getTokFromName(key);
switch (JS.T.getParamType(tok)) {
case 545259520:
this.setStringPropertyTok(key, tok, "" + value);
break;
case 603979776:
this.setBooleanPropertyTok(key, tok, value != 0);
break;
case 570425344:
this.setFloatPropertyTok(key, tok, value);
break;
default:
this.setIntPropertyTok(key, tok, value);
}
}, "~S,~N");
Clazz_defineMethod(c$, "setIntPropertyTok", 
function(key, tok, value){
switch (tok) {
case 553648159:
this.g.occupancyThreshold = value;
break;
case 553648150:
this.g.minimizationReportSteps = Math.min(Math.max(value, 1), 20);
break;
case 553648184:
this.stm.setUndoMax(value);
break;
case 553648147:
this.g.labelPointerWidth = value;
break;
case 553648152:
this.g.minimizationMaxAtoms = value;
break;
case 553648145:
this.g.infoFontSize = Math.max(0, value);
break;
case 553648167:
case 553648144:
case 553648168:
value = this.eval.setStatic(tok, value);
break;
case 553648185:
this.g.vectorTrail = value;
break;
case 553648136:
value = (value == 0 ? 0 : 1);
this.g.bondingVersion = JU.Elements.bondingVersion = value;
break;
case 553648135:
this.gdata.setCelPower(value);
break;
case 553648129:
this.gdata.setAmbientOcclusion(value);
break;
case 553648158:
this.g.platformSpeed = Math.min(Math.max(value, 0), 10);
break;
case 553648149:
this.g.meshScale = value;
break;
case 553648153:
this.g.minPixelSelRadius = value;
break;
case 553648146:
this.g.isosurfacePropertySmoothingPower = value;
break;
case 553648165:
this.g.repaintWaitMs = value;
break;
case 553648170:
this.g.smallMoleculeMaxAtoms = value;
break;
case 553648151:
this.g.minimizationSteps = value;
break;
case 553648183:
this.g.strutSpacing = value;
break;
case 553648156:
value = JV.Viewer.checkIntRange(value, 0, 1000);
this.gdata.setPhongExponent(value);
break;
case 553648142:
this.g.helixStep = value;
this.ms.haveStraightness = false;
break;
case 553648140:
this.g.dotScale = value;
break;
case 553648139:
this.g.dotDensity = value;
break;
case 553648137:
this.g.delayMaximumMs = value;
break;
case 553648148:
JU.Logger.setLogLevel(value);
JU.Logger.info("logging level set to " + value);
this.g.setI("logLevel", value);
if (this.eval != null) this.eval.setDebugging();
return;
case 553648133:
this.setAxesMode(value == 2 ? 603979808 : value == 1 ? 603979804 : 603979809);
return;
case 553648178:
this.setStrandCount(0, value);
return;
case 553648182:
this.setStrandCount(12, value);
return;
case 553648180:
this.setStrandCount(13, value);
return;
case 553648155:
return;
case 536870922:
this.g.scriptDelay = value;
break;
case 553648176:
if (value < 0) value = JV.Viewer.checkIntRange(value, -10, -1);
 else value = JV.Viewer.checkIntRange(value, 0, 100);
this.gdata.setSpecularPower(value);
break;
case 553648172:
value = JV.Viewer.checkIntRange(-value, -10, -1);
this.gdata.setSpecularPower(value);
break;
case 553648134:
this.setMarBond(value);
return;
case 536870924:
this.setBooleanPropertyTok(key, tok, value == 1);
return;
case 553648174:
value = JV.Viewer.checkIntRange(value, 0, 100);
this.gdata.setSpecularPercent(value);
break;
case 553648138:
value = JV.Viewer.checkIntRange(value, 0, 100);
this.gdata.setDiffusePercent(value);
break;
case 553648130:
value = JV.Viewer.checkIntRange(value, 0, 100);
this.gdata.setAmbientPercent(value);
break;
case 553648186:
this.tm.zDepthToPercent(value);
break;
case 553648188:
this.tm.zSlabToPercent(value);
break;
case 554176526:
this.tm.depthToPercent(value);
break;
case 554176565:
this.tm.slabToPercent(value);
break;
case 553648190:
this.g.zShadePower = value = Math.max(value, 0);
break;
case 553648166:
this.g.ribbonAspectRatio = value;
break;
case 553648157:
this.g.pickingSpinRate = (value < 1 ? 1 : value);
break;
case 553648132:
this.setAnimationFps(value);
return;
case 553648154:
this.setPercentVdwAtom(value);
break;
case 553648143:
this.g.hermiteLevel = value;
break;
case 553648141:
case 553648161:
case 553648160:
case 553648162:
case 553648164:
break;
default:
if (!this.g.htNonbooleanParameterValues.containsKey(key)) {
this.g.setUserVariable(key, JS.SV.newI(value));
return;
}}
this.g.setI(key, value);
}, "~S,~N,~N");
c$.checkIntRange = Clazz_defineMethod(c$, "checkIntRange", 
function(value, min, max){
return (value < min ? min : value > max ? max : value);
}, "~N,~N,~N");
c$.checkFloatRange = Clazz_defineMethod(c$, "checkFloatRange", 
function(value, min, max){
return (value < min ? min : value > max ? max : value);
}, "~N,~N,~N");
Clazz_overrideMethod(c$, "setBooleanProperty", 
function(key, value){
if (key == null || key.length == 0) return;
if (key.charAt(0) == '_') {
this.g.setB(key, value);
return;
}var tok = JS.T.getTokFromName(key);
switch (JS.T.getParamType(tok)) {
case 545259520:
this.setStringPropertyTok(key, tok, "");
break;
case 553648128:
this.setIntPropertyTok(key, tok, value ? 1 : 0);
break;
case 570425344:
this.setFloatPropertyTok(key, tok, value ? 1 : 0);
break;
default:
this.setBooleanPropertyTok(key, tok, value);
}
}, "~S,~B");
Clazz_defineMethod(c$, "setBooleanPropertyTok", 
function(key, tok, value){
var doRepaint = true;
switch (tok) {
case 603979882:
this.g.mode2d = value;
break;
case 603979870:
this.g.labelKey = value;
if (value) this.g.elementKey = false;
this.getModelkit(false).setProperty("setlabelkey", Boolean.$valueOf(value));
break;
case 603979838:
this.g.elementKey = value;
if (value) this.g.labelKey = false;
this.getModelkit(false).setProperty("setelementkey", Boolean.$valueOf(value));
break;
case 603979956:
this.g.symmetryHermannMauguin = value;
break;
case 603979831:
value = new Boolean (value & JV.Viewer.isJS).valueOf();
this.g.doublePrecision = value;
JV.Viewer.isHighPrecision = this.g.doublePrecision;
this.setBooleanPropertyTok("legacyJavaFloat", 603979874, value);
break;
case 603979821:
this.g.checkCIR = value;
if (value) {
this.checkCIR(true);
}break;
case 603979823:
this.g.cipRule6Full = value;
break;
case 603979802:
this.g.autoplayMovie = value;
break;
case 603979797:
value = false;
this.g.allowAudio = value;
break;
case 603979892:
this.g.noDelay = value;
break;
case 603979891:
this.g.nboCharges = value;
break;
case 603979856:
this.g.hiddenLinesDashed = value;
break;
case 603979886:
this.g.multipleBondBananas = value;
break;
case 603979884:
this.g.modulateOccupancy = value;
break;
case 603979874:
if (value || !this.g.doublePrecision) this.g.legacyJavaFloat = value;
value = this.g.legacyJavaFloat;
break;
case 603979927:
this.g.showModVecs = value;
break;
case 603979937:
this.g.showUnitCellDetails = value;
break;
case 603979849:
doRepaint = false;
break;
case 603979972:
this.g.vectorsCentered = value;
break;
case 603979810:
this.g.cartoonBlocks = value;
break;
case 603979811:
this.g.cartoonSteps = value;
break;
case 603979818:
this.g.cartoonRibose = value;
break;
case 603979840:
this.g.ellipsoidArrows = value;
break;
case 1111490588:
this.g.translucent = value;
break;
case 603979817:
this.g.cartoonLadders = value;
break;
case 603979968:
var b = this.g.twistedSheets;
this.g.twistedSheets = value;
if (b != value) this.checkCoordinatesChanged(null);
break;
case 603979820:
this.gdata.setCel(value);
break;
case 603979816:
this.g.cartoonFancy = value;
break;
case 603979934:
this.g.showTiming = value;
break;
case 603979973:
this.g.vectorSymmetry = value;
break;
case 603979866:
this.g.isosurfaceKey = value;
break;
case 603979893:
this.g.partialDots = value;
break;
case 603979872:
this.g.legacyAutoBonding = value;
break;
case 603979826:
this.g.defaultStructureDSSP = value;
break;
case 603979835:
this.g.dsspCalcHydrogen = value;
break;
case 603979782:
this.g.allowModelkit = value;
if (!value) this.setModelKitMode(false);
break;
case 603983903:
this.setModelKitMode(value);
break;
case 603979887:
this.g.multiProcessor = value && (JV.Viewer.nProcessors > 1);
break;
case 603979885:
this.g.monitorEnergy = value;
break;
case 603979853:
this.g.hbondsRasmol = value;
break;
case 603979880:
this.g.minimizationRefresh = value;
break;
case 603979881:
this.g.minimizationSilent = value;
break;
case 603979865:
if (value) {
this.$isKiosk = true;
this.g.disablePopupMenu = true;
if (this.display != null) this.apiPlatform.setTransparentCursor(this.display);
}break;
case 603979975:
this.g.waitForMoveTo = value;
break;
case 603979875:
this.g.logCommands = true;
break;
case 603979876:
this.g.logGestures = true;
break;
case 603979784:
this.g.allowMultiTouch = value;
break;
case 603979898:
this.g.preserveState = value;
this.ms.setPreserveState(value);
this.undoMoveAction(4165, -2);
break;
case 603979955:
this.g.strutsMultiple = value;
break;
case 603979845:
break;
case 603979939:
this.g.slabByAtom = value;
break;
case 603979940:
this.g.slabByMolecule = value;
break;
case 603979903:
this.g.saveProteinStructureState = value;
break;
case 603979780:
this.g.allowGestures = value;
break;
case 603979864:
this.g.imageState = value;
break;
case 603979970:
this.g.useMinimizationThread = value;
break;
case 603979781:
this.g.allowKeyStrokes = value;
break;
case 603979832:
this.g.dragSelected = value;
this.showSelected = false;
break;
case 603979924:
this.g.showKeyStrokes = value;
break;
case 603979846:
this.g.fontCaching = value;
break;
case 603979796:
this.g.atomPicking = value;
break;
case 603979814:
this.highlight(null);
this.g.bondPicking = value;
break;
case 603979906:
this.g.selectAllModels = value;
if (value) this.slm.setSelectionSubset(null);
 else this.am.setSelectAllSubset(false);
break;
case 603979879:
this.g.messageStyleChime = value;
break;
case 603979896:
this.g.pdbSequential = value;
break;
case 603979894:
this.g.pdbAddHydrogens = value;
break;
case 603979895:
this.g.pdbGetHeader = value;
break;
case 603979841:
this.g.ellipsoidAxes = value;
break;
case 603979839:
this.g.ellipsoidArcs = value;
break;
case 603979842:
this.g.ellipsoidBall = value;
break;
case 603979843:
this.g.ellipsoidDots = value;
break;
case 603979844:
this.g.ellipsoidFill = value;
break;
case 603979847:
this.g.fontScaling = value;
break;
case 603979957:
this.setSyncTarget(0, value);
break;
case 603979958:
this.setSyncTarget(1, value);
break;
case 603979977:
this.g.wireframeRotation = value;
break;
case 603979867:
this.g.isosurfacePropertySmoothing = value;
break;
case 603979834:
this.g.drawPicking = value;
break;
case 603979786:
case 603979790:
case 603979788:
this.setAntialias(tok, value);
break;
case 603979944:
this.g.smartAromatic = value;
break;
case 603979794:
this.setApplySymmetryToBonds(value);
break;
case 603979792:
this.g.appendNew = value;
break;
case 603979800:
this.g.autoFps = value;
break;
case 603979971:
JU.DF.setUseNumberLocalization(this.g.useNumberLocalization = value);
break;
case 603979918:
case 1611272202:
key = "showFrank";
this.setFrankOn(value);
break;
case 1612709912:
key = "solventProbe";
this.g.dotSolvent = value;
break;
case 603979948:
this.g.dotSolvent = value;
break;
case 603979785:
this.g.allowRotateSelected = value;
break;
case 603979783:
this.g.allowMoveAtoms = value;
this.showSelected = false;
break;
case 536870922:
this.setIntPropertyTok("showScript", tok, value ? 1 : 0);
return;
case 603979778:
this.g.allowEmbeddedScripts = value;
break;
case 603979890:
this.g.navigationPeriodic = value;
break;
case 603979984:
this.tm.setZShadeEnabled(value);
return;
case 603979833:
if (this.haveDisplay) this.g.drawHover = value;
break;
case 603979889:
this.setNavigationMode(value);
break;
case 603979860:
this.g.hideNavigationPoint = value;
break;
case 603979930:
this.g.showNavigationPointAlways = value;
break;
case 603979900:
this.setRefreshing(value);
break;
case 603979868:
this.g.jmolInJSpecView = value;
break;
case 603979869:
this.g.justifyMeasurements = value;
break;
case 603979952:
this.g.ssbondsBackbone = value;
break;
case 603979852:
this.g.hbondsBackbone = value;
break;
case 603979854:
this.g.hbondsSolid = value;
break;
case 536870924:
this.gdata.setSpecular(value);
break;
case 603979942:
this.tm.setSlabEnabled(value);
return;
case 603979980:
this.tm.setZoomEnabled(value);
return;
case 603979863:
this.g.highResolutionFlag = value;
break;
case 603979966:
this.g.traceAlpha = value;
break;
case 603979983:
this.g.zoomLarge = value;
this.tm.setZoomHeight(this.g.zoomHeight, value);
break;
case 603979982:
this.g.zoomHeight = value;
this.tm.setZoomHeight(value, this.g.zoomLarge);
break;
case 603979871:
J.i18n.GT.setDoTranslate(value);
break;
case 603979862:
this.slm.setHideNotSelected(value);
break;
case 603979904:
this.setScriptQueue(value);
break;
case 603979830:
this.g.dotSurface = value;
break;
case 603979829:
this.g.dotsSelectedOnly = value;
break;
case 1611141172:
this.setSelectionHalosEnabled(value);
break;
case 603979910:
this.g.rasmolHydrogenSetting = value;
break;
case 603979908:
this.g.rasmolHeteroSetting = value;
break;
case 603979928:
this.g.showMultipleBonds = value;
break;
case 603979920:
this.g.showHiddenSelectionHalos = value;
break;
case 603979976:
this.tm.setWindowCentered(value);
break;
case 603979828:
this.g.displayCellParameters = value;
break;
case 603979960:
this.g.testFlag1 = value;
break;
case 603979962:
this.g.testFlag2 = value;
break;
case 603979964:
this.g.testFlag3 = value;
break;
case 603979965:
this.jmolTest();
this.g.testFlag4 = value;
break;
case 603979901:
this.g.ribbonBorder = value;
break;
case 603979815:
this.g.cartoonBaseEdges = value;
break;
case 603979819:
this.g.cartoonRockets = value;
break;
case 603979902:
this.g.rocketBarrels = value;
break;
case 603979850:
this.gdata.setGreyscaleMode(this.g.greyscaleRendering = value);
break;
case 603979878:
this.g.measurementLabels = value;
break;
case 603979809:
case 603979804:
case 603979808:
this.setAxesMode(tok);
return;
case 603979806:
this.setAxesOrientationRasmol(value);
return;
case 603979824:
this.setStringPropertyTok("defaultcolorscheme", 545259545, value ? "rasmol" : "jmol");
return;
case 603979825:
this.setDebugScript(value);
return;
case 603979897:
this.setPerspectiveDepth(value);
return;
case 603979798:
this.setAutoBond(value);
return;
case 603979914:
this.setShowAxes(value);
return;
case 603979916:
this.setShowBbcage(value);
return;
case 603979922:
this.setShowHydrogens(value);
return;
case 603979926:
this.setShowMeasurements(value);
return;
case 603979936:
this.setShowUnitCell(value);
return;
case 603979812:
doRepaint = false;
this.g.bondModeOr = value;
break;
case 603979978:
doRepaint = false;
this.g.zeroBasedXyzRasmol = value;
this.reset(true);
break;
case 603979899:
doRepaint = false;
this.g.rangeSelected = value;
break;
case 603979877:
doRepaint = false;
this.g.measureAllModels = value;
break;
case 603979954:
doRepaint = false;
this.sm.allowStatusReporting = value;
break;
case 603979822:
doRepaint = false;
this.g.chainCaseSensitive = value;
break;
case 603979858:
doRepaint = false;
this.g.hideNameInPopup = value;
break;
case 603979827:
doRepaint = false;
this.g.disablePopupMenu = value;
break;
case 603979848:
doRepaint = false;
this.g.forceAutoBond = value;
break;
default:
if (!this.g.htBooleanParameterFlags.containsKey(key.toLowerCase())) {
this.g.setUserVariable(key, JS.SV.getBoolean(value));
return;
}}
this.g.setB(key, value);
if (doRepaint) this.setTainted(true);
}, "~S,~N,~B");
Clazz_defineMethod(c$, "setModelKitMode", 
function(value){
if (this.acm == null || !this.allowScripting) return;
if (value || this.g.modelKitMode) {
this.setPickingMode(null, value ? 33 : 1);
this.setPickingMode(null, value ? 32 : 1);
}var isChange = (this.g.modelKitMode != value);
this.g.modelKitMode = value;
this.g.setB("modelkitmode", value);
this.highlight(null);
if (isChange) {
this.setModelkitPropertySafely("constraint", null);
}if (value) {
this.setNavigationMode(false);
this.selectAll();
this.setStringProperty("picking", "assignAtom_C");
this.setStringProperty("picking", "assignBond_p");
if (!this.isApplet) this.popupMenu(10, 0, 'm');
if (isChange) this.sm.setStatusModelKit(1);
this.g.modelKitMode = true;
if (this.getOperativeSymmetry() != null) {
} else if (this.ms.ac == 0) {
this.zap(false, true, true);
} else if (this.am.cmi >= 0 && this.getModelUndeletedAtomsBitSet(this.am.cmi).isEmpty()) {
var htParams =  new java.util.Hashtable();
htParams.put("appendToModelIndex", Integer.$valueOf(this.am.cmi));
this.loadDefaultModelKitModel(htParams);
}} else {
this.acm.setPickingMode(-1);
if (isChange) {
this.sm.setStatusModelKit(0);
} else if (!value) {
this.getModelkit(false).setProperty("hidemenu", null);
}}}, "~B");
Clazz_defineMethod(c$, "setSmilesString", 
function(s){
if (s == null) this.g.removeParam("_smilesString");
 else this.g.setO("_smilesString", s);
}, "~S");
Clazz_defineMethod(c$, "removeUserVariable", 
function(key){
this.g.removeUserVariable(key);
if (key.endsWith("callback")) this.sm.setCallbackFunction(key, null);
}, "~S");
Clazz_defineMethod(c$, "jmolTest", 
function(){
});
Clazz_defineMethod(c$, "showParameter", 
function(key, ifNotSet, nMax){
var sv = "" + this.g.getParameterEscaped(key, nMax);
if (ifNotSet || sv.indexOf("<not defined>") < 0) this.showString(key + " = " + sv, false);
}, "~S,~B,~N");
Clazz_defineMethod(c$, "showString", 
function(str, isPrint){
if (!JV.Viewer.isJS && this.isScriptQueued() && (!this.isSilent || isPrint) && !"\0".equals(str)) {
JU.Logger.warn(str);
}this.scriptEcho(str);
}, "~S,~B");
Clazz_defineMethod(c$, "getAllSettings", 
function(prefix){
return this.getStateCreator().getAllSettings(prefix);
}, "~S");
Clazz_defineMethod(c$, "getBindingInfo", 
function(qualifiers){
return (this.haveDisplay ? this.acm.getBindingInfo(qualifiers) : "");
}, "~S");
Clazz_defineMethod(c$, "getIsosurfacePropertySmoothing", 
function(asPower){
return (asPower ? this.g.isosurfacePropertySmoothingPower : this.g.isosurfacePropertySmoothing ? 1 : 0);
}, "~B");
Clazz_defineMethod(c$, "setNavigationDepthPercent", 
function(percent){
this.tm.setNavigationDepthPercent(percent);
this.refresh(1, "set navigationDepth");
}, "~N");
Clazz_defineMethod(c$, "getShowNavigationPoint", 
function(){
if (!this.g.navigationMode) return false;
return (this.tm.isNavigating() && !this.g.hideNavigationPoint || this.g.showNavigationPointAlways || this.getInMotion(true));
});
Clazz_overrideMethod(c$, "setPerspectiveDepth", 
function(perspectiveDepth){
this.tm.setPerspectiveDepth(perspectiveDepth);
}, "~B");
Clazz_overrideMethod(c$, "setAxesOrientationRasmol", 
function(TF){
this.g.setB("axesOrientationRasmol", TF);
this.g.axesOrientationRasmol = TF;
this.reset(true);
}, "~B");
Clazz_defineMethod(c$, "setAxesScale", 
function(tok, val){
val = JV.Viewer.checkFloatRange(val, -100, 100);
if (tok == 570425345) this.g.axesOffset = val;
 else this.g.axesScale = val;
this.axesAreTainted = true;
}, "~N,~N");
Clazz_defineMethod(c$, "setAxesMode", 
function(mode){
this.g.axesMode = mode;
this.axesAreTainted = true;
switch (mode) {
case 603979808:
this.g.removeParam("axesmolecular");
this.g.removeParam("axeswindow");
this.g.setB("axesUnitcell", true);
mode = 2;
break;
case 603979804:
this.g.removeParam("axesunitcell");
this.g.removeParam("axeswindow");
this.g.setB("axesMolecular", true);
mode = 1;
break;
case 603979809:
this.g.removeParam("axesunitcell");
this.g.removeParam("axesmolecular");
this.g.setB("axesWindow", true);
mode = 0;
}
this.g.setI("axesMode", mode);
}, "~N");
Clazz_defineMethod(c$, "getSelectionHalosEnabled", 
function(){
return this.selectionHalosEnabled;
});
Clazz_defineMethod(c$, "setSelectionHalosEnabled", 
function(TF){
if (this.selectionHalosEnabled == TF) return;
this.g.setB("selectionHalos", TF);
this.shm.loadShape(8);
this.selectionHalosEnabled = TF;
}, "~B");
Clazz_defineMethod(c$, "getShowSelectedOnce", 
function(){
var flag = this.showSelected;
this.showSelected = false;
return flag;
});
Clazz_defineMethod(c$, "setStrandCount", 
function(type, value){
value = JV.Viewer.checkIntRange(value, 0, 20);
switch (type) {
case 12:
this.g.strandCountForStrands = value;
break;
case 13:
this.g.strandCountForMeshRibbon = value;
break;
default:
this.g.strandCountForStrands = value;
this.g.strandCountForMeshRibbon = value;
break;
}
this.g.setI("strandCount", value);
this.g.setI("strandCountForStrands", this.g.strandCountForStrands);
this.g.setI("strandCountForMeshRibbon", this.g.strandCountForMeshRibbon);
}, "~N,~N");
Clazz_defineMethod(c$, "getStrandCount", 
function(type){
return (type == 12 ? this.g.strandCountForStrands : this.g.strandCountForMeshRibbon);
}, "~N");
Clazz_defineMethod(c$, "setNavigationMode", 
function(TF){
this.g.navigationMode = TF;
this.tm.setNavigationMode(TF);
}, "~B");
Clazz_overrideMethod(c$, "setAutoBond", 
function(TF){
this.g.setB("autobond", TF);
this.g.autoBond = TF;
}, "~B");
Clazz_defineMethod(c$, "makeConnections", 
function(minDistance, maxDistance, order, connectOperation, bsA, bsB, bsBonds, isBonds, addGroup, energy){
this.clearModelDependentObjects();
this.clearMinimization();
return this.ms.makeConnections(minDistance, maxDistance, order, connectOperation, bsA, bsB, bsBonds, isBonds, addGroup, energy);
}, "~N,~N,~N,~N,JU.BS,JU.BS,JU.BS,~B,~B,~N");
Clazz_overrideMethod(c$, "rebond", 
function(){
this.rebondState(false);
});
Clazz_defineMethod(c$, "rebondState", 
function(isStateScript){
this.clearModelDependentObjects();
this.ms.deleteAllBonds();
var isLegacy = isStateScript && this.g.legacyAutoBonding;
this.ms.autoBondBs4(null, null, null, null, this.getMadBond(), isLegacy, null);
this.addStateScript((isLegacy ? "set legacyAutoBonding TRUE;connect;set legacyAutoBonding FALSE;" : "connect;"), false, true);
}, "~B");
Clazz_overrideMethod(c$, "setPercentVdwAtom", 
function(value){
this.g.setI("percentVdwAtom", value);
this.g.percentVdwAtom = value;
this.rd.value = value / 100;
this.rd.factorType = J.atomdata.RadiusData.EnumType.FACTOR;
this.rd.vdwType = J.c.VDW.AUTO;
this.shm.setShapeSizeBs(0, 0, this.rd, null);
}, "~N");
Clazz_overrideMethod(c$, "getMadBond", 
function(){
return (this.g.bondRadiusMilliAngstroms * 2);
});
Clazz_overrideMethod(c$, "setShowHydrogens", 
function(TF){
this.g.setB("showHydrogens", TF);
this.g.showHydrogens = TF;
}, "~B");
Clazz_defineMethod(c$, "setShowBbcage", 
function(value){
this.setObjectMad10(32, "boundbox", (value ? -4 : 0));
this.g.setB("showBoundBox", value);
}, "~B");
Clazz_defineMethod(c$, "getShowBbcage", 
function(){
return this.getObjectMad10(4) != 0;
});
Clazz_defineMethod(c$, "setShowUnitCell", 
function(value){
this.setObjectMad10(33, "unitcell", (value ? -2 : 0));
this.g.setB("showUnitCell", value);
}, "~B");
Clazz_defineMethod(c$, "getShowUnitCell", 
function(){
return this.getObjectMad10(5) != 0;
});
Clazz_defineMethod(c$, "setShowAxes", 
function(value){
this.setObjectMad10(34, "axes", (value ? -2 : 0));
this.g.setB("showAxes", value);
}, "~B");
Clazz_defineMethod(c$, "getShowAxes", 
function(){
return this.getObjectMad10(1) != 0;
});
Clazz_overrideMethod(c$, "setFrankOn", 
function(TF){
if (this.isPreviewOnly) TF = false;
this.frankOn = TF;
this.setObjectMad10(36, "frank", (TF ? 1 : 0));
}, "~B");
Clazz_defineMethod(c$, "getShowFrank", 
function(){
if (this.isPreviewOnly || this.isApplet && this.creatingImage) return false;
return (this.isSignedApplet && !this.isSignedAppletLocal && !JV.Viewer.isJS || this.frankOn);
});
Clazz_overrideMethod(c$, "setShowMeasurements", 
function(TF){
this.g.setB("showMeasurements", TF);
this.g.showMeasurements = TF;
}, "~B");
Clazz_defineMethod(c$, "setUnits", 
function(units, isDistance){
var isDefault = "default".equals(units);
if (!isDistance || !isDefault) this.g.setUnits(units);
if (isDistance) {
this.setShapeProperty(6, "reformatDistances", units);
}}, "~S,~B");
Clazz_overrideMethod(c$, "setRasmolDefaults", 
function(){
this.setDefaultsType("RasMol");
});
Clazz_overrideMethod(c$, "setJmolDefaults", 
function(){
this.setDefaultsType("Jmol");
});
Clazz_defineMethod(c$, "setDefaultsType", 
function(type){
if (type.equalsIgnoreCase("RasMol")) {
this.stm.setRasMolDefaults();
return;
}if (type.equalsIgnoreCase("PyMOL")) {
this.stm.setPyMOLDefaults();
return;
}this.stm.setJmolDefaults();
this.setIntProperty("bondingVersion", 0);
this.shm.setShapeSizeBs(0, 0, this.rd, this.getAllAtoms());
}, "~S");
Clazz_defineMethod(c$, "setAntialias", 
function(tok, TF){
var isChanged = false;
switch (tok) {
case 603979786:
isChanged = (this.g.antialiasDisplay != TF);
this.g.antialiasDisplay = TF;
break;
case 603979790:
isChanged = (this.g.antialiasTranslucent != TF);
this.g.antialiasTranslucent = TF;
break;
case 603979788:
this.g.antialiasImages = TF;
return;
}
if (isChanged) {
this.resizeImage(0, 0, false, false, true);
this.refresh(3, "Viewer:setAntialias()");
}}, "~N,~B");
Clazz_defineMethod(c$, "allocTempPoints", 
function(size){
return this.tempArray.allocTempPoints(size);
}, "~N");
Clazz_defineMethod(c$, "freeTempPoints", 
function(tempPoints){
this.tempArray.freeTempPoints(tempPoints);
}, "~A");
Clazz_defineMethod(c$, "allocTempScreens", 
function(size){
return this.tempArray.allocTempScreens(size);
}, "~N");
Clazz_defineMethod(c$, "freeTempScreens", 
function(tempScreens){
this.tempArray.freeTempScreens(tempScreens);
}, "~A");
Clazz_defineMethod(c$, "allocTempEnum", 
function(size){
return this.tempArray.allocTempEnum(size);
}, "~N");
Clazz_defineMethod(c$, "freeTempEnum", 
function(temp){
this.tempArray.freeTempEnum(temp);
}, "~A");
Clazz_defineMethod(c$, "getFont3D", 
function(fontFace, fontStyle, fontSize){
return this.gdata.getFont3DFSS(fontFace, fontStyle, fontSize);
}, "~S,~S,~N");
Clazz_defineMethod(c$, "getAtomGroupQuaternions", 
function(bsAtoms, nMax){
return this.ms.getAtomGroupQuaternions(bsAtoms, nMax, this.getQuaternionFrame());
}, "JU.BS,~N");
Clazz_defineMethod(c$, "setStereoMode", 
function(twoColors, stereoMode, degrees){
this.setFloatProperty("stereoDegrees", degrees);
this.setBooleanPropertyTok("greyscaleRendering", 603979850, stereoMode.isBiColor());
if (twoColors != null) {
this.tm.setStereoMode2(twoColors);
this.am.setSplitFrame(-1, -1);
} else {
this.tm.setStereoMode(stereoMode);
switch (stereoMode) {
case J.c.STER.NONE:
case J.c.STER.DOUBLE:
case J.c.STER.DTI:
break;
case J.c.STER.REDBLUE:
case J.c.STER.REDCYAN:
case J.c.STER.REDGREEN:
case J.c.STER.CUSTOM:
this.am.setSplitFrame(-1, -1);
break;
}
}}, "~A,J.c.STER,~N");
Clazz_defineMethod(c$, "getChimeInfo", 
function(tok){
return this.getPropertyManager().getChimeInfo(tok, this.bsA());
}, "~N");
Clazz_defineMethod(c$, "getModelFileInfo", 
function(){
return this.getPropertyManager().getModelFileInfo(this.getVisibleFramesBitSet());
});
Clazz_defineMethod(c$, "getModelFileInfoAll", 
function(){
return this.getPropertyManager().getModelFileInfo(null);
});
Clazz_defineMethod(c$, "showEditor", 
function(file_text){
var scriptEditor = this.getProperty("DATA_API", "getScriptEditor", Boolean.TRUE);
if (scriptEditor == null) return;
scriptEditor.show(file_text);
}, "~A");
Clazz_defineMethod(c$, "getPropertyManager", 
function(){
if (this.pm == null) (this.pm = J.api.Interface.getInterface("JV.PropertyManager", this, "prop")).setViewer(this);
return this.pm;
});
Clazz_defineMethod(c$, "setTainted", 
function(TF){
this.isTainted = this.axesAreTainted = (TF && (this.refreshing || this.creatingImage));
}, "~B");
Clazz_defineMethod(c$, "checkObjectClicked", 
function(x, y, modifiers){
return this.shm.checkObjectClicked(x, y, modifiers, this.getVisibleFramesBitSet(), this.g.drawPicking);
}, "~N,~N,~N");
Clazz_defineMethod(c$, "checkObjectHovered", 
function(x, y){
return (x >= 0 && this.shm != null && this.shm.checkObjectHovered(x, y, this.getClickableFramesBitSet(x), this.getBondsPickable()));
}, "~N,~N");
Clazz_defineMethod(c$, "getClickableFramesBitSet", 
function(x){
var bs = (this.am.splitFrame ? JU.BSUtil.newAndSetBit(this.am.getSplitFrameModelIndex(x < this.screenWidth ? 0 : 1)) : this.getVisibleFramesBitSet());
return bs;
}, "~N");
Clazz_defineMethod(c$, "checkObjectDragged", 
function(prevX, prevY, x, y, action){
var iShape = 0;
switch (this.getPickingMode()) {
case 2:
iShape = 5;
break;
case 4:
iShape = 22;
break;
}
if (this.shm.checkObjectDragged(prevX, prevY, x, y, action, this.getVisibleFramesBitSet(), iShape)) {
this.refresh(1, "checkObjectDragged");
if (iShape == 22) this.scriptEcho(this.getShapeProperty(22, "command"));
return true;
}return false;
}, "~N,~N,~N,~N,~N");
Clazz_defineMethod(c$, "rotateAxisAngleAtCenter", 
function(eval, rotCenter, rotAxis, degreesPerSecond, endDegrees, isSpin, bsSelected){
var isOK = this.tm.rotateAxisAngleAtCenter(eval, rotCenter, rotAxis, degreesPerSecond, endDegrees, isSpin, bsSelected);
if (isOK) this.setSync();
return isOK;
}, "J.api.JmolScriptEvaluator,JU.P3,JU.V3,~N,~N,~B,JU.BS");
Clazz_defineMethod(c$, "rotateAboutPointsInternal", 
function(eval, point1, point2, degreesPerSecond, endDegrees, isSpin, bsSelected, translation, finalPoints, dihedralList, vectorMatrix, m4, useModelKit, centerAndPoints){
if (eval == null) eval = this.eval;
if (this.headless) {
if (isSpin && endDegrees == 3.4028235E38) return false;
isSpin = false;
}var isOK = this.tm.rotateAboutPointsInternal(eval, point1, point2, degreesPerSecond, endDegrees, false, isSpin, bsSelected, false, translation, finalPoints, dihedralList, vectorMatrix, m4, useModelKit, centerAndPoints);
if (isOK) this.setSync();
return isOK;
}, "J.api.JmolScriptEvaluator,JU.P3,JU.P3,~N,~N,~B,JU.BS,JU.V3,JU.Lst,~A,JU.M3,JU.M4,~B,~A");
Clazz_defineMethod(c$, "startSpinningAxis", 
function(pt1, pt2, isClockwise){
if (this.tm.spinOn || this.tm.navOn) {
this.tm.setSpinOff();
this.tm.setNavOn(false);
return;
}this.tm.rotateAboutPointsInternal(null, pt1, pt2, this.g.pickingSpinRate, 3.4028235E38, isClockwise, true, null, false, null, null, null, null, null, false, null);
}, "JU.T3,JU.T3,~B");
Clazz_defineMethod(c$, "getModelDipole", 
function(){
return this.ms.getModelDipole(this.am.cmi);
});
Clazz_defineMethod(c$, "calculateMolecularDipole", 
function(bsAtoms){
try {
return this.ms.calculateMolecularDipole(this.am.cmi, bsAtoms);
} catch (e$$) {
if (Clazz_exceptionOf(e$$,"JV.JmolAsyncException")){
var e = e$$;
{
if (this.eval != null) this.eval.loadFileResourceAsync(e.getFileName());
return null;
}
} else if (Clazz_exceptionOf(e$$,"RuntimeException")){
var er = e$$;
{
throw er;
}
} else {
throw e$$;
}
}
}, "JU.BS");
Clazz_defineMethod(c$, "setDefaultLattice", 
function(p){
if (!Float.isNaN(p.x + p.y + p.z)) this.g.ptDefaultLattice.setT(p);
this.g.setO("defaultLattice", JU.Escape.eP(p));
}, "JU.P3");
Clazz_defineMethod(c$, "getDefaultLattice", 
function(){
return this.g.ptDefaultLattice;
});
Clazz_defineMethod(c$, "getModelExtract", 
function(atomExpression, doTransform, isModelKit, type){
return this.getPropertyManager().getModelExtract(this.getAtomBitSet(atomExpression), doTransform, isModelKit, type, false);
}, "~O,~B,~B,~S");
Clazz_overrideMethod(c$, "getData", 
function(atomExpression, type){
return this.getModelFileData(atomExpression, type, true);
}, "~S,~S");
Clazz_defineMethod(c$, "getModelFileData", 
function(atomExpression, type, allTrajectories){
return this.getPropertyManager().getAtomData(atomExpression, type, allTrajectories);
}, "~S,~S,~B");
Clazz_defineMethod(c$, "getModelCml", 
function(bs, nAtomsMax, addBonds, doTransform){
return this.getPropertyManager().getModelCml(bs, nAtomsMax, addBonds, doTransform, false);
}, "JU.BS,~N,~B,~B");
Clazz_defineMethod(c$, "getPdbAtomData", 
function(bs, out, asPQR, doTransform){
return this.getPropertyManager().getPdbAtomData(bs == null ? this.bsA() : bs, out, asPQR, doTransform, false);
}, "JU.BS,JU.OC,~B,~B");
Clazz_defineMethod(c$, "isJmolDataFrame", 
function(){
return this.ms.isJmolDataFrame(this.am.cmi);
});
Clazz_defineMethod(c$, "getJmolDataSourceFrame", 
function(){
return this.ms.getJmolDataSourceFrame(this.am.cmi);
});
Clazz_defineMethod(c$, "getJmolDataFrameTypeInt", 
function(){
return this.ms.getJmolFrameTypeInt(this.am.cmi);
});
Clazz_defineMethod(c$, "setFrameTitle", 
function(modelIndex, title){
this.ms.setFrameTitle(JU.BSUtil.newAndSetBit(modelIndex), title);
}, "~N,~S");
Clazz_defineMethod(c$, "setFrameTitleObj", 
function(title){
this.shm.loadShape(31);
this.ms.setFrameTitle(this.getVisibleFramesBitSet(), title);
}, "~O");
Clazz_defineMethod(c$, "getFrameTitle", 
function(){
return this.ms.getFrameTitle(this.am.cmi);
});
Clazz_defineMethod(c$, "setAtomProperty", 
function(bs, tok, iValue, fValue, sValue, values, list){
if (tok == 1648363544) this.shm.deleteVdwDependentShapes(bs);
this.clearMinimization();
this.ms.setAtomProperty(bs, tok, iValue, fValue, sValue, values, list);
switch (tok) {
case 1086326789:
this.setModelkitPropertySafely("updateatomkeys", bs);
case 1111492609:
case 1111492610:
case 1111492611:
case 1111492612:
case 1111492613:
case 1111492614:
case 1111490577:
case 1111490578:
case 1111490579:
this.refreshMeasures(true);
}
}, "JU.BS,~N,~N,~N,~S,~A,~A");
Clazz_defineMethod(c$, "checkCoordinatesChanged", 
function(bsAtoms){
this.ms.recalculatePositionDependentQuantities(bsAtoms, null);
this.refreshMeasures(true);
}, "JU.BS");
Clazz_defineMethod(c$, "setAtomCoords", 
function(bs, tokType, xyzValues){
if (bs.isEmpty()) return;
var atom = this.ms.at[bs.nextSetBit(0)];
var n = bs.cardinality();
this.sm.setStatusStructureModified(atom.i, atom.mi, 3, "setAtomCoords", n, bs);
this.ms.setAtomCoords(bs, tokType, xyzValues);
this.setStatusAtomMoved(true, bs);
this.sm.setStatusStructureModified(atom.i, atom.mi, -3, "OK", n, bs);
}, "JU.BS,~N,~O");
Clazz_defineMethod(c$, "setAtomCoordsRelative", 
function(offset, bs){
if (bs == null) bs = this.bsA();
if (bs.isEmpty()) return;
var doNotify = (offset.lengthSquared() != 0);
var atom = this.ms.at[bs.nextSetBit(0)];
var n = bs.cardinality();
if (doNotify) {
this.sm.setStatusStructureModified(atom.i, atom.mi, 3, "setAtomCoords", n, bs);
}this.ms.setAtomCoordsRelative(offset, bs);
this.checkMinimization();
if (doNotify) {
this.setStatusAtomMoved(false, bs);
this.sm.setStatusStructureModified(atom.i, atom.mi, -3, "OK", n, bs);
}}, "JU.T3,JU.BS");
Clazz_defineMethod(c$, "invertAtomCoord", 
function(pt, plane, bs, ringAtomIndex, isClick){
if (ringAtomIndex >= 0) {
bs = JU.JmolMolecule.getBranchesForInversion(this.ms.at, ringAtomIndex, this.ms.getMoleculeBitSetForAtom(ringAtomIndex));
var nb = bs.cardinality();
switch (nb) {
case 0:
case 1:
return;
case 2:
break;
case 3:
case 4:
var lengths =  Clazz_newIntArray (nb, 0);
var points =  Clazz_newIntArray (nb, 0);
var ni = 0;
for (var i = bs.nextSetBit(0); i >= 0; i = bs.nextSetBit(i + 1), ni++) {
lengths[ni] = this.getBranchBitSet(i, ringAtomIndex, true).cardinality();
points[ni] = i;
}
for (var j = 0; j < nb - 2; j++) {
var max = -2147483648;
var imax = 0;
for (var i = 0; i < nb; i++) if (lengths[i] >= max && bs.get(points[i])) {
imax = points[i];
max = lengths[i];
}
bs.clear(imax);
}
}
if (isClick && !bs.isEmpty()) this.undoMoveActionClear(ringAtomIndex, 2, true);
}var n = bs.cardinality();
if (n == 0) return;
var atom = this.ms.at[bs.nextSetBit(0)];
this.sm.setStatusStructureModified(atom.i, atom.mi, 3, "invertAtomCoords", n, bs);
this.ms.invertSelected(pt, plane, ringAtomIndex, bs);
this.setStatusAtomMoved(true, bs);
this.sm.setStatusStructureModified(atom.i, atom.mi, -3, "OK", n, bs);
if (isClick) this.setStatusAtomPicked(ringAtomIndex, "inverted: " + JU.Escape.eBS(bs), null, false);
}, "JU.P3,JU.P4,JU.BS,~N,~B");
Clazz_defineMethod(c$, "invertSelected", 
function(pt, plane, iAtom, bsAtoms){
if (bsAtoms == null) bsAtoms = this.bsA();
if (bsAtoms.isEmpty()) return;
this.ms.invertSelected(pt, plane, iAtom, bsAtoms);
this.setStatusAtomMoved(true, bsAtoms);
}, "JU.P3,JU.P4,~N,JU.BS");
Clazz_defineMethod(c$, "moveAtoms", 
function(m4, mNew, rotation, translation, center, isInternal, bsAtoms, translationOnly, useModelKit){
if (bsAtoms.isEmpty()) return;
var bsFixed = this.getMotionFixedAtoms(null, null);
if (bsAtoms.intersects(bsFixed)) return;
var uc = (useModelKit ? this.getOperativeSymmetry() : null);
var apos0 = null;
if (uc != null) {
apos0 = this.ms.saveAtomPositions();
}this.ms.moveAtoms(m4, mNew, rotation, translation, bsAtoms, center, isInternal, translationOnly);
if (uc != null) {
this.getModelkit(false).checkMovedAtoms(bsFixed, bsAtoms, apos0);
}this.setStatusAtomMoved(true, bsAtoms);
}, "JU.M4,JU.M3,JU.M3,JU.V3,JU.P3,~B,JU.BS,~B,~B");
Clazz_defineMethod(c$, "moveSelectedXY", 
function(deltaX, deltaY, modifiers){
this.moveSelected(deltaX, deltaY, -2147483648, -2147483648, -2147483648, null, null, null, false, false, modifiers);
}, "~N,~N,~N");
Clazz_defineMethod(c$, "moveSelected", 
function(deltaX, deltaY, deltaZ, x, y, bsSelected, ptOld, ptNew, isTranslation, asAtoms, modifiers){
if (deltaZ == 0 && ptNew == null || this.isJmolDataFrame()) return 0;
if (ptNew == null) {
if (x == -2147483648 && this.modelkit != null) this.setModelkitPropertySafely("rotatebondindex", Integer.$valueOf(-2147483648));
if (deltaX == -2147483648) {
this.showSelected = true;
this.movableBitSet = this.setMovableBitSet(null, !asAtoms);
this.shm.loadShape(8);
this.refresh(6, "moveSelected");
return 0;
}if (deltaX == 2147483647) {
if (!this.showSelected) return 0;
this.showSelected = false;
this.movableBitSet = null;
this.refresh(6, "moveSelected");
return 0;
}}if (this.movingSelected) return 0;
this.movingSelected = true;
this.stopMinimization();
if (ptNew == null && x != -2147483648 && this.modelkit != null && this.modelkit.getProperty("rotatebondindex") != null) {
this.modelkit.actionRotateBond(deltaX, deltaY, x, y, (modifiers & 16) != 0);
} else {
if (bsSelected == null) bsSelected = this.bsA();
var iatom = bsSelected.nextSetBit(0);
bsSelected = this.setMovableBitSet(bsSelected, !asAtoms);
if (bsSelected.isEmpty()) {
bsSelected.set(iatom);
this.sm.setStatusStructureModified(iatom, this.getModelIndexForAtom(iatom), -3, "FAILED", 1, bsSelected);
} else {
if (isTranslation) {
var ptCenter = (ptOld == null ? this.ms.getAtomSetCenter(bsSelected) : ptOld);
if (ptNew == null) {
this.tm.finalizeTransformParameters();
var f = (this.g.antialiasDisplay ? 2 : 1);
this.tm.transformPt3fSafe(ptCenter, this.ptScreen);
var uc = this.getOperativeSymmetry();
if (deltaZ != -2147483648) {
if (uc != null) return 0;
this.ptScreenNew.set(this.ptScreen.x, this.ptScreen.y, this.ptScreen.z + deltaZ);
} else {
this.ptScreenNew.set(this.ptScreen.x + deltaX * f, this.ptScreen.y + deltaY * f, this.ptScreen.z);
}this.tm.unTransformPoint(this.ptScreenNew, this.ptNew);
ptNew = this.ptNew;
if (uc != null) {
ptNew.sub(ptCenter);
ptNew.add(this.ms.at[iatom]);
this.getModelkit(false).cmdAssignMoveAtoms(bsSelected, iatom, ptNew, null, true, !asAtoms, false);
}}if (!Float.isNaN(ptNew.x)) {
ptNew.sub(ptCenter);
this.setAtomCoordsRelative(ptNew, bsSelected);
}} else {
this.tm.rotateXYBy(deltaX, deltaY, bsSelected);
}}}this.refresh(2, "");
this.movingSelected = false;
return (bsSelected == null ? 0 : bsSelected.cardinality());
}, "~N,~N,~N,~N,~N,JU.BS,JU.P3,JU.P3,~B,~B,~N");
Clazz_defineMethod(c$, "warnAtom", 
function(iatom){
if (iatom < 0 && this.atomHighlighted < 0) return;
this.atomHighlighted = iatom;
this.shm.loadShape(8);
this.setShapeProperty(8, "warnAtom", (iatom >= 0 ? Integer.$valueOf(iatom) : null));
}, "~N");
Clazz_defineMethod(c$, "highlightBond", 
function(index, closestAtomIndex, x, y){
if (!this.hoverEnabled) return;
var bs = null;
if (index >= 0) {
var b = this.ms.bo[index];
var i = b.atom2.i;
bs = JU.BSUtil.newAndSetBit(i);
bs.set(b.atom1.i);
}this.highlight(bs);
this.getModelkit(false);
this.setModelkitPropertySafely("screenxy",  Clazz_newIntArray(-1, [x, y]));
this.setModelkitPropertySafely("bondindex", Integer.$valueOf(index));
var text = this.setModelkitPropertySafely("hoverlabel", Integer.$valueOf(-2 - index));
if (text != null) this.hoverOnPt(x, y, text, null, null);
this.refresh(3, "highlightBond");
}, "~N,~N,~N,~N");
Clazz_defineMethod(c$, "highlight", 
function(bs){
this.atomHighlighted = (bs != null && bs.cardinality() == 1 ? bs.nextSetBit(0) : -1);
if (bs == null) {
this.setCursor(0);
} else {
this.shm.loadShape(8);
this.setCursor(12);
}this.setModelkitPropertySafely("highlight", bs);
this.setShapeProperty(8, "highlight", bs);
}, "JU.BS");
Clazz_defineMethod(c$, "refreshMeasures", 
function(andStopMinimization){
this.setShapeProperty(6, "refresh", null);
this.setStatusMeasuring("refreshed", -3, "", 0);
if (andStopMinimization) this.stopMinimization();
}, "~B");
Clazz_defineMethod(c$, "functionXY", 
function(functionName, nX, nY){
var data = null;
if (functionName.indexOf("file:") == 0) data = this.getFileAsString3(functionName.substring(5), false, null);
 else if (functionName.indexOf("data2d_") != 0) return this.sm.functionXY(functionName, nX, nY);
nX = Math.abs(nX);
nY = Math.abs(nY);
var fdata;
if (data == null) {
fdata = this.getDataObj(functionName, null, 2);
if (fdata != null) return fdata;
data = "";
}fdata =  Clazz_newFloatArray (nX, nY, 0);
var f =  Clazz_newFloatArray (nX * nY, 0);
JU.Parser.parseStringInfestedFloatArray(data, null, f);
for (var i = 0, n = 0; i < nX; i++) for (var j = 0; j < nY; j++) fdata[i][j] = f[n++];


return fdata;
}, "~S,~N,~N");
Clazz_defineMethod(c$, "functionXYZ", 
function(functionName, nX, nY, nZ){
var data = null;
if (functionName.indexOf("file:") == 0) data = this.getFileAsString3(functionName.substring(5), false, null);
 else if (functionName.indexOf("data3d_") != 0) return this.sm.functionXYZ(functionName, nX, nY, nZ);
nX = Math.abs(nX);
nY = Math.abs(nY);
nZ = Math.abs(nZ);
var xyzdata;
if (data == null) {
xyzdata = this.getDataObj(functionName, null, 2);
if (xyzdata != null) return xyzdata;
data = "";
}xyzdata =  Clazz_newFloatArray (nX, nY, nZ, 0);
var f =  Clazz_newFloatArray (nX * nY * nZ, 0);
JU.Parser.parseStringInfestedFloatArray(data, null, f);
for (var i = 0, n = 0; i < nX; i++) for (var j = 0; j < nY; j++) for (var k = 0; k < nZ; k++) xyzdata[i][j][k] = f[n++];



return xyzdata;
}, "~S,~N,~N,~N");
Clazz_overrideMethod(c$, "extractMolData", 
function(what){
if (what == null) {
var i = this.am.cmi;
if (i < 0 || this.ms.ac == 0) return null;
what = this.getModelNumberDotted(i);
}return this.getModelExtract(what, true, false, "V2000");
}, "~S");
Clazz_defineMethod(c$, "getNMRPredict", 
function(type){
type = type.toUpperCase();
if (type.equals("H") || type.equals("1H") || type.equals("")) type = "H1";
 else if (type.equals("C") || type.equals("13C")) type = "C13";
if (!type.equals("NONE")) {
if (!type.equals("C13") && !type.equals("H1")) return "Type must be H1 or C13";
var molFile = this.getModelExtract("selected", true, false, "V2000");
var pt = molFile.indexOf("\n");
if (pt < 0) return null;
molFile = "Jmol " + JV.Viewer.version_date + molFile.substring(pt);
if (this.isApplet) {
this.showUrl(this.g.nmrUrlFormat + molFile);
return "opening " + this.g.nmrUrlFormat;
}}this.syncScript("true", "*", 0);
this.syncScript(type + "Simulate:", ".", 0);
return "sending request to JSpecView";
}, "~S");
Clazz_defineMethod(c$, "getHelp", 
function(what){
if (this.g.helpPath.indexOf("?") < 0) {
if (what.length > 0 && what.indexOf("?") != 0) what = "?search=" + JU.PT.rep(what, " ", "%20");
what += (what.length == 0 ? "?ver=" : "&ver=") + JV.JC.majorVersion;
} else {
what = "&" + what;
}this.showUrl(this.g.helpPath + what);
}, "~S");
Clazz_defineMethod(c$, "getChemicalInfo", 
function(smiles, info, bsAtoms){
info = info.toLowerCase();
var type = '/';
switch (";inchi;inchikey;stdinchi;stdinchikey;name;image;drawing;names;".indexOf(";" + info + ";")) {
case 0:
type = 'I';
break;
case 6:
type = 'K';
break;
case 15:
type = 'T';
break;
case 24:
type = 'S';
break;
case 36:
type = 'M';
break;
case 41:
case 47:
type = '2';
break;
case 55:
type = 'N';
break;
}
var s = this.setLoadFormat(false, "_" + smiles, type, false);
if (type == '2') {
this.fm.loadImage(s, "\1" + smiles, false);
return s;
}if (type == '/') {
if (JU.PT.isOneOf(info, ";alc;cdxml;cerius;charmm;cif;cml;ctx;gjf;gromacs;hyperchem;jme;maestro;mol;mol2;sybyl2;mrv;pdb;sdf;sdf3000;sln;smiles;xyz")) s += "file?format=" + info;
 else s += JU.PT.rep(info, " ", "%20");
}s = this.getFileAsString4(s, -1, false, false, false, "file");
switch ((type).charCodeAt(0)) {
case 73:
case 84:
if (s.indexOf("\t") > 0) s = s.substring(0, s.indexOf("\t"));
break;
case 75:
case 77:
if (s.startsWith("InChIKey=")) s = s.substring(9);
if (s.indexOf("\n") > 0) s = s.substring(0, s.indexOf("\n"));
break;
default:
if (info.equals("jme")) s = this.getPropertyManager().fixJMEFormalCharges(bsAtoms, s);
break;
}
return s;
}, "~S,~S,JU.BS");
Clazz_defineMethod(c$, "addCommand", 
function(command){
if (this.autoExit || !this.haveDisplay || !this.getPreserveState()) return;
if (command.startsWith("pause ") || command.equals("pause")) command = "resume";
this.commandHistory.addCommand(JU.PT.replaceAllCharacters(command, "\r\n\t", " "));
}, "~S");
Clazz_defineMethod(c$, "pushState", 
function(){
if (this.autoExit || !this.haveDisplay || !this.getPreserveState()) return;
this.commandHistory.pushState(this.getStateInfo());
});
Clazz_defineMethod(c$, "popState", 
function(){
if (this.autoExit || !this.haveDisplay || !this.getPreserveState()) return;
var state = this.commandHistory.popState();
if (state != null) this.evalStringQuiet(state);
});
Clazz_defineMethod(c$, "removeCommand", 
function(){
return this.commandHistory.removeCommand();
});
Clazz_overrideMethod(c$, "getSetHistory", 
function(howFarBack){
return this.commandHistory.getSetHistory(howFarBack);
}, "~N");
Clazz_defineMethod(c$, "historyFind", 
function(cmd, dir){
return this.commandHistory.find(cmd, dir);
}, "~S,~N");
Clazz_defineMethod(c$, "setHistory", 
function(fileName){
this.commandHistory.getSetHistory(-2147483648);
this.commandHistory.addCommand(this.getFileAsString4(fileName, -1, false, false, true, null));
}, "~S");
Clazz_defineMethod(c$, "getOutputChannel", 
function(localName, fullPath){
return this.getOutputManager().getOutputChannel(localName, fullPath);
}, "~S,~A");
Clazz_overrideMethod(c$, "writeTextFile", 
function(fileName, data){
return this.writeFile(fileName, data, "txt");
}, "~S,~S");
Clazz_defineMethod(c$, "writeFile", 
function(fileName, data, type){
var params =  new java.util.Hashtable();
params.put("fileName", fileName);
params.put("type", type);
params.put(((typeof(data)=='string') ? "text" : "bytes"), data);
return this.outputToFile(params);
}, "~S,~O,~S");
Clazz_overrideMethod(c$, "clipImageOrPasteText", 
function(text){
if (!this.haveAccess(JV.Viewer.ACCESS.ALL)) return "no";
return this.getOutputManager().clipImageOrPasteText(text);
}, "~S");
Clazz_overrideMethod(c$, "getClipboardText", 
function(){
if (!this.haveAccess(JV.Viewer.ACCESS.ALL)) return "no";
try {
return this.getOutputManager().getClipboardText();
} catch (er) {
if (Clazz_exceptionOf(er, Error)){
return J.i18n.GT.$("clipboard is not accessible -- use signed applet");
} else {
throw er;
}
}
});
Clazz_defineMethod(c$, "processWriteOrCapture", 
function(params){
return this.getOutputManager().processWriteOrCapture(params);
}, "java.util.Map");
Clazz_defineMethod(c$, "createZip", 
function(fileName, type, params){
var state = this.getStateInfo();
var data = params.get("data");
if (fileName != null) params.put("fileName", fileName);
params.put("type", type);
params.put("text", state);
if (Clazz_instanceOf(data,Array)) params.put("scripts", data);
 else if (Clazz_instanceOf(data,"JU.Lst")) params.put("imageData", data);
return this.getOutputManager().outputToFile(params);
}, "~S,~S,java.util.Map");
Clazz_overrideMethod(c$, "outputToFile", 
function(params){
return this.getOutputManager().outputToFile(params);
}, "java.util.Map");
Clazz_defineMethod(c$, "setSyncTarget", 
function(mode, TF){
switch (mode) {
case 0:
this.sm.syncingMouse = TF;
break;
case 1:
this.sm.syncingScripts = TF;
break;
case 2:
this.sm.syncSend(TF ? "GET_GRAPHICS" : "SET_GRAPHICS_OFF", "*", 0);
if (Float.isNaN(this.tm.stereoDegrees)) this.setFloatProperty("stereoDegrees", -5);
if (TF) {
this.setBooleanProperty("_syncMouse", false);
this.setBooleanProperty("_syncScript", false);
}return;
}
if (!this.sm.syncingScripts && !this.sm.syncingMouse) this.setSync();
}, "~N,~B");
Clazz_overrideMethod(c$, "syncScript", 
function(script, applet, port){
this.sm.syncScript(script, applet, port);
}, "~S,~S,~N");
Clazz_defineMethod(c$, "syncScriptErr", 
function(script){
return this.sm.syncScriptErr(script);
}, "~S");
Clazz_overrideMethod(c$, "getModelIndexFromId", 
function(id){
return this.ms.getModelIndexFromId(id);
}, "~S");
Clazz_defineMethod(c$, "setSyncDriver", 
function(mode){
this.sm.setSyncDriver(mode);
}, "~N");
Clazz_defineMethod(c$, "setProteinType", 
function(type, bs){
this.ms.setProteinType(bs == null ? this.bsA() : bs, type);
}, "J.c.STR,JU.BS");
Clazz_defineMethod(c$, "getVanderwaalsMar", 
function(i){
return (this.defaultVdw === J.c.VDW.USER ? this.userVdwMars[i] : JU.Elements.getVanderwaalsMar(i, this.defaultVdw));
}, "~N");
Clazz_defineMethod(c$, "getVanderwaalsMarType", 
function(atomicAndIsotopeNumber, type){
if (type == null) type = this.defaultVdw;
 else switch (type) {
case J.c.VDW.AUTO:
case J.c.VDW.AUTO_BABEL:
case J.c.VDW.AUTO_JMOL:
case J.c.VDW.AUTO_RASMOL:
if (this.defaultVdw !== J.c.VDW.AUTO) type = this.defaultVdw;
break;
default:
break;
}
if (type === J.c.VDW.USER && this.bsUserVdws == null) type = J.c.VDW.JMOL;
return (type === J.c.VDW.USER ? this.userVdwMars[atomicAndIsotopeNumber & 127] : JU.Elements.getVanderwaalsMar(atomicAndIsotopeNumber, type));
}, "~N,J.c.VDW");
Clazz_defineMethod(c$, "setVdwStr", 
function(name){
var type = J.c.VDW.getVdwType(name);
if (type == null) type = J.c.VDW.AUTO;
switch (type) {
case J.c.VDW.JMOL:
case J.c.VDW.BABEL:
case J.c.VDW.RASMOL:
case J.c.VDW.AUTO:
case J.c.VDW.USER:
break;
default:
type = J.c.VDW.JMOL;
}
if (type !== this.defaultVdw && type === J.c.VDW.USER && this.bsUserVdws == null) this.setUserVdw(this.defaultVdw);
this.defaultVdw = type;
this.g.setO("defaultVDW", type.getVdwLabel());
}, "~S");
Clazz_defineMethod(c$, "setUserVdw", 
function(mode){
this.userVdwMars =  Clazz_newIntArray (JU.Elements.elementNumberMax, 0);
this.userVdws =  Clazz_newFloatArray (JU.Elements.elementNumberMax, 0);
this.bsUserVdws =  new JU.BS();
if (mode === J.c.VDW.USER) mode = J.c.VDW.JMOL;
for (var i = 1; i < JU.Elements.elementNumberMax; i++) {
this.userVdwMars[i] = JU.Elements.getVanderwaalsMar(i, mode);
this.userVdws[i] = this.userVdwMars[i] / 1000;
}
}, "J.c.VDW");
Clazz_defineMethod(c$, "getDefaultVdwNameOrData", 
function(mode, type, bs){
switch (mode) {
case -2147483648:
return this.defaultVdw.getVdwLabel();
case 2147483647:
if ((bs = this.bsUserVdws) == null) return "";
type = J.c.VDW.USER;
break;
}
if (type == null || type === J.c.VDW.AUTO) type = this.defaultVdw;
if (type === J.c.VDW.USER && this.bsUserVdws == null) this.setUserVdw(this.defaultVdw);
return this.getDataManager().getDefaultVdwNameOrData(type, bs);
}, "~N,J.c.VDW,JU.BS");
Clazz_defineMethod(c$, "deleteAtoms", 
function(bsAtoms, fullModels){
var atomIndex = (bsAtoms == null ? -1 : bsAtoms.nextSetBit(0));
if (atomIndex < 0) return 0;
this.clearModelDependentObjects();
var a = this.ms.at[atomIndex];
if (a == null) return 0;
var mi = a.mi;
if (fullModels) {
return this.deleteModels(mi, bsAtoms);
}this.sm.setStatusStructureModified(atomIndex, a.mi, 4, "deleting atoms " + bsAtoms, bsAtoms.cardinality(), bsAtoms);
this.ms.deleteAtoms(bsAtoms);
var n = this.slm.deleteAtoms(bsAtoms);
this.setTainted(true);
this.sm.setStatusStructureModified(atomIndex, mi, -4, "OK", n, bsAtoms);
return n;
}, "JU.BS,~B");
Clazz_defineMethod(c$, "deleteModels", 
function(modelIndex, bsAtoms){
var bsModels = (bsAtoms == null ? JU.BSUtil.newAndSetBit(modelIndex) : this.ms.getModelBS(bsAtoms, false));
this.clearModelDependentObjects();
bsAtoms = this.getModelUndeletedAtomsBitSetBs(bsModels);
var n = bsAtoms.cardinality();
var currentModel = this.am.cmi;
this.setCurrentModelIndexClear(0, false);
this.am.setAnimationOn(false);
var bsD0 = JU.BSUtil.copy(this.slm.bsDeleted);
var bsDeleted = this.ms.deleteModels(bsModels);
if (bsDeleted == null) {
this.setCurrentModelIndexClear(currentModel, false);
return 0;
}this.sm.setStatusStructureModified(-1, modelIndex, 5, "deleting model " + this.getModelNumberDotted(modelIndex), n, bsAtoms);
this.slm.processDeletedModelAtoms(bsDeleted);
if (this.eval != null) this.eval.deleteAtomsInVariables(bsDeleted);
this.setAnimationRange(0, 0);
this.clearRepaintManager(-1);
this.am.clear();
this.am.initializePointers(1);
this.setCurrentModelIndexClear(this.ms.mc > 1 ? -1 : 0, this.ms.mc > 1);
this.hoverAtomIndex = -1;
this.setFileLoadStatus(J.c.FIL.DELETED, null, null, null, null, null);
this.refreshMeasures(true);
if (bsD0 != null) bsDeleted.andNot(bsD0);
n = JU.BSUtil.cardinalityOf(bsDeleted);
this.sm.setStatusStructureModified(-1, modelIndex, -5, "OK", n, bsDeleted);
return n;
}, "~N,JU.BS");
Clazz_defineMethod(c$, "deleteBonds", 
function(bsDeleted){
var n = this.ms.bondCount;
for (var i = bsDeleted.nextSetBit(0); i >= 0; i = bsDeleted.nextSetBit(i + 1)) {
if (i >= n || this.ms.bo[i] == null) bsDeleted.clear(i);
}
var bi = bsDeleted.nextSetBit(0);
if (bi < 0) return;
var modelIndex = this.ms.bo[bi].atom1.mi;
this.sm.setStatusStructureModified(-1, modelIndex, 2, "delete bonds " + JU.Escape.eBond(bsDeleted), bsDeleted.cardinality(), bsDeleted);
this.ms.deleteBonds(bsDeleted, false);
this.sm.setStatusStructureModified(-1, modelIndex, -2, "OK", bsDeleted.cardinality(), bsDeleted);
}, "JU.BS");
Clazz_defineMethod(c$, "deleteModelAtoms", 
function(modelIndex, firstAtomIndex, nAtoms, bsModelAtoms){
var n = bsModelAtoms.cardinality();
if (n == 0) return;
this.sm.setStatusStructureModified(-1, modelIndex, 7, "delete atoms " + JU.Escape.eBS(bsModelAtoms), n, bsModelAtoms);
JU.BSUtil.deleteBits(this.tm.bsFrameOffsets, bsModelAtoms);
this.getDataManager().deleteModelAtoms(firstAtomIndex, nAtoms, bsModelAtoms);
this.sm.setStatusStructureModified(-1, modelIndex, -7, "OK", n, bsModelAtoms);
}, "~N,~N,~N,JU.BS");
Clazz_defineMethod(c$, "getQuaternionFrame", 
function(){
return this.g.quaternionFrame.charAt(this.g.quaternionFrame.length == 2 ? 1 : 0);
});
Clazz_defineMethod(c$, "loadImageData", 
function(image, nameOrError, echoName, sco){
var sc = sco;
if (image == null && nameOrError != null) this.scriptEcho(nameOrError);
if (echoName == null) {
this.setBackgroundImage((image == null ? null : nameOrError), image);
} else if (echoName.startsWith("\1")) {
this.sm.showImage(echoName, image);
} else if (echoName.startsWith("\0")) {
if (image != null) {
this.setWindowDimensions( Clazz_newFloatArray(-1, [this.apiPlatform.getImageWidth(image), this.apiPlatform.getImageHeight(image)]));
}} else {
this.shm.loadShape(31);
this.setShapeProperty(31, "text", nameOrError);
if (image != null) this.setShapeProperty(31, "image", image);
}if (JV.Viewer.isJS && sc != null) {
sc.mustResumeEval = true;
this.eval.resumeEval(sc);
}return false;
}, "~O,~S,~S,~O");
Clazz_defineMethod(c$, "cd", 
function(dir){
if (dir == null) {
dir = ".";
} else if (dir.length == 0) {
this.setStringProperty("defaultDirectory", "");
dir = ".";
}dir = this.fm.getDefaultDirectory(dir + (dir.equals("=") ? "" : dir.endsWith("/") ? "X.spt" : "/X.spt"));
if (dir.length > 0) this.setStringProperty("defaultDirectory", dir);
var path = this.fm.getFilePath(dir + "/", true, false);
if (path.startsWith("file:/")) JV.FileManager.setLocalPath(this, dir, false);
return dir;
}, "~S");
Clazz_defineMethod(c$, "setErrorMessage", 
function(errMsg, errMsgUntranslated){
this.errorMessageUntranslated = errMsgUntranslated;
if (errMsg != null) this.eval.stopScriptThreads();
return (this.errorMessage = errMsg);
}, "~S,~S");
Clazz_overrideMethod(c$, "getErrorMessage", 
function(){
return this.errorMessage;
});
Clazz_overrideMethod(c$, "getErrorMessageUn", 
function(){
return this.errorMessageUntranslated == null ? this.errorMessage : this.errorMessageUntranslated;
});
Clazz_defineMethod(c$, "setShapeErrorState", 
function(shapeID, state){
this.currentShapeID = shapeID;
this.currentShapeState = state;
}, "~N,~S");
Clazz_defineMethod(c$, "getShapeErrorState", 
function(){
if (this.currentShapeID < 0) return "";
this.shm.releaseShape(this.currentShapeID);
this.clearRepaintManager(this.currentShapeID);
return JV.JC.getShapeClassName(this.currentShapeID, false) + " " + this.currentShapeState;
});
Clazz_defineMethod(c$, "handleError", 
function(er, doClear){
try {
if (doClear) this.zapMsg("" + er);
this.undoMoveAction(4165, -2);
if (JU.Logger.getLogLevel() == 0) JU.Logger.setLogLevel(4);
this.setCursor(0);
this.setBooleanPropertyTok("refreshing", 603979900, true);
this.fm.setPathForAllFiles("");
JU.Logger.error("vwr handling error condition: " + er + "  ");
this.notifyError("Error", "doClear=" + doClear + "; " + er, "" + er);
} catch (e1) {
try {
JU.Logger.error("Could not notify error " + er + ": due to " + e1);
} catch (er2) {
}
}
}, "Throwable,~B");
Clazz_defineMethod(c$, "getFunctions", 
function(isStatic){
return (isStatic ? JV.Viewer.staticFunctions : this.localFunctions);
}, "~B");
Clazz_defineMethod(c$, "removeFunction", 
function(name){
name = name.toLowerCase();
var $function = this.getFunction(name);
if ($function == null) return;
JV.Viewer.staticFunctions.remove(name);
this.localFunctions.remove(name);
}, "~S");
Clazz_defineMethod(c$, "getFunction", 
function(name){
if (name == null) return null;
var $function = (JV.Viewer.isStaticFunction(name) ? JV.Viewer.staticFunctions : this.localFunctions).get(name);
return ($function == null || $function.geTokens() == null ? null : $function);
}, "~S");
c$.isStaticFunction = Clazz_defineMethod(c$, "isStaticFunction", 
function(name){
return name.startsWith("static_");
}, "~S");
Clazz_defineMethod(c$, "isFunction", 
function(name){
return (JV.Viewer.isStaticFunction(name) ? JV.Viewer.staticFunctions : this.localFunctions).containsKey(name);
}, "~S");
Clazz_defineMethod(c$, "clearFunctions", 
function(){
JV.Viewer.staticFunctions.clear();
this.localFunctions.clear();
});
Clazz_defineMethod(c$, "addFunction", 
function($function){
var name = $function.getName();
(JV.Viewer.isStaticFunction(name) ? JV.Viewer.staticFunctions : this.localFunctions).put(name, $function);
}, "J.api.JmolScriptFunction");
Clazz_defineMethod(c$, "getFunctionCalls", 
function(selectedFunction){
return this.getStateCreator().getFunctionCalls(selectedFunction);
}, "~S");
Clazz_defineMethod(c$, "checkPrivateKey", 
function(privateKey){
return privateKey == this.privateKey;
}, "~N");
Clazz_defineMethod(c$, "bindAction", 
function(desc, name){
if (this.haveDisplay) this.acm.bind(desc, name);
}, "~S,~S");
Clazz_defineMethod(c$, "unBindAction", 
function(desc, name){
if (this.haveDisplay) this.acm.unbindAction(desc, name);
}, "~S,~S");
Clazz_defineMethod(c$, "calculateStruts", 
function(bs1, bs2){
return this.ms.calculateStruts(bs1 == null ? this.bsA() : bs1, bs2 == null ? this.bsA() : bs2);
}, "JU.BS,JU.BS");
Clazz_defineMethod(c$, "getPreserveState", 
function(){
return (this.g.preserveState && this.scm != null);
});
Clazz_defineMethod(c$, "isKiosk", 
function(){
return this.$isKiosk;
});
Clazz_defineMethod(c$, "hasFocus", 
function(){
return (this.haveDisplay && (this.$isKiosk || this.apiPlatform.hasFocus(this.display)));
});
Clazz_defineMethod(c$, "setFocus", 
function(){
if (this.haveDisplay && !this.apiPlatform.hasFocus(this.display)) this.apiPlatform.requestFocusInWindow(this.display);
});
Clazz_defineMethod(c$, "stopMinimization", 
function(){
if (this.minimizer != null) {
this.minimizer.setProperty("stop", null);
}});
Clazz_defineMethod(c$, "clearMinimization", 
function(){
if (this.minimizer != null) this.minimizer.setProperty("clear", null);
});
Clazz_defineMethod(c$, "getMinimizationInfo", 
function(){
return (this.minimizer == null ? "" : this.minimizer.getProperty("log", 0));
});
Clazz_defineMethod(c$, "checkMinimization", 
function(){
this.refreshMeasures(true);
if (!this.g.monitorEnergy) return;
try {
this.minimize(null, 0, 0, this.getFrameAtoms(), null, null, 0, 1);
} catch (e) {
if (Clazz_exceptionOf(e, Exception)){
} else {
throw e;
}
}
this.echoMessage(this.getP("_minimizationForceField") + " Energy = " + this.getP("_minimizationEnergy"));
});
Clazz_defineMethod(c$, "minimize", 
function(eval, steps, crit, bsSelected, bsFixed, bsInFrame, rangeFixed, flags){
var isSelectionExplicit = (bsSelected != null);
if (isSelectionExplicit) {
flags |= 2;
}var addHydrogen = (flags & 16) != 0;
var isModelkitCmd = (flags & 256) != 0;
var isSilent = (flags & 1) != 0;
var isQuick = (flags & 8) != 0;
var groupSelected = (flags & 64) != 0;
var selectedOnly = groupSelected || (flags & 32) != 0;
var isFixExplicit = (bsFixed != null);
if (this.isModelKitOpen()) this.setModelkitPropertySafely("constraint", null);
if (bsInFrame == null) bsInFrame = this.getFrameAtoms();
if (!isQuick && !addHydrogen && isSelectionExplicit && !isFixExplicit && !selectedOnly) {
var bs = JU.BSUtil.copy(bsInFrame);
bsFixed = JU.BSUtil.copy(bs);
bsFixed.andNot(bsSelected);
bsSelected = bs;
isFixExplicit = true;
}if (!isSelectionExplicit) {
bsSelected = this.getThisModelAtoms();
if (selectedOnly) bsSelected.and(this.bsA());
} else if (!isQuick) {
bsSelected.and(bsInFrame);
}if (bsSelected.isEmpty()) return;
var bsBasis = (isModelkitCmd || !selectedOnly ? JU.BSUtil.copy(this.ms.am[this.ms.at[bsSelected.nextSetBit(0)].mi].bsAsymmetricUnit) : null);
if (isModelkitCmd && bsBasis == null) {
this.scriptStatusMsg("MODELKIT MINIMIZE is only applicable to crystal structures.", "minimization: not a crystal structure");
return;
}try {
if (isModelkitCmd) {
this.getModelkit(false).cmdMinimize(eval, bsBasis, steps, crit, rangeFixed, flags);
return;
}var ff = (bsBasis == null ? this.g.forceField : "UFF");
this.getModelForAtomIndex(bsSelected.nextSetBit(0)).auxiliaryInfo.put("dimension", "3D");
if (isQuick) {
bsInFrame = bsSelected;
}var bsMotionFixed = JU.BSUtil.copy(isFixExplicit ? bsFixed : this.slm.getMotionFixedAtoms());
var haveFixed = !bsMotionFixed.isEmpty();
if (haveFixed) bsSelected.andNot(bsMotionFixed);
var bsNearby = (bsBasis != null && isModelkitCmd ? this.getThisModelAtoms() : selectedOnly || !haveFixed ?  new JU.BS() : this.ms.getAtomsWithinRadius((rangeFixed <= 0 ? 5.0 : rangeFixed), bsSelected, true, null, null));
bsNearby.andNot(bsSelected);
if (haveFixed) {
bsMotionFixed.and(bsNearby);
} else {
bsMotionFixed = bsNearby;
}bsMotionFixed.and(bsInFrame);
flags |= ((haveFixed ? 4 : 0) | (this.getBooleanProperty("minimizationSilent") ? 1 : 0));
if (isQuick && this.getBoolean(603979962)) return;
if (isQuick) {
{
try {
if (!isSilent) JU.Logger.info("Minimizing " + bsSelected.cardinality() + " atoms");
this.getMinimizer(true).minimize(steps, crit, bsSelected, bsMotionFixed, null, flags, "UFF");
} catch (e) {
if (Clazz_exceptionOf(e, Exception)){
JU.Logger.error("Minimization error: " + e.toString());
e.printStackTrace();
} else {
throw e;
}
}
}}if (addHydrogen) {
var bsH = this.addHydrogens(bsSelected, flags);
if (!isQuick) bsSelected.or(bsH);
}var n = bsSelected.cardinality();
if (ff.equals("MMFF") && n > this.g.minimizationMaxAtoms) {
this.scriptStatusMsg("Too many atoms for minimization (" + n + ">" + this.g.minimizationMaxAtoms + "); use 'set minimizationMaxAtoms' to increase this limit", "minimization: too many atoms");
return;
}if (groupSelected) {
bsMotionFixed.or(this.ms.getConnectingAtoms(bsSelected, bsMotionFixed));
bsSelected.andNot(bsMotionFixed);
}if (!isSilent) JU.Logger.info("Minimizing " + bsSelected.cardinality() + " atoms");
this.getMinimizer(true).minimize(steps, crit, bsSelected, bsMotionFixed, bsBasis, flags, (isQuick ? "MMFF" : ff));
if (isQuick) {
this.g.forceField = "MMFF";
this.setHydrogens(bsSelected);
var ffUsed = this.getMinimizer(false).getForceFieldUsed();
if (ffUsed != null) this.showString("Minimized by Jmol using " + ffUsed, false);
}} catch (e$$) {
if (Clazz_exceptionOf(e$$,"JV.JmolAsyncException")){
var e = e$$;
{
if (eval != null) eval.loadFileResourceAsync(e.getFileName());
}
} else if (Clazz_exceptionOf(e$$, Exception)){
var e = e$$;
{
JU.Logger.error("Minimization error: " + e.toString());
e.printStackTrace();
}
} else {
throw e$$;
}
}
}, "J.api.JmolScriptEvaluator,~N,~N,JU.BS,JU.BS,JU.BS,~N,~N");
Clazz_defineMethod(c$, "setHydrogens", 
function(bsAtoms){
var nTotal =  Clazz_newIntArray (1, 0);
var hatoms = this.ms.calculateHydrogens(bsAtoms, nTotal, null, 2056);
for (var i = bsAtoms.nextSetBit(0); i >= 0; i = bsAtoms.nextSetBit(i + 1)) {
var pts = hatoms[i];
if (pts == null || pts.length == 0) continue;
var a = this.ms.at[i];
var b = a.bonds;
for (var j = 0, pt = 0, n = a.getBondCount(); j < n; j++) {
var h = b[j].getOtherAtom(a);
if (h.getAtomicAndIsotopeNumber() == 1) {
var p = pts[pt++];
if (p != null) this.ms.setAtomCoord(h.i, p.x, p.y, p.z);
}}
}
this.ms.resetMolecules();
}, "JU.BS");
Clazz_defineMethod(c$, "setMotionFixedAtoms", 
function(bs){
this.slm.setMotionFixedAtoms(bs);
}, "JU.BS");
Clazz_defineMethod(c$, "setMotionFixed", 
function(bs){
this.slm.setMotionFixedAtoms(bs);
}, "JU.BS");
Clazz_defineMethod(c$, "getMotionFixedAtoms", 
function(sym, bsFixed){
if (this.am.cmi < 0) return  new JU.BS();
if (bsFixed == null) bsFixed =  new JU.BS();
bsFixed.or(this.slm.getMotionFixedAtoms());
bsFixed.and(this.getThisModelAtoms());
if (sym == null) sym = this.getOperativeSymmetry();
if (sym != null && this.getModelkit(false) != null) this.modelkit.addLockedAtoms(sym, bsFixed);
return bsFixed;
}, "J.api.SymmetryInterface,JU.BS");
Clazz_defineMethod(c$, "getAtomicPropertyState", 
function(commands, type, bs, name, data){
this.getStateCreator().getAtomicPropertyStateBuffer(commands, type, bs, name, data);
}, "JU.SB,~N,JU.BS,~S,~A");
Clazz_defineMethod(c$, "getCenterAndPoints", 
function(atomSets, addCenter){
return this.ms.getCenterAndPoints(atomSets, addCenter);
}, "JU.Lst,~B");
Clazz_defineMethod(c$, "writeFileData", 
function(fileName, type, modelIndex, parameters){
return this.getOutputManager().writeFileData(fileName, type, modelIndex, parameters);
}, "~S,~S,~N,~A");
Clazz_defineMethod(c$, "getPdbData", 
function(modelIndex, type, bsAtoms, parameters, oc, getStructure){
return this.getPropertyManager().getPdbData(modelIndex, type, bsAtoms == null ? this.bsA() : bsAtoms, parameters, oc, getStructure);
}, "~N,~S,JU.BS,~A,JU.OC,~B");
Clazz_defineMethod(c$, "getGroupsWithin", 
function(nResidues, bs){
return this.ms.getGroupsWithin(nResidues, bs);
}, "~N,JU.BS");
Clazz_defineMethod(c$, "setShapeSize", 
function(shapeID, madOrMad10, bsSelected){
if (bsSelected == null) bsSelected = this.bsA();
this.shm.setShapeSizeBs(shapeID, madOrMad10, null, bsSelected);
}, "~N,~N,JU.BS");
Clazz_defineMethod(c$, "setShapeProperty", 
function(shapeID, propertyName, value){
if (shapeID >= 0) this.shm.setShapePropertyBs(shapeID, propertyName, value, null);
}, "~N,~S,~O");
Clazz_defineMethod(c$, "getShapeProperty", 
function(shapeType, propertyName){
return this.shm.getShapePropertyIndex(shapeType, propertyName, -2147483648);
}, "~N,~S");
Clazz_defineMethod(c$, "getShapePropertyAsInt", 
function(shapeID, propertyName){
var value = this.getShapeProperty(shapeID, propertyName);
return value == null || !(Clazz_instanceOf(value, Integer)) ? -2147483648 : (value).intValue();
}, "~N,~S");
Clazz_defineMethod(c$, "setModelVisibility", 
function(){
if (this.shm != null) this.shm.setModelVisibility(null);
});
Clazz_defineMethod(c$, "resetShapes", 
function(andCreateNew){
this.shm.resetShapes(!andCreateNew);
if (andCreateNew) {
this.shm.loadDefaultShapes(this.ms);
this.clearRepaintManager(-1);
}}, "~B");
Clazz_defineMethod(c$, "setParallel", 
function(TF){
return (this.$isParallel = this.g.multiProcessor && TF);
}, "~B");
Clazz_defineMethod(c$, "isParallel", 
function(){
return this.g.multiProcessor && this.$isParallel;
});
Clazz_defineMethod(c$, "undoMoveAction", 
function(action, n){
return (this.g.preserveState ? this.getStateCreator().undoMoveAction(action, n) : 0);
}, "~N,~N");
Clazz_defineMethod(c$, "undoMoveActionClear", 
function(taintedAtom, type, clearRedo){
if (this.g.preserveState && this.getOperativeSymmetry() == null) this.getStateCreator().undoMoveActionClear(taintedAtom, type, clearRedo);
}, "~N,~N,~B");
Clazz_defineMethod(c$, "moveAtomWithHydrogens", 
function(atomIndex, deltaX, deltaY, deltaZ, ptNew, bsAtoms){
this.stopMinimization();
var modelkitNoAddH = (ptNew != null && deltaX == 0);
var atom = this.ms.at[atomIndex];
if (bsAtoms == null) {
bsAtoms = JU.BSUtil.newAndSetBit(atomIndex);
var addH = (this.getOperativeSymmetry() == null || this.isModelKitOpen() && !this.modelkit.hasConstraint(atomIndex, true, false));
if (addH && !modelkitNoAddH) this.ms.addConnectedHAtoms(atom, bsAtoms);
}return this.moveSelected(deltaX, deltaY, deltaZ, -2147483648, -2147483648, bsAtoms, atom, ptNew, true, true, 0);
}, "~N,~N,~N,~N,JU.P3,JU.BS");
Clazz_defineMethod(c$, "isModelPDB", 
function(i){
return this.ms.am[i].isBioModel;
}, "~N");
Clazz_overrideMethod(c$, "deleteMeasurement", 
function(i){
this.setShapeProperty(6, "delete", Integer.$valueOf(i));
}, "~N");
Clazz_overrideMethod(c$, "getSmiles", 
function(bs){
return this.getSmilesOpt(bs, -1, -1, 16 | (bs == null && JU.Logger.debugging ? 131072 : 0), null);
}, "JU.BS");
Clazz_overrideMethod(c$, "getOpenSmiles", 
function(bs){
return this.getSmilesOpt(bs, -1, -1, 5 | (bs == null && JU.Logger.debugging ? 131072 : 0), "/open///");
}, "JU.BS");
Clazz_defineMethod(c$, "getBioSmiles", 
function(bs){
return this.getSmilesOpt(bs, -1, -1, 3145728 | 5242880 | 17825792 | (JU.Logger.debugging ? 131072 : 0), null);
}, "JU.BS");
Clazz_defineMethod(c$, "getSmilesOpt", 
function(bsSelected, index1, index2, flags, options){
var bioComment = ((flags & 17825792) == 17825792 ? JV.Viewer.getJmolVersion() + " " + this.getModelName(this.am.cmi) : options);
var atoms = this.ms.at;
if (bsSelected == null) {
if (index1 < 0 || index2 < 0) {
bsSelected = this.bsA();
} else {
if ((flags & 1048576) == 1048576) {
if (index1 > index2) {
var i = index1;
index1 = index2;
index2 = i;
}index1 = atoms[index1].group.firstAtomIndex;
index2 = atoms[index2].group.lastAtomIndex;
}bsSelected =  new JU.BS();
bsSelected.setBits(index1, index2 + 1);
}}flags |= (this.isModel2D(bsSelected) ? 134217728 : 0);
var sm = this.getSmilesMatcher();
if (JV.JC.isSmilesCanonical(options)) {
var smiles = sm.getSmiles(atoms, this.ms.ac, bsSelected, "/noAromatic/", flags);
return this.getChemicalInfo(smiles, "smiles", null).trim();
}return sm.getSmiles(atoms, this.ms.ac, bsSelected, bioComment, flags);
}, "JU.BS,~N,~N,~N,~S");
Clazz_defineMethod(c$, "isModel2D", 
function(bs){
var m = this.getModelForAtomIndex(bs.nextSetBit(0));
return (m != null && "2D".equals(m.auxiliaryInfo.get("dimension")));
}, "JU.BS");
Clazz_defineMethod(c$, "alert", 
function(msg){
this.prompt(msg, null, true);
}, "~S");
Clazz_defineMethod(c$, "prompt", 
function(label, data, asButtons){
try {
return this.promptButtons(label, data, null, asButtons);
} catch (e) {
if (Clazz_exceptionOf(e, Exception)){
return null;
} else {
throw e;
}
}
}, "~S,~S,~B");
Clazz_defineMethod(c$, "promptButtons", 
function(label, data, list, asButtons){
return (this.$isKiosk ? "null" : this.apiPlatform.prompt(label, data, list, asButtons));
}, "~S,~S,~A,~B");
Clazz_defineMethod(c$, "dialogAsk", 
function(type, fileName, params){
{
return prompt(type, fileName);
}}, "~S,~S,java.util.Map");
Clazz_defineMethod(c$, "initializeExporter", 
function(params){
var isJS = params.get("type").equals("JS");
if (isJS) {
if (this.jsExporter3D != null) {
this.jsExporter3D.initializeOutput(this, this.privateKey, params);
return this.jsExporter3D;
}} else {
var fileName = params.get("fileName");
var fullPath = params.get("fullPath");
var out = this.getOutputChannel(fileName, fullPath);
if (out == null) return null;
params.put("outputChannel", out);
}var export3D = J.api.Interface.getOption("export.Export3D", this, "export");
if (export3D == null) return null;
var exporter = export3D.initializeExporter(this, this.privateKey, this.gdata, params);
if (isJS && exporter != null) this.jsExporter3D = export3D;
return (exporter == null ? null : export3D);
}, "java.util.Map");
Clazz_defineMethod(c$, "getMouseEnabled", 
function(){
return this.refreshing && !this.creatingImage;
});
Clazz_overrideMethod(c$, "calcAtomsMinMax", 
function(bs, boxInfo){
this.ms.calcAtomsMinMax(bs, boxInfo);
}, "JU.BS,JU.BoxInfo");
Clazz_defineMethod(c$, "getObjectMap", 
function(map, c){
switch ((c).charCodeAt(0)) {
case 123:
if (this.getScriptManager() != null) {
var m = map;
if (this.definedAtomSets != null) m.putAll(this.definedAtomSets);
JS.T.getTokensType(m, 2097152);
}return;
case 36:
case 48:
this.shm.getObjectMap(map, c == '$');
return;
}
}, "java.util.Map,~S");
Clazz_defineMethod(c$, "setPicked", 
function(atomIndex, andReset){
var pickedSet = null;
var pickedList = null;
if (atomIndex >= 0) {
if (andReset) this.setPicked(-1, false);
this.g.setI("_atompicked", atomIndex);
pickedSet = this.g.getParam("picked", true);
pickedList = this.g.getParam("pickedList", true);
}if (pickedSet == null || pickedSet.tok != 10) {
pickedSet = JS.SV.newV(10,  new JU.BS());
pickedList = JS.SV.getVariableList( new JU.Lst());
this.g.setUserVariable("picked", pickedSet);
this.g.setUserVariable("pickedList", pickedList);
}if (atomIndex < 0) return;
JS.SV.getBitSet(pickedSet, false).set(atomIndex);
var p = pickedList.pushPop(null, null);
if (p.tok == 10) pickedList.pushPop(null, p);
if (p.tok != 10 || !(p.value).get(atomIndex)) pickedList.pushPop(null, JS.SV.newV(10, JU.BSUtil.newAndSetBit(atomIndex)));
}, "~N,~B");
Clazz_overrideMethod(c$, "runScript", 
function(script){
return "" + this.evaluateExpression( Clazz_newArray(-1, [ Clazz_newArray(-1, [JS.T.tokenScript, JS.T.tokenLeftParen, JS.SV.newS(script), JS.T.tokenRightParen])]));
}, "~S");
Clazz_overrideMethod(c$, "runScriptCautiously", 
function(script){
var outputBuffer =  new JU.SB();
try {
if (this.getScriptManager() == null) return null;
this.eval.runScriptBuffer(script, outputBuffer, false);
} catch (e) {
if (Clazz_exceptionOf(e, Exception)){
return this.eval.getErrorMessage();
} else {
throw e;
}
}
return outputBuffer.toString();
}, "~S");
Clazz_defineMethod(c$, "setFrameDelayMs", 
function(millis){
this.ms.setFrameDelayMs(millis, this.getVisibleFramesBitSet());
}, "~N");
Clazz_defineMethod(c$, "getBaseModelBitSet", 
function(){
return this.ms.getModelAtomBitSetIncludingDeleted(this.getJDXBaseModelIndex(this.am.cmi), true);
});
Clazz_defineMethod(c$, "clearTimeouts", 
function(){
if (this.timeouts != null) J.thread.TimeoutThread.clear(this.timeouts);
});
Clazz_defineMethod(c$, "setTimeout", 
function(name, mSec, script){
if (!this.haveDisplay || this.headless || this.autoExit) return;
if (name == null) {
this.clearTimeouts();
return;
}if (this.timeouts == null) {
this.timeouts =  new java.util.Hashtable();
}J.thread.TimeoutThread.setTimeout(this, this.timeouts, name, mSec, script);
}, "~S,~N,~S");
Clazz_defineMethod(c$, "triggerTimeout", 
function(name){
if (!this.haveDisplay || this.timeouts == null) return;
J.thread.TimeoutThread.trigger(this.timeouts, name);
}, "~S");
Clazz_defineMethod(c$, "clearTimeout", 
function(name){
this.setTimeout(name, 0, null);
}, "~S");
Clazz_defineMethod(c$, "showTimeout", 
function(name){
return (this.haveDisplay ? J.thread.TimeoutThread.showTimeout(this.timeouts, name) : "");
}, "~S");
Clazz_defineMethod(c$, "getOrCalcPartialCharges", 
function(bsSelected, bsIgnore){
if (bsSelected == null) bsSelected = this.bsA();
bsSelected = JU.BSUtil.copy(bsSelected);
JU.BSUtil.andNot(bsSelected, bsIgnore);
JU.BSUtil.andNot(bsSelected, this.ms.bsPartialCharges);
if (!bsSelected.isEmpty()) this.calculatePartialCharges(bsSelected);
return this.ms.getPartialCharges();
}, "JU.BS,JU.BS");
Clazz_defineMethod(c$, "calculatePartialCharges", 
function(bsSelected){
if (bsSelected == null || bsSelected.isEmpty()) bsSelected = this.getFrameAtoms();
if (bsSelected.isEmpty()) return;
JU.Logger.info("Calculating MMFF94 partial charges for " + bsSelected.cardinality() + " atoms");
this.getMinimizer(true).calculatePartialCharges(this.ms, bsSelected, null);
}, "JU.BS");
Clazz_defineMethod(c$, "setCurrentModelID", 
function(id){
var modelIndex = this.am.cmi;
if (modelIndex >= 0) this.ms.setInfo(modelIndex, "modelID", id);
}, "~S");
Clazz_defineMethod(c$, "cacheClear", 
function(){
this.fm.cacheClear();
this.ligandModelSet = null;
this.ligandModels = null;
this.ms.clearCache();
this.cm.ce.clearCache();
});
Clazz_defineMethod(c$, "cachePut", 
function(key, data){
JU.Logger.info("Viewer cachePut " + key);
this.fm.cachePut(key, data);
}, "~S,~O");
Clazz_defineMethod(c$, "cacheFileByName", 
function(fileName, isAdd){
if (fileName == null) {
this.cacheClear();
return -1;
}return this.fm.cacheFileByNameAdd(fileName, isAdd);
}, "~S,~B");
Clazz_defineMethod(c$, "clearThreads", 
function(){
if (this.eval != null) this.eval.stopScriptThreads();
this.stopMinimization();
this.tm.clearThreads();
this.setAnimationOn(false);
});
Clazz_defineMethod(c$, "getEvalContextAndHoldQueue", 
function(eval){
if (eval == null || !(JV.Viewer.isJS || this.testAsync)) return null;
eval.pushContextDown("getEvalContextAndHoldQueue");
var sc = eval.getThisContext();
sc.setMustResume();
sc.isJSThread = true;
this.queueOnHold = true;
return sc;
}, "J.api.JmolScriptEvaluator");
Clazz_defineMethod(c$, "getDefaultPropertyParam", 
function(propertyID){
return this.getPropertyManager().getDefaultPropertyParam(propertyID);
}, "~N");
Clazz_defineMethod(c$, "getPropertyNumber", 
function(name){
return this.getPropertyManager().getPropertyNumber(name);
}, "~S");
Clazz_defineMethod(c$, "checkPropertyParameter", 
function(name){
return this.getPropertyManager().checkPropertyParameter(name);
}, "~S");
Clazz_defineMethod(c$, "extractProperty", 
function(property, args, pt){
return this.getPropertyManager().extractProperty(property, args, pt, null, false);
}, "~O,~O,~N");
Clazz_defineMethod(c$, "addHydrogens", 
function(bsAtoms, flags){
var isSilent = ((flags & 1) == 1);
var isQuick = ((flags & 8) == 8);
var doAll = (bsAtoms == null);
if (bsAtoms == null) bsAtoms = this.getModelUndeletedAtomsBitSet(this.getVisibleFramesBitSet().length() - 1);
var bsB =  new JU.BS();
if (bsAtoms.isEmpty()) return bsB;
var vConnections =  new JU.Lst();
var pts = this.getAdditionalHydrogens(bsAtoms, vConnections, flags | (doAll ? 256 : 0));
var wasAppendNew = false;
wasAppendNew = this.g.appendNew;
if (pts.length > 0) {
this.clearModelDependentObjects();
try {
bsB = (isQuick && vConnections.get(0).mi == this.ms.mc - 1 ? this.ms.addHydrogens(vConnections, pts) : this.addHydrogensInline(bsAtoms, vConnections, pts, null));
this.setModelkitPropertySafely("updateatomkeys", bsAtoms);
} catch (e) {
if (Clazz_exceptionOf(e, Exception)){
System.out.println(e.toString());
} else {
throw e;
}
}
if (wasAppendNew) this.g.appendNew = true;
}if (!isSilent) this.scriptStatus(J.i18n.GT.i(J.i18n.GT.$("{0} hydrogens added"), pts.length));
return bsB;
}, "JU.BS,~N");
Clazz_defineMethod(c$, "addHydrogensInline", 
function(bsAtoms, vConnections, pts, htParams){
if (this.getScriptManager() == null) return null;
return this.scm.addHydrogensInline(bsAtoms, vConnections, pts, htParams);
}, "JU.BS,JU.Lst,~A,java.util.Map");
Clazz_overrideMethod(c$, "evalFunctionFloat", 
function(func, params, values){
return (this.getScriptManager() == null ? 0 : this.eval.evalFunctionFloat(func, params, values));
}, "~O,~O,~A");
Clazz_defineMethod(c$, "evalParallel", 
function(context, shapeManager){
this.displayLoadErrors = false;
var isOK = this.getScriptManager() != null && this.eval.evalParallel(context, (shapeManager == null ? this.shm : shapeManager));
this.displayLoadErrors = true;
return isOK;
}, "JS.ScriptContext,JV.ShapeManager");
Clazz_overrideMethod(c$, "evaluateExpression", 
function(stringOrTokens){
return (this.getScriptManager() == null ? null : this.eval.evaluateExpression(stringOrTokens, false, false));
}, "~O");
Clazz_overrideMethod(c$, "evaluateExpressionAsVariable", 
function(stringOrTokens){
return (this.getScriptManager() == null ? null : this.eval.evaluateExpression(stringOrTokens, true, false));
}, "~O");
Clazz_defineMethod(c$, "getAtomBitSet", 
function(atomExpression){
if (Clazz_instanceOf(atomExpression,"JU.BS")) return this.slm.excludeAtoms(atomExpression, false);
this.getScriptManager();
return this.getAtomBitSetEval(this.eval, atomExpression);
}, "~O");
Clazz_defineMethod(c$, "getScriptContext", 
function(why){
return (this.getScriptManager() == null ? null : this.eval.getScriptContext(why));
}, "~S");
Clazz_defineMethod(c$, "getAtomDefs", 
function(names){
var keys =  new JU.Lst();
for (var e, $e = names.entrySet().iterator (); $e.hasNext()&& ((e = $e.next ()) || true);) if (Clazz_instanceOf(e.getValue(),"JU.BS")) keys.addLast("{" + e.getKey() + "} <" + (e.getValue()).cardinality() + " atoms>\n");

var n = keys.size();
var k =  new Array(n);
keys.toArray(k);
java.util.Arrays.sort(k);
var sb =  new JU.SB();
for (var i = 0; i < n; i++) sb.append(k[i]);

return sb.append("\n").toString();
}, "java.util.Map");
Clazz_defineMethod(c$, "setCGO", 
function(map){
this.shm.loadShape(23);
this.shm.setShapePropertyBs(23, "setCGO", map, null);
}, "java.util.Map");
Clazz_defineMethod(c$, "setModelSet", 
function(modelSet){
this.ms = this.mm.modelSet = modelSet;
}, "JM.ModelSet");
Clazz_defineMethod(c$, "setObjectProp", 
function(id, tokCommand){
this.getScriptManager();
if (id == null) id = "*";
return (this.eval == null ? null : this.eval.setObjectPropSafe(id, tokCommand));
}, "~S,~N");
Clazz_defineMethod(c$, "setDihedrals", 
function(dihedralList, bsBranches, rate){
if (bsBranches == null) bsBranches = this.ms.getBsBranches(dihedralList);
this.ms.setDihedrals(dihedralList, bsBranches, rate);
}, "~A,~A,~N");
Clazz_defineMethod(c$, "getChainID", 
function(id, isAssign){
var iboxed = this.chainMap.get(id);
if (iboxed != null) return iboxed.intValue();
var i = (id.charAt(0)).charCodeAt(0);
if (id.length > 1) {
i = 300 + this.chainList.size();
} else if ((isAssign || this.chainCaseSpecified) && 97 <= i && i <= 122) {
i += 159;
}if (i >= 256) {
iboxed = this.chainMap.get(id);
if (iboxed != null) return iboxed.intValue();
this.chainCaseSpecified = new Boolean (this.chainCaseSpecified | isAssign).valueOf();
this.chainList.addLast(id);
}iboxed = Integer.$valueOf(i);
this.chainMap.put(iboxed, id);
this.chainMap.put(id, iboxed);
return i;
}, "~S,~B");
Clazz_defineMethod(c$, "getChainIDStr", 
function(id){
return this.chainMap.get(Integer.$valueOf(id));
}, "~N");
Clazz_defineMethod(c$, "getScriptQueueInfo", 
function(){
return (this.scm != null && this.scm.isQueueProcessing() ? Boolean.TRUE : Boolean.FALSE);
});
Clazz_defineMethod(c$, "getNMRCalculation", 
function(){
return (this.nmrCalculation == null ? (this.nmrCalculation = J.api.Interface.getOption("quantum.NMRCalculation", this, "script")).setViewer(this) : this.nmrCalculation);
});
Clazz_defineMethod(c$, "getDistanceUnits", 
function(s){
if (s == null) s = this.getDefaultMeasurementLabel(2);
var pt = s.indexOf("//");
return (pt < 0 ? this.g.measureDistanceUnits : s.substring(pt + 2));
}, "~S");
Clazz_defineMethod(c$, "calculateFormalCharges", 
function(bs){
return this.ms.fixFormalCharges(bs == null ? this.bsA() : bs);
}, "JU.BS");
Clazz_defineMethod(c$, "setModulation", 
function(bs, isOn, t1, isQ){
if (isQ) this.g.setO("_modt", JU.Escape.eP(t1));
this.ms.setModulation(bs == null ? this.getAllAtoms() : bs, isOn, t1, isQ);
this.refreshMeasures(true);
}, "JU.BS,~B,JU.P3,~B");
Clazz_defineMethod(c$, "checkInMotion", 
function(state){
switch (state) {
case 0:
this.setTimeout("_SET_IN_MOTION_", 0, null);
break;
case 1:
if (!this.inMotion) this.setTimeout("_SET_IN_MOTION_", this.g.hoverDelayMs * 2, "!setInMotion");
break;
case 2:
this.setInMotion(true);
this.refresh(3, "timeoutThread set in motion");
break;
}
}, "~N");
Clazz_defineMethod(c$, "checkMotionRendering", 
function(tok){
if (!this.getInMotion(true) && !this.tm.spinOn && !this.tm.vibrationOn && !this.am.animationOn) return true;
if (this.g.wireframeRotation) return false;
var n = 0;
switch (tok) {
case 1677721602:
case 1153433601:
n = 2;
break;
case 1112150020:
n = 3;
break;
case 1112150021:
n = 4;
break;
case 1112152066:
n = 5;
break;
case 1073742018:
n = 6;
break;
case 1111490588:
n = 7;
break;
case 603979786:
n = 8;
break;
}
return this.g.platformSpeed >= n;
}, "~N");
Clazz_defineMethod(c$, "openExportChannel", 
function(privateKey, fileName, asWriter){
return this.getOutputManager().openOutputChannel(privateKey, fileName, asWriter, false);
}, "~N,~S,~B");
Clazz_overrideMethod(c$, "log", 
function(data){
if (data != null) this.getOutputManager().logToFile(data);
}, "~S");
Clazz_defineMethod(c$, "getLogFileName", 
function(){
return (this.logFileName == null ? "" : this.logFileName);
});
Clazz_defineMethod(c$, "getCommands", 
function(htDefine, htMore, select){
return this.getStateCreator().getCommands(htDefine, htMore, select);
}, "java.util.Map,java.util.Map,~S");
Clazz_defineMethod(c$, "allowCapture", 
function(){
return !this.isApplet || this.isSignedApplet;
});
Clazz_defineMethod(c$, "compileExpr", 
function(expr){
var o = (this.getScriptManager() == null ? null : this.eval.evaluateExpression(expr, false, true));
return (Clazz_instanceOf(o,Array) ? o :  Clazz_newArray(-1, [JS.T.o(4, expr)]));
}, "~S");
Clazz_defineMethod(c$, "checkSelect", 
function(h, value){
return this.getScriptManager() != null && this.eval.checkSelect(h, value);
}, "java.util.Map,~A");
Clazz_defineMethod(c$, "getAnnotationInfo", 
function(d, match, type){
return this.getAnnotationParser(type).getAnnotationInfo(this, d, match, type, this.am.cmi);
}, "JS.SV,~S,~N");
Clazz_defineMethod(c$, "getAtomValidation", 
function(type, atom){
return this.getAnnotationParser(1073742189).getAtomValidation(this, type, atom);
}, "~S,JM.Atom");
Clazz_defineMethod(c$, "dragMinimizeAtom", 
function(iAtom){
this.stopMinimization();
var flags = 0;
var sym = this.getOperativeSymmetry();
if (sym != null) {
flags = 256;
}var bs = (flags != 0 ? null : (this.getMotionFixedAtoms(sym, null).isEmpty() ? this.ms.getAtoms((this.ms.isAtomPDB(iAtom) ? 1086324742 : 1094713360), JU.BSUtil.newAndSetBit(iAtom)) : JU.BSUtil.setAll(this.ms.ac)));
try {
this.minimize(this.eval, 2147483647, 0, bs, null, null, 0, flags);
} catch (e) {
if (Clazz_exceptionOf(e, Exception)){
if (!this.async) return;
var me = this;
var r = ((Clazz_isClassDefined("JV.Viewer$1") ? 0 : JV.Viewer.$Viewer$1$ ()), Clazz_innerTypeInstance(JV.Viewer$1, this, Clazz_cloneFinals("me", me, "iAtom", iAtom)));
{
setTimeout(function(){r.run()}, 100);
}} else {
throw e;
}
}
}, "~N");
Clazz_defineMethod(c$, "getJBR", 
function(){
return (this.jbr == null ? this.jbr = (J.api.Interface.getInterface("JM.BioResolver", this, "file")).setViewer(this) : this.jbr);
});
Clazz_defineMethod(c$, "checkMenuUpdate", 
function(){
if (this.jmolpopup != null) this.jmolpopup.jpiUpdateComputedMenus();
});
Clazz_defineMethod(c$, "getChimeMessenger", 
function(){
return (this.jcm == null ? this.jcm = (J.api.Interface.getInterface("JV.ChimeMessenger", this, "script")).set(this) : this.jcm);
});
Clazz_defineMethod(c$, "getModelSetAuxiliaryInfoForAtoms", 
function(atomExpression){
return this.ms.getModelSetAuxiliaryInfo(this.ms.getModelBS(this.getAtomBitSet(atomExpression), false));
}, "~O");
Clazz_defineMethod(c$, "getJSJSONParser", 
function(){
return (this.jsonParser == null ? this.jsonParser = J.api.Interface.getInterface("JU.JSJSONParser", this, "script") : this.jsonParser);
});
Clazz_defineMethod(c$, "parseJSON", 
function(str){
return (str == null ? null : (str = str.trim()).startsWith("{") ? this.parseJSONMap(str) : this.parseJSONArray(str));
}, "~S");
Clazz_defineMethod(c$, "parseJSONMap", 
function(jsonMap){
return this.getJSJSONParser().parseMap(jsonMap, true);
}, "~S");
Clazz_defineMethod(c$, "parseJSONArray", 
function(jsonArray){
return this.getJSJSONParser().parse(jsonArray, true);
}, "~S");
Clazz_defineMethod(c$, "getSymTemp", 
function(){
return J.api.Interface.getSymmetry(this, "temp");
});
Clazz_defineMethod(c$, "getSymStatic", 
function(){
return (this.symStatic == null ? (this.symStatic = J.api.Interface.getSymmetry(this, "static")) : this.symStatic);
});
Clazz_defineMethod(c$, "setWindowDimensions", 
function(dims){
this.resizeInnerPanel(Clazz_floatToInt(dims[0]), Clazz_floatToInt(dims[1]));
}, "~A");
Clazz_defineMethod(c$, "getTriangulator", 
function(){
return (this.triangulator == null ? (this.triangulator = J.api.Interface.getUtil("Triangulator", this, "script")) : this.triangulator);
});
Clazz_defineMethod(c$, "getCurrentModelAuxInfo", 
function(){
return (this.am.cmi >= 0 ? this.ms.getModelAuxiliaryInfo(this.am.cmi) : null);
});
Clazz_defineMethod(c$, "connectNBO", 
function(type){
if (this.am.cmi < 0) return;
this.getNBOParser().connectNBO(this.am.cmi, type);
}, "~S");
Clazz_defineMethod(c$, "getNBOParser", 
function(){
return (this.nboParser == null ? this.nboParser = (J.api.Interface.getInterface("J.adapter.readers.quantum.NBOParser", this, "script")).set(this) : this.nboParser);
});
Clazz_defineMethod(c$, "getNBOAtomLabel", 
function(atom){
return this.getNBOParser().getNBOAtomLabel(atom);
}, "JM.Atom");
Clazz_defineMethod(c$, "calculateChirality", 
function(bsAtoms){
if (bsAtoms == null) bsAtoms = this.bsA();
return this.ms.calculateChiralityForAtoms(bsAtoms, true);
}, "JU.BS");
Clazz_defineMethod(c$, "getSubstructureSetArray", 
function(pattern, bsSelected, flags){
return this.getSmilesMatcher().getSubstructureSetArray(pattern, this.ms.at, this.ms.ac, bsSelected, null, flags);
}, "~O,JU.BS,~N");
Clazz_defineMethod(c$, "getSubstructureSetArrayForNodes", 
function(pattern, nodes, flags){
return this.getSmilesMatcher().getSubstructureSetArray(pattern, nodes, nodes.length, null, null, flags);
}, "~O,~A,~N");
Clazz_defineMethod(c$, "getSmilesAtoms", 
function(smiles){
return this.getSmilesMatcher().getAtoms(smiles);
}, "~S");
Clazz_defineMethod(c$, "calculateChiralityForSmiles", 
function(smiles){
try {
return J.api.Interface.getSymmetry(this, "smiles").calculateCIPChiralityForSmiles(smiles);
} catch (e) {
if (Clazz_exceptionOf(e, Exception)){
return null;
} else {
throw e;
}
}
}, "~S");
Clazz_defineMethod(c$, "getPdbID", 
function(){
return (this.ms.getInfo(this.am.cmi, JV.JC.getBoolName(4)) === Boolean.TRUE ? this.ms.getInfo(this.am.cmi, "pdbID") : null);
});
Clazz_defineMethod(c$, "getModelInfo", 
function(key){
return this.ms.getInfo(this.am.cmi, key);
}, "~S");
Clazz_defineMethod(c$, "notifyScriptEditor", 
function(msWalltime, data){
if (this.scriptEditor != null) {
this.scriptEditor.notify(msWalltime, data);
}}, "~N,~A");
Clazz_defineMethod(c$, "sendConsoleMessage", 
function(msg){
if (this.appConsole != null) this.appConsole.sendConsoleMessage(msg);
}, "~S");
Clazz_defineMethod(c$, "getModelkitPropertySafely", 
function(name){
return (this.modelkit == null ? null : name == null ? Boolean.TRUE : this.modelkit.getProperty(name));
}, "~S");
Clazz_defineMethod(c$, "setModelkitPropertySafely", 
function(key, value){
return (this.modelkit == null ? null : this.modelkit.setProperty(key, value));
}, "~S,~O");
Clazz_defineMethod(c$, "isModelKitOption", 
function(type, value){
return this.modelkit != null && this.modelkit.checkOption(type, value);
}, "~S,~S");
Clazz_defineMethod(c$, "getSymmetryInfo", 
function(iatom, xyz, iOp, translation, pt1, pt2, type, desc, scaleFactor, nth, options, opList){
try {
return this.getSymTemp().getSymmetryInfoAtom(this.ms, iatom, xyz, iOp, translation, pt1, pt2, desc, type, scaleFactor, nth, options, opList);
} catch (e) {
if (Clazz_exceptionOf(e, Exception)){
System.out.println("Exception in Viewer.getSymmetryInfo: " + e);
if (!JV.Viewer.isJS) e.printStackTrace();
return null;
} else {
throw e;
}
}
}, "~N,~S,~N,JU.P3,JU.P3,JU.P3,~N,~S,~N,~N,~N,~A");
Clazz_defineMethod(c$, "getMacro", 
function(key){
if (this.macros == null || this.macros.isEmpty()) {
try {
var s = this.getAsciiFileOrNull(this.g.macroDirectory + "/macros.json");
this.macros = this.parseJSON(s);
} catch (e) {
if (Clazz_exceptionOf(e, Exception)){
this.macros =  new java.util.Hashtable();
} else {
throw e;
}
}
}if (key == null) {
var s =  new JU.SB();
for (var k, $k = this.macros.keySet().iterator (); $k.hasNext()&& ((k = $k.next ()) || true);) {
var a = this.macros.get(k);
s.append(k).append("\t").appendO(a).append("\n");
}
return s.toString();
}key = key.toLowerCase();
return this.macros.containsKey(key) ? (this.macros.get(key)).get("path").toString() : null;
}, "~S");
Clazz_defineMethod(c$, "getConsoleFontScale", 
function(){
return this.consoleFontScale;
});
Clazz_defineMethod(c$, "setConsoleFontScale", 
function(scale){
this.consoleFontScale = scale;
}, "~N");
Clazz_defineMethod(c$, "confirm", 
function(msg, msgNo){
return this.apiPlatform.confirm(msg, msgNo);
}, "~S,~S");
Clazz_defineMethod(c$, "evalStringGUI", 
function(script){
this.evalStringQuiet(script + "; ## GUI ##");
}, "~S");
Clazz_defineMethod(c$, "selectStatus", 
function(bs, isGroup, addRemove, isQuiet, reportStatus){
this.select(bs, isGroup, addRemove, isQuiet);
if (reportStatus) {
this.setStatusSelect(bs);
}}, "JU.BS,~B,~N,~B,~B");
Clazz_defineMethod(c$, "setStatusSelect", 
function(bs){
this.hasSelected = false;
this.sm.setStatusSelect(bs == null ? this.bsA() : bs);
}, "JU.BS");
Clazz_defineMethod(c$, "wasmInchiHack", 
function(cmd){
if (JV.Viewer.isJS && (cmd.indexOf("inchi") >= 0 || cmd.indexOf("INCHI") >= 0) || cmd.indexOf("TAUTOMER") >= 0 || cmd.indexOf("tautomer") >= 0) {
this.getInchi(null, null, null);
}return cmd;
}, "~S");
Clazz_defineMethod(c$, "getInchi", 
function(atoms, molData, options){
try {
var inch = this.apiPlatform.getInChI();
if (atoms == null && molData == null) {
return "";
}if ((typeof(molData)=='string')) {
var data = molData;
if (data.startsWith("$") || data.startsWith(":")) {
molData = this.getFileAsString4(data, -1, false, false, true, "script");
} else if (!data.startsWith("InChI=") && data.indexOf(" ") < 0) {
data = this.setLoadFormat(false, "$" + molData, '$', false);
molData = this.getFileAsString4(data, -1, false, false, true, "script");
}}return inch.getInchi(this, atoms, molData, options);
} catch (t) {
return "";
}
}, "JU.BS,~O,~S");
Clazz_defineMethod(c$, "findSpaceGroup", 
function(sym, bsAtoms, xyzList, unitCellParams, origin, oabc, flags){
var ret = null;
if (bsAtoms == null && xyzList == null || (flags & 2) != 0) bsAtoms = this.getThisModelAtoms();
if (xyzList == null) {
if (!bsAtoms.isEmpty()) {
var uc = (sym == null ? this.getOperativeSymmetry() : sym);
ret = (uc == null ? null : uc.findSpaceGroup(bsAtoms, null, unitCellParams, null, oabc, flags));
}} else {
var symTemp = this.getSymTemp();
symTemp.setSpaceGroupTo(sym);
ret = symTemp.findSpaceGroup(bsAtoms, xyzList, unitCellParams, origin, oabc, flags);
}return (ret == null && (flags & 1) != 0 ? "" : ret);
}, "J.api.SymmetryInterface,JU.BS,~S,~A,JU.T3,~A,~N");
Clazz_defineMethod(c$, "restrictToModel", 
function(bs, mi){
if (bs == null) bs = this.bsA();
var isEmpty = bs.isEmpty();
if (isEmpty && mi >= 0) return bs;
if (mi == -1) mi = this.am.cmi;
if (mi < 0) {
if (isEmpty) {
return this.getThisModelAtoms();
}mi = this.ms.at[bs.nextSetBit(0)].getModelIndex();
}var bsm = this.getModelUndeletedAtomsBitSet(mi);
bsm.and(bs);
return bsm;
}, "JU.BS,~N");
Clazz_defineMethod(c$, "getThisModelAtoms", 
function(){
return this.getModelUndeletedAtomsBitSet(this.getVisibleFramesBitSet().nextSetBit(0));
});
Clazz_defineMethod(c$, "getSymmetryEquivPoints", 
function(pt, flags){
var uc = this.getCurrentUnitCell();
return (uc == null ?  new JU.Lst() : uc.getEquivPoints(pt, flags, 0));
}, "JU.Point3fi,~S");
Clazz_defineMethod(c$, "getSymmetryEquivPointList", 
function(pts, flags){
var uc = this.getCurrentUnitCell();
if (uc == null) return  new JU.Lst();
uc.getEquivPointList(0, flags.toLowerCase(), null, 0, pts, null);
return pts;
}, "JU.Lst,~S");
Clazz_defineMethod(c$, "getOperativeSymmetry", 
function(){
var sg = this.getCurrentUnitCell();
return (sg == null || sg.getSymmetryOperations() == null ? null : sg);
});
Clazz_defineMethod(c$, "formatText", 
function(text0){
var i;
if ((i = text0.indexOf("@{")) < 0 && (i = text0.indexOf("%{")) < 0) return text0;
var text = text0;
var isEscaped = (text.indexOf("\\") >= 0);
if (isEscaped) {
text = JU.PT.rep(text, "\\%", "\1");
text = JU.PT.rep(text, "\\@", "\2");
isEscaped = !text.equals(text0);
}text = JU.PT.rep(text, "%{", "@{");
var name;
while ((i = text.indexOf("@{")) >= 0) {
i++;
var i0 = i + 1;
var len = text.length;
var nP = 1;
var chFirst = '\u0000';
var chLast = '\u0000';
while (nP > 0 && ++i < len) {
var ch = text.charAt(i);
if (chFirst != '\0') {
if (chLast == '\\') {
ch = '\0';
} else if (ch == chFirst) {
chFirst = '\0';
}chLast = ch;
continue;
}switch ((ch).charCodeAt(0)) {
case 39:
case 34:
chFirst = ch;
break;
case 123:
nP++;
break;
case 125:
nP--;
break;
}
}
if (i >= len) return text;
name = text.substring(i0, i);
if (name.length == 0) return text;
var v = this.evaluateExpression(name);
if (Clazz_instanceOf(v,"JU.P3")) v = JU.Escape.eP(v);
text = text.substring(0, i0 - 2) + v.toString() + text.substring(i + 1);
}
if (isEscaped) {
text = JU.PT.rep(text, "\2", "@");
text = JU.PT.rep(text, "\1", "%");
}return text;
}, "~S");
Clazz_defineMethod(c$, "getScaleText", 
function(units, isAntialiased, min, ret){
var relativeScale = 1;
var u = JM.Measurement.fixUnits(units.length > 0 ? ((units.startsWith("//") ? units.substring(2) : units).toLowerCase()) : this.g.measureDistanceUnits.equals("vdw") ? "angstroms" : this.g.measureDistanceUnits);
if (JM.Measurement.fromUnits(1, u) == 0) {
u = JM.Measurement.fixUnits(this.g.measureDistanceUnits);
}if (ret == null) return u;
var d = this.tm.modelRadius * this.tm.scaleDefaultPixelsPerAngstrom / this.tm.scalePixelsPerAngstrom / 4;
var af = (isAntialiased ? 2 : 1);
var m = 0;
var p = 0;
var e = 0;
var mp = 0;
min = min * this.imageFontScaling / af * relativeScale * 2;
while (p < min) {
e = JM.Measurement.toUnits(d, u, false);
m = Clazz_doubleToInt(Math.floor(Math.log10(e)));
mp = Math.pow(10, m);
e = JM.Measurement.fromUnits(mp + 0.000001, u);
p = Clazz_floatToInt(e * this.tm.scalePixelsPerAngstrom / af);
if (p < min) {
d *= 10;
}}
var se = (m >= 0 ? " " + Clazz_floatToInt(mp) + " " : " 0." + "000000000".substring(0, -1 - m) + "1 ");
ret[0] = p;
ret[1] = e;
return se + u;
}, "~S,~B,~N,~A");
Clazz_defineMethod(c$, "setStatusAtomMoved", 
function(andCheckMinimize, bs){
if (andCheckMinimize) this.checkMinimization();
this.sm.setStatusAtomMoved(bs);
}, "~B,JU.BS");
Clazz_defineMethod(c$, "getFormulaForAtoms", 
function(bs, type, isEmpirical){
return JU.JmolMolecule.getMolecularFormulaAtoms(this.ms.at, bs, ("CELLFORMULA".equals(type) ? this.ms.getCellWeights(bs) : null), isEmpirical);
}, "JU.BS,~S,~B");
Clazz_defineMethod(c$, "evalCallback", 
function(cmd, params, doWait){
if (this.getScriptManager() != null) this.scm.evalCallback(cmd, params, doWait);
}, "~S,~A,~B");
Clazz_defineMethod(c$, "checkConsoleScript", 
function(strScript){
{
if (strScript.indexOf("JSCONSOLE") == 0) {
this.html5Applet._showInfo(strScript.indexOf("CLOSE")<0); if
(strScript.indexOf("CLEAR") >= 0)
this.html5Applet._clearConsole(); return true; }
}return false;
}, "~S");
Clazz_defineMethod(c$, "haveAccessInternal", 
function(path){
if (path == null) {
return this.access === JV.Viewer.ACCESS.INTERNAL;
}if (JV.Viewer.isJS) return true;
path = path.$replace('\\', '/');
var ret = this.access !== JV.Viewer.ACCESS.NONE && (this.internalAccessPath == null || this.access !== JV.Viewer.ACCESS.INTERNAL || path.startsWith(this.internalAccessPath));
if (!ret) System.err.println("Viewer: Internal file access in " + this.internalAccessPath + " denied for " + path);
return ret;
}, "~S");
Clazz_defineMethod(c$, "setAccessInternal", 
function(path){
if (JV.Viewer.isJS) return;
if (path == null) {
this.access = this.access0;
} else if (this.access !== JV.Viewer.ACCESS.INTERNAL) {
this.access = JV.Viewer.ACCESS.INTERNAL;
}this.internalAccessPath = path;
}, "~S");
Clazz_defineMethod(c$, "getItaNumberFor", 
function(name){
var s = this.getSymStatic().getSpaceGroupInfoObj("itaNumber", name, false, false);
return (s == null ? -1 : JU.PT.parseInt(s));
}, "~S");
Clazz_defineMethod(c$, "is2D", 
function(){
return this.getBoolean(603979882);
});
Clazz_defineMethod(c$, "getUnitCellCenter", 
function(){
var uc = this.getCurrentUnitCell();
return (uc == null ?  new JU.P3() : uc.getUnitCellCenter());
});
Clazz_defineMethod(c$, "setUnitCellAtomIndex", 
function(iAtom){
var sym = this.getCurrentUnitCell();
if (sym != null) sym.setOffsetPt( new JU.P3());
this.am.setUnitCellAtomIndex(iAtom);
}, "~N");
Clazz_defineMethod(c$, "getUnitCellAtomIndex", 
function(){
return this.am.getUnitCellAtomIndex();
});
Clazz_defineMethod(c$, "writeBinaryFile", 
function(fname, bytes){
var params =  new java.util.Hashtable();
var lst =  new JU.Lst();
lst.addLast(bytes);
params.put("imageData", lst);
params.put("fileName", fname);
params.put("type", "BINARY");
return this.getOutputManager().outputToFile(params);
}, "~S,~A");
Clazz_defineMethod(c$, "rotateModelSpinVectors", 
function(modelIndex, rot){
if (this.ms.vibrations == null) return;
if (modelIndex < 0) modelIndex = this.am.cmi;
if (modelIndex < 0 || modelIndex >= this.ms.mc) return;
if (rot == null) this.tm.setSpinOff();
var dataFrameIndex = this.ms.vib.rotateModelSpinVectors(this.ms, modelIndex, rot, false);
if (dataFrameIndex >= 0) this.updatePointGroup(modelIndex);
}, "~N,JU.M3");
Clazz_defineMethod(c$, "updatePointGroup", 
function(modelIndex){
if (true) return;
var script = this.ms.getUnitCell(-1 - modelIndex).updatePointGroup();
if (script != null) this.runScript(script);
}, "~N");
Clazz_defineMethod(c$, "rotateSpins", 
function(deltaX, deltaY){
if (this.ms.vib == null) return;
var m =  new JU.M3();
if (m.setAsBallRotation(0.017453292519943295, -deltaY, -deltaX)) {
var modelIndex = (this.am.splitFrame ? this.am.getSplitFrameModel() : this.am.cmi);
var dataFrameIndex = this.ms.vib.rotateModelSpinVectors(this.ms, modelIndex, m, true);
if (dataFrameIndex >= 0) this.updatePointGroup(modelIndex);
this.refresh(2, this.sm.syncingMouse ? "Mouse: rotateSpins " + deltaX + " " + deltaY : "");
}}, "~N,~N");
Clazz_defineMethod(c$, "setSelectionColors", 
function(colorSelected, colorUnselected, translucency, translucentLevel){
this.slm.setSelectionColors(colorSelected, colorUnselected, translucency, translucentLevel);
}, "Integer,Integer,~S,~N");
Clazz_defineMethod(c$, "plugin", 
function(service, action, options){
var ht =  new java.util.Hashtable();
ht.put("service", service);
ht.put("action", action);
ht.put("options", options);
this.sm.processService(ht);
return ht;
}, "~S,~S,~S");
Clazz_defineMethod(c$, "isPluginAtive", 
function(name){
return (this.pluginRequest(name, "isactive", null)).booleanValue();
}, "~S");
Clazz_defineMethod(c$, "startPlugin", 
function(name){
this.plugin(name, "start", null);
}, "~S");
Clazz_defineMethod(c$, "pluginRequest", 
function(name, action, value){
return this.sm.processPluginRequest(name, action, value);
}, "~S,~S,~O");
Clazz_defineMethod(c$, "getCurrentModelFile", 
function(fname, asBytes){
if (fname == null) fname = this.getParameter("_modelFile");
if (("" + fname).equals("null")) {
var s = this.ms.getInlineData(this.am.cmi);
return (!asBytes ? s : s.startsWith(";base64,") ? JU.Base64.decodeBase64(s) : s.getBytes());
}return (asBytes ? this.fm.getFileAsBytes(fname, null) : this.getFileAsString(fname));
}, "~S,~B");
Clazz_defineMethod(c$, "movetoHome", 
function(eval, secondsTotal){
this.moveTo(eval, secondsTotal, null, JV.JC.axisZ, 0, null, 100, 0, 0, 0, null, NaN, NaN, NaN, NaN, NaN, NaN);
}, "JS.ScriptEval,~N");
c$.$Viewer$1$=function(){
/*if5*/;(function(){
var c$ = Clazz_declareAnonymous(JV, "Viewer$1", null, Runnable);
Clazz_overrideMethod(c$, "run", 
function(){
this.f$.me.dragMinimizeAtom(this.f$.iAtom);
});
/*eoif5*/})();
};
/*if2*/;(function(){
var c$ = Clazz_declareType(JV.Viewer, "ACCESS", Enum);
Clazz_defineEnumConstant(c$, "NONE", 0, []);
Clazz_defineEnumConstant(c$, "READSPT", 1, []);
Clazz_defineEnumConstant(c$, "ALL", 2, []);
Clazz_defineEnumConstant(c$, "INTERNAL", 3, []);
/*eoif2*/})();
{
{
self.Jmol && Jmol.extend && Jmol.extend("vwr",
JV.Viewer.prototype);
}}c$.isJS = false;
c$.isSwingJS = false;
c$.isJmolSwingJS = false;
c$.appletDocumentBase = "";
c$.appletCodeBase = "";
c$.appletIdiomaBase = null;
c$.jsDocumentBase = "";
c$.jmolObject = null;
c$.strJavaVendor = "Java: " + System.getProperty("java.vendor", "j2s");
c$.strOSName = System.getProperty("os.name", "");
c$.strJavaVersion = "Java " + System.getProperty("java.version", "");
c$.version_date = null;
c$.staticFunctions =  new java.util.Hashtable();
c$.nProcessors = 1;
c$.isHighPrecision = false;
{
{
}}});
;//5.0.1-v7 Mon Aug 24 10:01:35 CDT 2026
Clazz_load(["java.util.AbstractMap", "$.AbstractSet", "$.Iterator", "$.Map", "$.MapEntry"], "java.util.HashMap", ["java.util.AbstractCollection", "$.Arrays", "java.util.MapEntry.Type"], function(){
var c$ = Clazz_decorateAsClass(function(){
this.elementCount = 0;
this.elementData = null;
this.loadFactor = 0;
this.threshold = 0;
this.modCount = 0;
this.$entrySet = null;
this.__m = null;
this.__allowJS = false;
Clazz_instantialize(this, arguments);}, java.util, "HashMap", java.util.AbstractMap, [java.util.Map, Cloneable, java.io.Serializable]);
Clazz_makeConstructor(c$, 
function(){
var size = 16;
var loadFactor = 0.75;
{
size = (arguments[0] || size); loadFactor = (arguments[1] ||
0.75);
}this.initHM(size, loadFactor);
});
Clazz_defineMethod(c$, "newElementArray", 
function(s){
return  new Array(s);
}, "~N");
Clazz_defineMethod(c$, "initHM", 
function(capacity, loadFactor){
var map = null;
{
if (typeof capacity == "object") { map = capacity; this.__allowJS =
map.__allowJS; capacity = (map.size() < 6 ? 11 : map.size() * 2); }
else { this.__allowJS = true; } !capacity && (capacity = 0);
!loadFactor && (loadFactor = 0.75);
}if (capacity == 0) capacity = 16;
if (capacity >= 0) {
this.elementCount = 0;
this.elementData = this.newElementArray(capacity == 0 ? 1 : capacity);
this.loadFactor = loadFactor;
this.computeMaxSize();
} else {
throw  new IllegalArgumentException();
}this.__setJS();
if (map != null) {
this.putAll(map);
}}, "~N,~N");
Clazz_defineMethod(c$, "putMapEntries", 
function(mOriginal, evict){
var n = mOriginal.size();
if (n == 0) return;
var key = null;
var value = null;
if (java.util.HashMap.__isSimple(this) && java.util.HashMap.__isSimple(mOriginal)) {
var me = this;
var hash = 0;
var mode = java.util.HashMap.__hasKey(me, key);
{
mOriginal.__m.forEach(function(value, key) {
me.putJSVal(hash, key, value, false, evict, mode);
});
}return;
}if (java.util.HashMap.__isSimple(mOriginal)) {
var me = this;
{
mOriginal.__m.forEach(function(value, key) {
me.putJavaValue(key, value);
});
}return;
}this.__m = null;
for (var e, $e = mOriginal.entrySet().iterator (); $e.hasNext()&& ((e = $e.next ()) || true);) {
key = e.getKey();
value = e.getValue();
this.putJavaValue(key, value);
}
}, "java.util.Map,~B");
Clazz_defineMethod(c$, "reinitialize", 
function(){
this.elementData = null;
this.$entrySet = null;
this.$keySet = null;
this.$values = null;
this.modCount = 0;
this.threshold = 0;
this.elementCount = 0;
this.__setJS();
});
Clazz_overrideMethod(c$, "clear", 
function(){
this.modCount++;
if (java.util.HashMap.__isSimple(this)) {
{
this.__m.clear();
}}this.__setJS();
if (this.elementCount > 0) {
this.elementCount = 0;
java.util.Arrays.fill(this.elementData, null);
this.modCount++;
}});
Clazz_defineMethod(c$, "clone", 
function(){
var result;
try {
result = Clazz_superCall(this, java.util.HashMap, "clone", []);
} catch (e) {
if (Clazz_exceptionOf(e,"CloneNotSupportedException")){
return null;
} else {
throw e;
}
}
result.reinitialize();
result.putMapEntries(this, false);
return result;
});
Clazz_defineMethod(c$, "computeMaxSize", 
function(){
this.threshold = Clazz_floatToInt(this.elementData.length * this.loadFactor);
});
Clazz_overrideMethod(c$, "containsKey", 
function(key){
switch (java.util.HashMap.__hasKey(this, key)) {
case 0:
break;
case 1:
java.util.HashMap.__ensureJavaMap(this);
break;
case 2:
return false;
case 3:
return true;
}
return (this.getJavaEntry(key) != null);
}, "~O");
Clazz_defineMethod(c$, "keysEqual", 
function(k1, entry){
var k1Hash = k1 == null ? 0 : k1.hashCode();
if (k1Hash != entry.origKeyHash) {
return false;
}if (k1 == null && entry.key == null) {
return true;
}return k1.equals(entry.key);
}, "~O,java.util.HashMap.Entry");
Clazz_overrideMethod(c$, "containsValue", 
function(value){
if (java.util.HashMap.__isSimple(this)) {
var m = this.__m;
{
var iter = m.values();
for (var n = iter.next(); !n.done; n = iter.next()) {
if (n.value == value || n.value.equals$O(value)) {
return true;
}
}
}} else if (value != null) {
for (var i = this.elementData.length; --i >= 0; ) {
var entry = this.elementData[i];
while (entry != null) {
if (value.equals(entry.value)) {
return true;
}entry = entry.next;
}
}
} else {
for (var i = this.elementData.length; --i >= 0; ) {
var entry = this.elementData[i];
while (entry != null) {
if (entry.value == null) {
return true;
}entry = entry.next;
}
}
}return false;
}, "~O");
Clazz_overrideMethod(c$, "entrySet", 
function(){
var es;
return (es = this.$entrySet) == null ? (this.$entrySet =  new java.util.HashMap.HashMapEntrySet(this)) : es;
});
Clazz_overrideMethod(c$, "get", 
function(key){
switch (java.util.HashMap.__hasKey(this, key)) {
case 0:
break;
case 1:
java.util.HashMap.__ensureJavaMap(this);
break;
case 2:
return null;
case 3:
var v = null;
{
v = this.__m.get(key);
}return v;
}
var m = this.getJavaEntry(key);
return (m == null ? null : m.value);
}, "~O");
Clazz_defineMethod(c$, "getJavaEntry", 
function(key){
var index = this.getModuloHash(key);
return this.findJavaEntry(key, index);
}, "~O");
Clazz_defineMethod(c$, "getModuloHash", 
function(key){
if (key == null) {
return 0;
}return (key.hashCode() & 0x7FFFFFFF) % this.elementData.length;
}, "~O");
Clazz_defineMethod(c$, "findJavaEntry", 
function(key, index){
var m;
m = this.elementData[index];
if (key != null) {
while (m != null && !this.keysEqual(key, m)) {
m = m.next;
}
} else {
while (m != null && m.key != null) {
m = m.next;
}
}return m;
}, "~O,~N");
Clazz_overrideMethod(c$, "isEmpty", 
function(){
return this.size() == 0;
});
Clazz_overrideMethod(c$, "keySet", 
function(){
if (this.$keySet == null) {
this.$keySet = ((Clazz_isClassDefined("java.util.HashMap$1") ? 0 : java.util.HashMap.$HashMap$1$ ()), Clazz_innerTypeInstance(java.util.HashMap$1, this, null));
}return this.$keySet;
});
Clazz_overrideMethod(c$, "put", 
function(key, value){
var type = java.util.HashMap.__hasKey(this, key);
switch (type) {
case 0:
break;
case 1:
java.util.HashMap.__ensureJavaMap(this);
break;
case 2:
case 3:
return this.putJSVal(1, key, value, false, true, type);
}
return this.putJavaValue(key, value);
}, "~O,~O");
Clazz_defineMethod(c$, "putJavaValue", 
function(key, value){
var index = this.getModuloHash(key);
var entry = this.findJavaEntry(key, index);
if (entry == null) {
this.modCount++;
if (++this.elementCount > this.threshold) {
this.rehash();
index = key == null ? 0 : (key.hashCode() & 0x7FFFFFFF) % this.elementData.length;
}entry = this.createEntry(key, index, value);
return null;
}var result = entry.value;
entry.value = value;
return result;
}, "~O,~O");
Clazz_defineMethod(c$, "createEntry", 
function(key, index, value){
var entry =  new java.util.HashMap.Entry(key, value);
entry.next = this.elementData[index];
this.elementData[index] = entry;
return entry;
}, "~O,~N,~O");
Clazz_overrideMethod(c$, "putAll", 
function(map){
if (!map.isEmpty()) for (var entry, $entry = map.entrySet().iterator (); $entry.hasNext()&& ((entry = $entry.next ()) || true);) {
this.put(entry.getKey(), entry.getValue());
}
}, "java.util.Map");
Clazz_defineMethod(c$, "putJSVal", 
function(hash, key, value, onlyIfAbsent, evict, mode){
var v0 = null;
switch (mode) {
case 2:
{
this.__m.set(key, value);
}++this.modCount;
break;
case 3:
if (hash != 0) {
{
v0 = this.__m.get(key) || null;
}}if (!onlyIfAbsent || v0 == null) {
{
this.__m.set(key, value);
}}break;
}
return v0;
}, "~N,~O,~O,~B,~B,~N");
Clazz_defineMethod(c$, "rehashImpl", 
function(capacity){
var length = (capacity == 0 ? 1 : capacity << 1);
var newData = this.newElementArray(length);
for (var i = 0; i < this.elementData.length; i++) {
var entry = this.elementData[i];
while (entry != null) {
var key = entry.key;
var index = key == null ? 0 : (key.hashCode() & 0x7FFFFFFF) % length;
var next = entry.next;
entry.next = newData[index];
newData[index] = entry;
entry = next;
}
}
this.elementData = newData;
this.computeMaxSize();
}, "~N");
Clazz_defineMethod(c$, "rehash", 
function(){
this.rehashImpl(this.elementData.length);
});
Clazz_overrideMethod(c$, "remove", 
function(key){
switch (java.util.HashMap.__hasKey(this, key)) {
case 0:
break;
case 1:
java.util.HashMap.__ensureJavaMap(this);
break;
case 2:
return null;
case 3:
return this.removeJSNode(1, key, null, false, true);
}
var entry = this.removeJavaEntry(key);
return (entry == null ? null : entry.value);
}, "~O");
Clazz_defineMethod(c$, "removeJSNode", 
function(hash, key, value, matchValue, movable){
var v = null;
if (hash == 1 || matchValue) {
{
v = this.__m.get(key) || null;
}}if (!matchValue || v === value || (value != null && value.equals(v))) {
{
this.__m["delete"](key);
}++this.modCount;
switch (hash) {
case 1:
return v;
case 3:
return "true";
}
}return null;
}, "~N,~O,~O,~B,~B");
Clazz_defineMethod(c$, "removeJavaEntry", 
function(key){
var index = 0;
var entry;
var last = null;
if (key != null) {
index = (key.hashCode() & 0x7FFFFFFF) % this.elementData.length;
entry = this.elementData[index];
while (entry != null && !this.keysEqual(key, entry)) {
last = entry;
entry = entry.next;
}
} else {
entry = this.elementData[0];
while (entry != null && entry.key != null) {
last = entry;
entry = entry.next;
}
}if (entry == null) {
return null;
}if (last == null) {
this.elementData[index] = entry.next;
} else {
last.next = entry.next;
}this.modCount++;
this.elementCount--;
return entry;
}, "~O");
Clazz_overrideMethod(c$, "size", 
function(){
{
if (this.__m)
return this.__m.size;
}return this.elementCount;
});
Clazz_overrideMethod(c$, "values", 
function(){
if (this.$values == null) {
this.$values = ((Clazz_isClassDefined("java.util.HashMap$2") ? 0 : java.util.HashMap.$HashMap$2$ ()), Clazz_innerTypeInstance(java.util.HashMap$2, this, null));
}return this.$values;
});
Clazz_defineMethod(c$, "__setJS", 
function(){
if (this.__allowJS && java.util.HashMap.USE_SIMPLE) {
var m = null;
{
m = new Map();
}this.__m = m;
} else {
this.__m = null;
}});
c$.__get = Clazz_defineMethod(c$, "__get", 
function(map, key){
{
return map.__m.get(key == null ? null : key + "");
}}, "~O,~O");
c$.__set = Clazz_defineMethod(c$, "__set", 
function(map, key, value){
{
map.__m.set(key == null ? null : key + "", value);
}}, "java.util.Map,~O,~O");
c$.__hasKey = Clazz_defineMethod(c$, "__hasKey", 
function(map, key){
{
return (!map.__m ? 0 : key != null && typeof key != "string" ? 1 :
map.__m.has(key) ? 3 : 2);
}}, "java.util.Map,~O");
c$.__isSimple = Clazz_defineMethod(c$, "__isSimple", 
function(map){
{
return !!map.__m;
}}, "java.util.Map");
c$.__ensureJavaMap = Clazz_defineMethod(c$, "__ensureJavaMap", 
function(map){
{
if (map.__m) { var m = map.__m; map.__m = null;
m.forEach(function(value, key){map.put(key, value);}); m.clear();
}
}}, "java.util.Map");
c$.$HashMap$1$=function(){
/*if5*/;(function(){
var c$ = Clazz_declareAnonymous(java.util, "HashMap$1", java.util.AbstractSet);
Clazz_overrideMethod(c$, "contains", 
function(object){
return this.b$["java.util.HashMap"].containsKey(object);
}, "~O");
Clazz_overrideMethod(c$, "size", 
function(){
return this.b$["java.util.HashMap"].size();
});
Clazz_overrideMethod(c$, "clear", 
function(){
this.b$["java.util.HashMap"].clear();
});
Clazz_overrideMethod(c$, "remove", 
function(key){
if (!this.b$["java.util.HashMap"].containsKey(key)) return false;
this.b$["java.util.HashMap"].remove(key);
return true;
}, "~O");
Clazz_overrideMethod(c$, "iterator", 
function(){
return  new java.util.HashMap.HashMapIterator(((Clazz_isClassDefined("java.util.HashMap$1$1") ? 0 : java.util.HashMap.$HashMap$1$1$ ()), Clazz_innerTypeInstance(java.util.HashMap$1$1, this, null)), this.b$["java.util.HashMap"]);
});
/*eoif5*/})();
};
c$.$HashMap$1$1$=function(){
/*if5*/;(function(){
var c$ = Clazz_declareAnonymous(java.util, "HashMap$1$1", null, java.util.MapEntry.Type);
Clazz_overrideMethod(c$, "get", 
function(entry){
if (java.util.HashMap.__isSimple(this.b$["java.util.HashMap"])) {
{
return (entry == null ? null : entry.value[0]);
}}return entry.key;
}, "java.util.MapEntry");
/*eoif5*/})();
};
c$.$HashMap$2$=function(){
/*if5*/;(function(){
var c$ = Clazz_declareAnonymous(java.util, "HashMap$2", java.util.AbstractCollection);
Clazz_overrideMethod(c$, "contains", 
function(object){
return this.b$["java.util.HashMap"].containsValue(object);
}, "~O");
Clazz_overrideMethod(c$, "size", 
function(){
return this.b$["java.util.HashMap"].size();
});
Clazz_overrideMethod(c$, "clear", 
function(){
this.b$["java.util.HashMap"].clear();
});
Clazz_overrideMethod(c$, "iterator", 
function(){
return  new java.util.HashMap.HashMapIterator(((Clazz_isClassDefined("java.util.HashMap$2$1") ? 0 : java.util.HashMap.$HashMap$2$1$ ()), Clazz_innerTypeInstance(java.util.HashMap$2$1, this, null)), this.b$["java.util.HashMap"]);
});
/*eoif5*/})();
};
c$.$HashMap$2$1$=function(){
/*if5*/;(function(){
var c$ = Clazz_declareAnonymous(java.util, "HashMap$2$1", null, java.util.MapEntry.Type);
Clazz_overrideMethod(c$, "get", 
function(entry){
if (java.util.HashMap.__isSimple(this.b$["java.util.HashMap"])) {
{
return (entry == null ? null : entry.value[1]);
}}return entry.value;
}, "java.util.MapEntry");
/*eoif5*/})();
};
/*if3*/;(function(){
var c$ = Clazz_decorateAsClass(function(){
this.origKeyHash = 0;
this.next = null;
Clazz_instantialize(this, arguments);}, java.util.HashMap, "Entry", java.util.MapEntry);
Clazz_makeConstructor(c$, 
function(theKey, theValue){
Clazz_superConstructor(this, java.util.HashMap.Entry, [theKey, theValue]);
this.origKeyHash = (theKey == null ? 0 : theKey.hashCode());
}, "~O,~O");
Clazz_defineMethod(c$, "clone", 
function(){
var entry = Clazz_superCall(this, java.util.HashMap.Entry, "clone", []);
if (this.next != null) {
entry.next = this.next.clone();
}return entry;
});
/*eoif3*/})();
/*if3*/;(function(){
var c$ = Clazz_decorateAsClass(function(){
this.jsMapIterator = null;
this.isSimple = false;
this.index = 0;
this.expectedModCount = 0;
this.type = null;
this.canRemove = false;
this.entry = null;
this.lastEntry = null;
this.associatedMap = null;
Clazz_instantialize(this, arguments);}, java.util.HashMap, "HashMapIterator", null, java.util.Iterator);
Clazz_makeConstructor(c$, 
function(value, hm){
this.associatedMap = hm;
this.type = value;
this.expectedModCount = hm.modCount;
this.lastEntry = this.entry = null;
this.isSimple = java.util.HashMap.__isSimple(this.associatedMap);
if (this.isSimple) {
var m = this.associatedMap.__m;
{
this.jsMapIterator = m.entries();
this.entry = this.jsMapIterator.next();
}}}, "java.util.MapEntry.Type,java.util.HashMap");
Clazz_overrideMethod(c$, "hasNext", 
function(){
if (this.isSimple) {
if (this.entry == null) {
return false;
}var isDone = false;
{
isDone = this.entry.done;
}return !isDone;
}if (this.entry != null) {
return true;
}while (this.index < this.associatedMap.elementData.length) {
if (this.associatedMap.elementData[this.index] == null) {
this.index++;
} else {
return true;
}}
return false;
});
Clazz_defineMethod(c$, "checkConcurrentMod", 
function(){
if (this.expectedModCount != this.associatedMap.modCount) {
throw  new java.util.ConcurrentModificationException();
}});
Clazz_overrideMethod(c$, "next", 
function(){
this.checkConcurrentMod();
if (!this.hasNext()) {
throw  new java.util.NoSuchElementException();
}var result = null;
if (this.isSimple) {
{
result = this.entry;
this.entry = this.jsMapIterator.next() || null;
}} else if (this.entry == null) {
result = this.lastEntry = this.associatedMap.elementData[this.index++];
this.entry = this.lastEntry.next;
} else {
if (this.lastEntry.next !== this.entry) {
this.lastEntry = this.lastEntry.next;
}result = this.entry;
this.entry = this.entry.next;
}this.canRemove = true;
return this.type.get(result);
});
Clazz_overrideMethod(c$, "remove", 
function(){
this.checkConcurrentMod();
if (!this.canRemove) {
throw  new IllegalStateException();
}this.canRemove = false;
this.associatedMap.modCount++;
if (this.lastEntry.next === this.entry) {
while (this.associatedMap.elementData[--this.index] == null) {
;}
this.associatedMap.elementData[this.index] = this.associatedMap.elementData[this.index].next;
this.entry = null;
} else {
this.lastEntry.next = this.entry;
}this.associatedMap.elementCount--;
this.expectedModCount++;
});
/*eoif3*/})();
/*if3*/;(function(){
var c$ = Clazz_decorateAsClass(function(){
this.associatedMap = null;
Clazz_instantialize(this, arguments);}, java.util.HashMap, "HashMapEntrySet", java.util.AbstractSet);
Clazz_makeConstructor(c$, 
function(hm){
Clazz_superConstructor (this, java.util.HashMap.HashMapEntrySet, []);
this.associatedMap = hm;
}, "java.util.HashMap");
Clazz_defineMethod(c$, "hashMap", 
function(){
return this.associatedMap;
});
Clazz_overrideMethod(c$, "size", 
function(){
return this.associatedMap.elementCount;
});
Clazz_overrideMethod(c$, "clear", 
function(){
this.associatedMap.clear();
});
Clazz_overrideMethod(c$, "remove", 
function(object){
if (this.contains(object)) {
this.associatedMap.remove((object).getKey());
return true;
}return false;
}, "~O");
Clazz_overrideMethod(c$, "contains", 
function(object){
if (!(Clazz_instanceOf(object,"java.util.Map.Entry"))) return false;
var key = (object).getKey();
if (!this.associatedMap.containsKey(key)) return false;
if (java.util.HashMap.__isSimple(this.associatedMap)) {
var value = (object).getValue();
var v = this.associatedMap.get(key);
return (value === v || value != null && value.equals(v));
}var entry = this.associatedMap.getJavaEntry((object).getKey());
return object.equals(entry);
}, "~O");
Clazz_overrideMethod(c$, "iterator", 
function(){
return  new java.util.HashMap.HashMapIterator(((Clazz_isClassDefined("java.util.HashMap$HashMapEntrySet$1") ? 0 : java.util.HashMap.HashMapEntrySet.$HashMap$HashMapEntrySet$1$ ()), Clazz_innerTypeInstance(java.util.HashMap$HashMapEntrySet$1, this, null)), this.associatedMap);
});
c$.$HashMap$HashMapEntrySet$1$=function(){
/*if5*/;(function(){
var c$ = Clazz_declareAnonymous(java.util, "HashMap$HashMapEntrySet$1", null, java.util.MapEntry.Type);
Clazz_overrideMethod(c$, "get", 
function(entry){
if (java.util.HashMap.__isSimple(this.b$["java.util.HashMap.HashMapEntrySet"].associatedMap)) {
var key = null;
var value = null;
{
key = entry.value[0];
value = entry.value[1];
}return  new java.util.HashMap.Entry(key, value);
}return entry;
}, "java.util.MapEntry");
/*eoif5*/})();
};
/*eoif3*/})();
c$.USE_SIMPLE = true;
});
;//5.0.1-v7 Fri Nov 21 04:39:22 CST 2025
Clazz_load(["java.util.HashMap"], "java.util.LinkedHashMap", ["java.util.AbstractCollection", "$.AbstractSet", "java.util.MapEntry.Type"], function(){
var c$ = Clazz_decorateAsClass(function(){
this.accessOrder = false;
this.head = null;
this.tail = null;
Clazz_instantialize(this, arguments);}, java.util, "LinkedHashMap", java.util.HashMap);
Clazz_makeConstructor(c$, 
function(){
this.construct (16, 0.75, false);
});
Clazz_makeConstructor(c$, 
function(s){
this.construct (s, 0.75, false);
}, "~N");
Clazz_makeConstructor(c$, 
function(s, lf){
this.construct (s, lf, false);
}, "~N,~N");
Clazz_makeConstructor(c$, 
function(s, lf, order){
Clazz_superConstructor(this, java.util.LinkedHashMap, [s, lf]);
this.accessOrder = order;
this.head = null;
this.tail = null;
}, "~N,~N,~B");
Clazz_makeConstructor(c$, 
function(m){
Clazz_superConstructor (this, java.util.LinkedHashMap, []);
this.accessOrder = false;
this.head = null;
this.tail = null;
this.putAll(m);
}, "java.util.Map");
Clazz_overrideMethod(c$, "newElementArray", 
function(s){
return  new Array(s);
}, "~N");
Clazz_overrideMethod(c$, "get", 
function(key){
var m = this.getJavaEntry(key);
if (m == null) {
return null;
}if (this.accessOrder && this.tail !== m) {
var p = m.chainBackward;
var n = m.chainForward;
n.chainBackward = p;
if (p != null) {
p.chainForward = n;
} else {
this.head = n;
}m.chainForward = null;
m.chainBackward = this.tail;
this.tail.chainForward = m;
this.tail = m;
}return m.value;
}, "~O");
Clazz_overrideMethod(c$, "createEntry", 
function(key, index, value){
var m =  new java.util.LinkedHashMap.LinkedHashMapEntry(key, value);
m.next = this.elementData[index];
this.elementData[index] = m;
this.linkEntry(m);
return m;
}, "~O,~N,~O");
Clazz_overrideMethod(c$, "put", 
function(key, value){
var index = this.getModuloHash(key);
var m = this.findJavaEntry(key, index);
if (m == null) {
this.modCount++;
if (++this.elementCount > this.threshold) {
this.rehash();
index = key == null ? 0 : (key.hashCode() & 0x7FFFFFFF) % this.elementData.length;
}m = this.createEntry(key, index, null);
} else {
this.linkEntry(m);
}var result = m.value;
m.value = value;
if (this.removeEldestEntry(this.head)) {
this.remove(this.head.key);
}return result;
}, "~O,~O");
Clazz_defineMethod(c$, "linkEntry", 
function(m){
if (this.tail === m) {
return;
}if (this.head == null) {
this.head = this.tail = m;
return;
}var p = m.chainBackward;
var n = m.chainForward;
if (p == null) {
if (n != null) {
if (this.accessOrder) {
this.head = n;
n.chainBackward = null;
m.chainBackward = this.tail;
m.chainForward = null;
this.tail.chainForward = m;
this.tail = m;
}} else {
m.chainBackward = this.tail;
m.chainForward = null;
this.tail.chainForward = m;
this.tail = m;
}return;
}if (n == null) {
return;
}if (this.accessOrder) {
p.chainForward = n;
n.chainBackward = p;
m.chainForward = null;
m.chainBackward = this.tail;
this.tail.chainForward = m;
this.tail = m;
}}, "java.util.LinkedHashMap.LinkedHashMapEntry");
Clazz_overrideMethod(c$, "entrySet", 
function(){
return  new java.util.LinkedHashMap.LinkedHashMapEntrySet(this);
});
Clazz_overrideMethod(c$, "keySet", 
function(){
if (this.$keySet == null) {
this.$keySet = ((Clazz_isClassDefined("java.util.LinkedHashMap$1") ? 0 : java.util.LinkedHashMap.$LinkedHashMap$1$ ()), Clazz_innerTypeInstance(java.util.LinkedHashMap$1, this, null));
}return this.$keySet;
});
Clazz_overrideMethod(c$, "values", 
function(){
if (this.$values == null) {
this.$values = ((Clazz_isClassDefined("java.util.LinkedHashMap$2") ? 0 : java.util.LinkedHashMap.$LinkedHashMap$2$ ()), Clazz_innerTypeInstance(java.util.LinkedHashMap$2, this, null));
}return this.$values;
});
Clazz_overrideMethod(c$, "remove", 
function(key){
var m = this.removeJavaEntry(key);
if (m == null) {
return null;
}var p = m.chainBackward;
var n = m.chainForward;
if (p != null) {
p.chainForward = n;
} else {
this.head = n;
}if (n != null) {
n.chainBackward = p;
} else {
this.tail = p;
}return m.value;
}, "~O");
Clazz_defineMethod(c$, "removeEldestEntry", 
function(eldest){
return false;
}, "java.util.Map.Entry");
Clazz_defineMethod(c$, "clear", 
function(){
Clazz_superCall(this, java.util.LinkedHashMap, "clear", []);
this.head = this.tail = null;
});
Clazz_defineMethod(c$, "clone", 
function(){
var map = Clazz_superCall(this, java.util.LinkedHashMap, "clone", []);
map.clear();
for (var entry, $entry = this.entrySet().iterator (); $entry.hasNext()&& ((entry = $entry.next ()) || true);) {
map.put(entry.getKey(), entry.getValue());
}
return map;
});
Clazz_overrideMethod(c$, "__setJS", 
function(){
this.__m = null;
});
c$.$LinkedHashMap$1$=function(){
/*if5*/;(function(){
var c$ = Clazz_declareAnonymous(java.util, "LinkedHashMap$1", java.util.AbstractSet);
Clazz_overrideMethod(c$, "contains", 
function(object){
return this.b$["java.util.LinkedHashMap"].containsKey(object);
}, "~O");
Clazz_overrideMethod(c$, "size", 
function(){
return this.b$["java.util.LinkedHashMap"].size();
});
Clazz_overrideMethod(c$, "clear", 
function(){
this.b$["java.util.LinkedHashMap"].clear();
});
Clazz_overrideMethod(c$, "remove", 
function(key){
if (this.b$["java.util.LinkedHashMap"].containsKey(key)) {
this.b$["java.util.LinkedHashMap"].remove(key);
return true;
}return false;
}, "~O");
Clazz_overrideMethod(c$, "iterator", 
function(){
return  new java.util.LinkedHashMap.LinkedHashIterator(((Clazz_isClassDefined("java.util.LinkedHashMap$1$1") ? 0 : java.util.LinkedHashMap.$LinkedHashMap$1$1$ ()), Clazz_innerTypeInstance(java.util.LinkedHashMap$1$1, this, null)), this.b$["java.util.LinkedHashMap"]);
});
/*eoif5*/})();
};
c$.$LinkedHashMap$1$1$=function(){
/*if5*/;(function(){
var c$ = Clazz_declareAnonymous(java.util, "LinkedHashMap$1$1", null, java.util.MapEntry.Type);
Clazz_overrideMethod(c$, "get", 
function(entry){
return entry.key;
}, "java.util.MapEntry");
/*eoif5*/})();
};
c$.$LinkedHashMap$2$=function(){
/*if5*/;(function(){
var c$ = Clazz_declareAnonymous(java.util, "LinkedHashMap$2", java.util.AbstractCollection);
Clazz_overrideMethod(c$, "contains", 
function(object){
return this.b$["java.util.LinkedHashMap"].containsValue(object);
}, "~O");
Clazz_overrideMethod(c$, "size", 
function(){
return this.b$["java.util.LinkedHashMap"].size();
});
Clazz_overrideMethod(c$, "clear", 
function(){
this.b$["java.util.LinkedHashMap"].clear();
});
Clazz_overrideMethod(c$, "iterator", 
function(){
return  new java.util.LinkedHashMap.LinkedHashIterator(((Clazz_isClassDefined("java.util.LinkedHashMap$2$1") ? 0 : java.util.LinkedHashMap.$LinkedHashMap$2$1$ ()), Clazz_innerTypeInstance(java.util.LinkedHashMap$2$1, this, null)), this.b$["java.util.LinkedHashMap"]);
});
/*eoif5*/})();
};
c$.$LinkedHashMap$2$1$=function(){
/*if5*/;(function(){
var c$ = Clazz_declareAnonymous(java.util, "LinkedHashMap$2$1", null, java.util.MapEntry.Type);
Clazz_overrideMethod(c$, "get", 
function(entry){
return entry.value;
}, "java.util.MapEntry");
/*eoif5*/})();
};
/*if3*/;(function(){
var c$ = Clazz_declareType(java.util.LinkedHashMap, "LinkedHashIterator", java.util.HashMap.HashMapIterator);
Clazz_makeConstructor(c$, 
function(value, hm){
Clazz_superConstructor(this, java.util.LinkedHashMap.LinkedHashIterator, [value, hm]);
this.entry = hm.head;
}, "java.util.MapEntry.Type,java.util.LinkedHashMap");
Clazz_overrideMethod(c$, "hasNext", 
function(){
return (this.entry != null);
});
Clazz_overrideMethod(c$, "next", 
function(){
this.checkConcurrentMod();
if (!this.hasNext()) {
throw  new java.util.NoSuchElementException();
}var result = this.type.get(this.entry);
this.lastEntry = this.entry;
this.entry = (this.entry).chainForward;
this.canRemove = true;
return result;
});
Clazz_overrideMethod(c$, "remove", 
function(){
this.checkConcurrentMod();
if (!this.canRemove) {
throw  new IllegalStateException();
}this.canRemove = false;
this.associatedMap.modCount++;
var index = this.associatedMap.getModuloHash(this.lastEntry.key);
var m = this.associatedMap.elementData[index];
if (m === this.lastEntry) {
this.associatedMap.elementData[index] = this.lastEntry.next;
} else {
while (m.next != null) {
if (m.next === this.lastEntry) {
break;
}m = m.next;
}
m.next = this.lastEntry.next;
}var lhme = this.lastEntry;
var p = lhme.chainBackward;
var n = lhme.chainForward;
var lhm = this.associatedMap;
if (p != null) {
p.chainForward = n;
if (n != null) {
n.chainBackward = p;
} else {
lhm.tail = p;
}} else {
lhm.head = n;
if (n != null) {
n.chainBackward = null;
} else {
lhm.tail = null;
}}this.associatedMap.elementCount--;
this.expectedModCount++;
});
/*eoif3*/})();
/*if3*/;(function(){
var c$ = Clazz_declareType(java.util.LinkedHashMap, "LinkedHashMapEntrySet", java.util.HashMap.HashMapEntrySet);
Clazz_overrideMethod(c$, "iterator", 
function(){
return  new java.util.LinkedHashMap.LinkedHashIterator(((Clazz_isClassDefined("java.util.LinkedHashMap$LinkedHashMapEntrySet$1") ? 0 : java.util.LinkedHashMap.LinkedHashMapEntrySet.$LinkedHashMap$LinkedHashMapEntrySet$1$ ()), Clazz_innerTypeInstance(java.util.LinkedHashMap$LinkedHashMapEntrySet$1, this, null)), this.hashMap());
});
c$.$LinkedHashMap$LinkedHashMapEntrySet$1$=function(){
/*if5*/;(function(){
var c$ = Clazz_declareAnonymous(java.util, "LinkedHashMap$LinkedHashMapEntrySet$1", null, java.util.MapEntry.Type);
Clazz_overrideMethod(c$, "get", 
function(entry){
return entry;
}, "java.util.MapEntry");
/*eoif5*/})();
};
/*eoif3*/})();
/*if3*/;(function(){
var c$ = Clazz_decorateAsClass(function(){
this.chainForward = null;
this.chainBackward = null;
Clazz_instantialize(this, arguments);}, java.util.LinkedHashMap, "LinkedHashMapEntry", java.util.HashMap.Entry);
Clazz_makeConstructor(c$, 
function(theKey, theValue){
Clazz_superConstructor(this, java.util.LinkedHashMap.LinkedHashMapEntry, [theKey, theValue]);
this.chainForward = null;
this.chainBackward = null;
}, "~O,~O");
Clazz_defineMethod(c$, "clone", 
function(){
var entry = Clazz_superCall(this, java.util.LinkedHashMap.LinkedHashMapEntry, "clone", []);
entry.chainBackward = this.chainBackward;
entry.chainForward = this.chainForward;
var lnext = entry.next;
if (lnext != null) {
entry.next = lnext.clone();
}return entry;
});
/*eoif3*/})();
});
;//5.0.1-v7 Fri Nov 21 04:39:22 CST 2025
Clazz_declarePackage("J.api");
Clazz_declareInterface(J.api, "JmolJDXMOLParser");
;//5.0.1-v7 Mon Aug 17 10:07:10 MDT 2026
Clazz_declarePackage("J.api");
Clazz_declareInterface(J.api, "JmolJDXMOLReader");
;//5.0.1-v7 Mon Aug 17 10:07:10 MDT 2026
Clazz_declarePackage("J.api");
Clazz_declareInterface(J.api, "GenericGraphics");
;//5.0.1-v7 Mon Aug 17 10:07:10 MDT 2026
Clazz_declarePackage("J.jsv");
Clazz_load(["J.api.JmolJDXMOLParser", "java.util.Hashtable"], "J.jsv.JDXMOLParser", ["JU.BS", "$.Lst", "$.PT", "$.SB", "JU.Logger"], function(){
var c$ = Clazz_decorateAsClass(function(){
this.line = null;
this.lastModel = "";
this.thisModelID = null;
this.baseModel = null;
this.vibScale = 0;
this.peakXLabel = null;
this.peakYLabel = null;
this.loader = null;
this.peakIndex = null;
this.peakFilePath = null;
this.firstModelWithPeaks = null;
this.mapDup = null;
Clazz_instantialize(this, arguments);}, J.jsv, "JDXMOLParser", null, J.api.JmolJDXMOLParser);
Clazz_prepareFields (c$, function(){
this.mapDup =  new java.util.Hashtable();
});
Clazz_makeConstructor(c$, 
function(){
});
Clazz_overrideMethod(c$, "set", 
function(loader, filePath, htParams){
this.loader = loader;
this.peakFilePath = filePath;
this.peakIndex =  Clazz_newIntArray (1, 0);
if (htParams != null) {
htParams.remove("modelNumber");
if (htParams.containsKey("zipSet")) {
this.peakIndex = htParams.get("peakIndex");
if (this.peakIndex == null) {
this.peakIndex =  Clazz_newIntArray (1, 0);
htParams.put("peakIndex", this.peakIndex);
}if (!htParams.containsKey("subFileName")) this.peakFilePath = JU.PT.split(filePath, "|")[0];
}}return this;
}, "J.api.JmolJDXMOLReader,~S,java.util.Map");
Clazz_overrideMethod(c$, "getAttribute", 
function(line, tag){
var attr = JU.PT.getQuotedAttribute(line, tag);
return (attr == null ? "" : attr);
}, "~S,~S");
Clazz_overrideMethod(c$, "getRecord", 
function(key){
if (this.line == null || this.line.indexOf(key) < 0) return null;
var s = this.line;
while (s.indexOf(">") < 0) s += " " + this.readLine();

return this.line = s;
}, "~S");
Clazz_overrideMethod(c$, "readModels", 
function(){
if (!this.findRecord("Models")) return false;
this.line = "";
this.thisModelID = "";
var isFirst = true;
while (true) {
this.line = this.loader.discardLinesUntilNonBlank();
if (this.getRecord("<ModelData") == null) break;
this.getModelData(isFirst);
isFirst = false;
}
return true;
});
Clazz_overrideMethod(c$, "readACDMolFile", 
function(){
var sb =  new JU.SB();
sb.append(this.line.substring(this.line.indexOf("=") + 1)).appendC('\n');
while (this.readLine() != null && !this.line.contains("$$$$")) sb.append(this.line).appendC('\n');

return JU.PT.rep(sb.toString(), "  $$ Empty String", "");
});
Clazz_overrideMethod(c$, "readACDAssignments", 
function(nPoints, isPeakAssignment, list){
var overflow = false;
try {
if (this.line == null || this.line.indexOf("#") >= 0) this.readLine();
if (nPoints < 0) nPoints = 2147483647;
for (var i = 0; i < nPoints; i++) {
var s = this.readLine();
if (s == null || s.indexOf("#") == 0) {
overflow = true;
break;
}if (isPeakAssignment) {
while (s.indexOf(">") < 0) s += " " + this.readLine();

s = s.trim();
}s = JU.PT.replaceAllCharacters(s, "()<>", " ").trim();
if (s.length == 0) break;
var pt = s.indexOf("'");
if (pt >= 0) {
var pt2 = s.indexOf("'", pt + 1);
s = s.substring(0, pt) + JU.PT.rep(s.substring(pt + 1, pt2), ",", ";") + s.substring(pt2 + 1);
}JU.Logger.info("Peak Assignment: " + s);
var tokens = JU.PT.split(s, ",");
list.addLast(tokens);
}
} catch (e) {
if (Clazz_exceptionOf(e, Exception)){
JU.Logger.error("Error reading peak assignments at " + this.line + ": " + e);
} else {
throw e;
}
}
return !overflow;
}, "~N,~B,JU.Lst");
Clazz_overrideMethod(c$, "setACDAssignments", 
function(model, mytype, peakCount, acdlist, molFile){
try {
if (peakCount >= 0) this.peakIndex =  Clazz_newIntArray(-1, [peakCount]);
var isMS = (mytype.indexOf("MASS") == 0);
var file = " file=" + JU.PT.esc(this.peakFilePath.$replace('\\', '/'));
model = " model=" + JU.PT.esc(model + " (assigned)");
this.peakXLabel = "";
this.peakYLabel = "";
var dx = this.getACDPeakWidth(mytype) / 2;
var htSets =  new java.util.Hashtable();
var list =  new JU.Lst();
var zzcMap = null;
var ptx;
var pta;
var nAtoms = 0;
if (isMS) {
zzcMap =  new java.util.Hashtable();
var tokens = JU.PT.split(molFile, "M  ZZC");
for (var i = tokens.length; --i >= 1; ) {
var ab = JU.PT.getTokens(tokens[i]);
nAtoms = Math.max(nAtoms, JU.PT.parseInt(ab[0]));
zzcMap.put(ab[1], ab[0]);
}
ptx = 4;
pta = 0;
} else if (mytype.indexOf("NMR") >= 0) {
ptx = 0;
pta = 3;
} else {
ptx = 0;
pta = 2;
}var nPeaks = acdlist.size();
for (var i = 0; i < nPeaks; i++) {
var data = acdlist.get(i);
var x = JU.PT.parseFloat(data[ptx]);
var a = data[pta];
if (isMS) a = this.fixACDAtomList(a, zzcMap, nAtoms);
 else a = a.$replace(';', ',');
if (a.indexOf("select") >= 0) {
var pt = a.indexOf("select atomno=");
if (pt < 0) continue;
a = JU.PT.split(a.substring(pt + 14), " ")[0];
}var title = (isMS ? "m/z=" + Math.round(x) + ": " + data[2] + " (" + data[1] + ")" : pta == 2 ? "" + (Math.round(x * 10) / 10) : null);
this.getStringInfo(file, title, mytype, model, a, htSets, "" + x, list, " atoms=\"%ATOMS%\" xMin=\"" + (x - dx) + "\" xMax=\"" + (x + dx) + "\">");
}
return this.setPeakData(list, 0);
} catch (e) {
if (Clazz_exceptionOf(e, Exception)){
return 0;
} else {
throw e;
}
}
}, "~S,~S,~N,JU.Lst,~S");
Clazz_defineMethod(c$, "fixACDAtomList", 
function(atoms, zzcMap, nAtoms){
atoms = atoms.trim();
var tokens = JU.PT.getTokens(atoms.$replace(';', ' '));
var bs =  new JU.BS();
var isM = false;
for (var i = 0; i < tokens.length; i++) {
var a = tokens[i];
isM = (a.indexOf("M") >= 0);
if (isM) a = "1-" + nAtoms;
var pt = a.indexOf('-');
if (pt >= 0) {
var i1 = JU.PT.parseInt(a.substring(0, pt));
var i2 = JU.PT.parseInt(a.substring(pt + 1)) + 1;
for (var k = i1; k < i2; k++) bs.set(isM ? k : JU.PT.parseInt(zzcMap.get("" + k)));

} else {
bs.set(JU.PT.parseInt(zzcMap.get(a)));
}}
var s = bs.toJSON();
return s.substring(1, s.length - 1);
}, "~S,java.util.Map,~N");
Clazz_defineMethod(c$, "getACDPeakWidth", 
function(type){
return (type.indexOf("HNMR") >= 0 ? 0.05 : type.indexOf("CNMR") >= 0 ? 1 : type.indexOf("MASS") >= 0 ? 1 : 10);
}, "~S");
Clazz_overrideMethod(c$, "readPeaks", 
function(isSignals, peakCount){
try {
if (peakCount >= 0) this.peakIndex =  Clazz_newIntArray(-1, [peakCount]);
var offset = (isSignals ? 1 : 0);
var tag1 = (isSignals ? "Signals" : "Peaks");
var tag2 = (isSignals ? "<Signal" : "<PeakData");
if (!this.findRecord(tag1)) return 0;
var file = " file=" + JU.PT.esc(this.peakFilePath.$replace('\\', '/'));
var model = JU.PT.getQuotedAttribute(this.line, "model");
model = this.fixModel(model, true);
model = " model=" + JU.PT.esc(model == null ? this.thisModelID : model);
var mytype = JU.PT.getQuotedAttribute(this.line, "type");
this.peakXLabel = JU.PT.getQuotedAttribute(this.line, "xLabel");
this.peakYLabel = JU.PT.getQuotedAttribute(this.line, "yLabel");
var htSets =  new java.util.Hashtable();
var list =  new JU.Lst();
while (this.readLine() != null && !(this.line = this.line.trim()).startsWith("</" + tag1)) {
if (this.line.startsWith(tag2)) {
this.getRecord(tag2);
JU.Logger.info(this.line);
var title = JU.PT.getQuotedAttribute(this.line, "title");
if (mytype == null) mytype = JU.PT.getQuotedAttribute(this.line, "type");
var atoms = JU.PT.getQuotedAttribute(this.line, "atoms");
var key = (Clazz_floatToInt(JU.PT.parseFloat(JU.PT.getQuotedAttribute(this.line, "xMin")) * 100)) + "_" + (Clazz_floatToInt(JU.PT.parseFloat(JU.PT.getQuotedAttribute(this.line, "xMax")) * 100));
var peakModel = JU.PT.getQuotedAttribute(this.line, "model");
var newID = this.fixModel(peakModel, true);
if (this.firstModelWithPeaks == null) this.firstModelWithPeaks = newID;
if (newID != null && !newID.equals(peakModel)) {
this.line = JU.PT.rep(this.line, "model=\"" + peakModel + "\"", "model=\"" + newID + "\"");
JU.Logger.error("peak model changed from " + peakModel + " for " + this.line);
}var more = this.line.substring(tag2.length).trim();
this.getStringInfo(file, title, mytype, (peakModel == null ? model : ""), atoms, htSets, key, list, more);
}}
return this.setPeakData(list, offset);
} catch (e) {
if (Clazz_exceptionOf(e, Exception)){
return 0;
} else {
throw e;
}
}
}, "~B,~N");
Clazz_defineMethod(c$, "checkDuplicateModelID", 
function(){
if (false) return;
var idup = this.mapDup.get(this.thisModelID);
if (idup == null) {
this.mapDup.put(this.thisModelID, Integer.$valueOf(1));
} else {
idup = Integer.$valueOf(idup.intValue() + 1);
var newID = this.thisModelID + idup;
JU.Logger.error("duplicate model id " + this.thisModelID + " now " + newID);
this.mapDup.put(this.thisModelID, idup);
this.thisModelID = newID;
}});
Clazz_defineMethod(c$, "fixModel", 
function(model, andIncrement){
if (model != null && JU.PT.parseInt(model) != -2147483648) model = "_" + model;
if (false) return model;
var idup = (model == null || !andIncrement ? null : this.mapDup.get(model));
if (idup != null && idup.intValue() > 1) {
model = this.thisModelID;
}return model;
}, "~S,~B");
Clazz_defineMethod(c$, "setPeakData", 
function(list, offset){
var nH = 0;
var n = list.size();
for (var i = 0; i < n; i++) {
var o = list.get(i);
var info = JU.PT.rep(o[0], "%INDEX%", "" + (++this.peakIndex[0]));
var bs = o[1];
if (bs != null) {
var s = "";
for (var j = bs.nextSetBit(0); j >= 0; j = bs.nextSetBit(j + 1)) s += "," + (j + offset);

var na = bs.cardinality();
nH += na;
info = JU.PT.rep(info, "%ATOMS%", s.substring(1));
info = JU.PT.rep(info, "%S%", (na == 1 ? "" : "s"));
info = JU.PT.rep(info, "%NATOMS%", "" + na);
}JU.Logger.info("adding PeakData " + info);
this.loader.addPeakData(info);
}
this.loader.setSpectrumPeaks(nH, this.peakXLabel, this.peakYLabel);
return n;
}, "JU.Lst,~N");
Clazz_defineMethod(c$, "getStringInfo", 
function(file, title, mytype, model, atoms, htSets, key, list, more){
if ("HNMR".equals(mytype)) mytype = "1HNMR";
 else if ("CNMR".equals(mytype)) mytype = "13CNMR";
var type = (mytype == null ? "" : " type=" + JU.PT.esc(mytype));
if (title == null) title = ("1HNMR".equals(mytype) ? "atom%S%: %ATOMS%; integration: %NATOMS%" : "");
title = " title=" + JU.PT.esc(title);
var stringInfo = "<PeakData " + file + " index=\"%INDEX%\"" + title + type + model + " " + more;
if (atoms != null) stringInfo = JU.PT.rep(stringInfo, "atoms=\"" + atoms + "\"", "atoms=\"%ATOMS%\"");
var o = htSets.get(key);
if (o == null) {
o =  Clazz_newArray(-1, [stringInfo, (atoms == null ? null :  new JU.BS())]);
htSets.put(key, o);
list.addLast(o);
}if (atoms != null) {
var bs = o[1];
atoms = atoms.$replace(',', ' ');
if (atoms.equals("*")) atoms = "0:1000";
bs.or(JU.BS.unescape("({" + atoms + "})"));
}}, "~S,~S,~S,~S,~S,java.util.Map,~S,JU.Lst,~S");
Clazz_defineMethod(c$, "getModelData", 
function(isFirst){
this.baseModel = this.fixModel(this.getAttribute(this.line, "baseModel"), true);
this.lastModel = this.thisModelID;
this.thisModelID = this.fixModel(this.getAttribute(this.line, "id"), false);
this.checkDuplicateModelID();
while (this.line.indexOf(">") < 0 && this.line.indexOf("type") < 0) this.readLine();

var modelType = this.getAttribute(this.line, "type").toLowerCase();
this.vibScale = JU.PT.parseFloat(this.getAttribute(this.line, "vibrationScale"));
if (modelType.equals("xyzvib")) modelType = "xyz";
 else if (modelType.length == 0) modelType = null;
var sb =  new JU.SB();
while (this.readLine() != null && !this.line.contains("</ModelData>")) sb.append(this.line).appendC('\n');

this.loader.processModelData(sb.toString(), this.thisModelID, modelType, this.baseModel, this.lastModel, NaN, this.vibScale, isFirst);
}, "~B");
Clazz_defineMethod(c$, "findRecord", 
function(tag){
if (this.line == null) this.readLine();
if (this.line != null && this.line.indexOf("<" + tag) < 0) this.line = this.loader.discardLinesUntilContains2("<" + tag, "##");
return (this.line != null && this.line.indexOf("<" + tag) >= 0);
}, "~S");
Clazz_defineMethod(c$, "readLine", 
function(){
return this.line = this.loader.rd();
});
Clazz_overrideMethod(c$, "setLine", 
function(s){
this.line = s;
}, "~S");
Clazz_overrideMethod(c$, "getFirstModelWithPeaks", 
function(){
return this.firstModelWithPeaks;
});
});
;//5.0.1-v7 Mon Aug 17 10:07:10 MDT 2026
Clazz_declarePackage("J.jsv");
Clazz_load(["J.api.JmolJSpecView"], "J.jsv.JSV", ["java.util.Hashtable", "JU.BS", "$.Lst", "$.PT", "JU.Escape", "$.Logger", "JV.FileManager"], function(){
var c$ = Clazz_decorateAsClass(function(){
this.vwr = null;
Clazz_instantialize(this, arguments);}, J.jsv, "JSV", null, J.api.JmolJSpecView);
Clazz_overrideMethod(c$, "setViewer", 
function(vwr){
this.vwr = vwr;
return this;
}, "JV.Viewer");
Clazz_overrideMethod(c$, "atomPicked", 
function(atomIndex){
if (atomIndex < 0) return;
var peak = this.getPeakAtomRecord(atomIndex);
if (peak != null) this.sendJSpecView(peak + " src=\"JmolAtomSelect\"");
}, "~N");
Clazz_defineMethod(c$, "getPeakAtomRecord", 
function(atomIndex){
var atoms = this.vwr.ms.at;
var iModel = atoms[atomIndex].mi;
var type = null;
switch (atoms[atomIndex].getElementNumber()) {
case 1:
type = "1HNMR";
break;
case 6:
type = "13CNMR";
break;
default:
return null;
}
var peaks = this.vwr.ms.getInfo(iModel, "jdxAtomSelect" + "_" + type);
if (peaks == null) return null;
this.vwr.ms.htPeaks =  new java.util.Hashtable();
var htPeaks = this.vwr.ms.htPeaks;
for (var i = 0; i < peaks.size(); i++) {
var peak = peaks.get(i);
System.out.println("Jmol JSpecView.java peak=" + peak);
var bsPeak = htPeaks.get(peak);
System.out.println("Jmol JSpecView.java bspeak=" + bsPeak);
if (bsPeak == null) {
htPeaks.put(peak, bsPeak =  new JU.BS());
var satoms = JU.PT.getQuotedAttribute(peak, "atoms");
var select = JU.PT.getQuotedAttribute(peak, "select");
System.out.println("Jmol JSpecView.java satoms select " + satoms + " " + select);
var script = "";
if (satoms != null) script += "visible & (atomno=" + JU.PT.rep(satoms, ",", " or atomno=") + ")";
 else if (select != null) script += "visible & (" + select + ")";
System.out.println("Jmol JSpecView.java script : " + script);
bsPeak.or(this.vwr.getAtomBitSet(script));
}System.out.println("Jmol JSpecView bsPeak now : " + bsPeak + " " + atomIndex);
if (bsPeak.get(atomIndex)) return peak;
}
return null;
}, "~N");
Clazz_defineMethod(c$, "sendJSpecView", 
function(peak){
var msg = JU.PT.getQuotedAttribute(peak, "title");
if (msg != null) this.vwr.scriptEcho(JU.Logger.debugging ? peak : msg);
peak = this.vwr.fullName + "JSpecView:" + " " + peak;
JU.Logger.info("Jmol>JSV " + peak);
this.vwr.sm.syncSend(peak, ">", 0);
}, "~S");
Clazz_overrideMethod(c$, "setModel", 
function(modelIndex){
var startJSV = this.vwr.ms.getInfoM("_startJSpecView");
var syncMode = (startJSV === Boolean.TRUE ? 1 : this.vwr.sm.getSyncMode());
if (syncMode != 1) return;
var peak = this.vwr.ms.getInfo(modelIndex, "jdxModelSelect");
if (peak != null) this.sendJSpecView(peak + " src=\"Jmol\"");
}, "~N");
Clazz_overrideMethod(c$, "getBaseModelIndex", 
function(modelIndex){
var baseModel = this.vwr.ms.getInfo(modelIndex, "jdxBaseModel");
if (baseModel != null) for (var i = this.vwr.ms.mc; --i >= 0; ) if (baseModel.equals(this.vwr.ms.getInfo(i, "jdxModelID"))) return i;

return modelIndex;
}, "~N");
Clazz_overrideMethod(c$, "processSync", 
function(script, jsvMode){
if (JU.Logger.debugging) JU.Logger.info("J.jsv.JSV jsvMode=" + jsvMode + " script=" + script);
System.out.println("JSV processSync " + script + " " + jsvMode);
switch (jsvMode) {
case 0:
case 77:
case 28:
case 35:
if (!script.startsWith("JSpecView:")) script = "JSpecView:" + script;
script = this.vwr.fullName + script;
this.vwr.sm.syncSend(script, ">", 0);
return null;
}
switch (jsvMode) {
default:
return null;
case 21:
if (this.vwr.isApplet) return null;
return null;
case 14:
var filename = JU.PT.getQuotedAttribute(script, "file");
var isSimulation = (filename != null && filename.startsWith(JV.FileManager.SIMULATION_PROTOCOL));
var id = (!isSimulation || this.vwr.isApplet ? "" : JU.PT.getQuotedAttribute(filename.$replace('\'', '"'), "id"));
if (isSimulation && !this.vwr.isApplet && (filename.startsWith(JV.FileManager.SIMULATION_PROTOCOL + "C13/MOL=") || filename.startsWith(JV.FileManager.SIMULATION_PROTOCOL + "H1/MOL="))) filename = null;
 else filename = JU.PT.rep(filename, "#molfile", "");
var modelID = (isSimulation ? "molfile" : JU.PT.getQuotedAttribute(script, "model"));
var baseModel = JU.PT.getQuotedAttribute(script, "baseModel");
var atoms = JU.PT.getQuotedAttribute(script, "atoms");
var select = JU.PT.getQuotedAttribute(script, "select");
var script2 = JU.PT.getQuotedAttribute(script, "script");
if (id == null || id.length == 0) id = (modelID == null ? null : (filename == null ? "" : filename + "#") + modelID);
if ("".equals(baseModel)) id += ".baseModel";
var modelIndex = (id == null ? -3 : this.vwr.getModelIndexFromId(id));
if (modelIndex == -2) return null;
if (modelIndex != -1 || filename == null) {
script = "";
} else if (isSimulation && !this.vwr.isApplet) {
return null;
} else {
if (isSimulation) filename += "#molfile";
script = (modelIndex >= 0 ? "" : "load " + JU.PT.esc(filename));
}if (id != null) script += ";model " + JU.PT.esc(id);
if (atoms != null) script += ";select visible & (@" + JU.PT.rep(atoms, ",", " or @") + ")";
 else if (select != null) script += ";select visible & (" + select + ")";
if (script2 != null) script += ";" + script2;
return script;
case 7:
var list = JU.Escape.unescapeStringArray(script.substring(7));
var peaks =  new JU.Lst();
var type = "1HNMR";
for (var i = 0; i < list.length; i++) {
if (i == 0 && list[i].indexOf(JV.FileManager.SIMULATION_PROTOCOL + "C13/") >= 0) type = "13CNMR";
peaks.addLast(list[i]);
}
this.vwr.ms.setInfo(this.vwr.am.cmi, "jdxAtomSelect" + "_" + type, peaks);
return null;
}
}, "~S,~N");
});
;//5.0.1-v7 Mon Aug 24 10:01:38 CDT 2026
Clazz_declarePackage("JSV.api");
Clazz_declareInterface(JSV.api, "AnnotationData");
;//5.0.1-v7 Mon Aug 17 10:07:10 MDT 2026
Clazz_declarePackage("JSV.api");
Clazz_declareInterface(JSV.api, "AppletFrame");
;//5.0.1-v7 Mon Aug 17 10:07:10 MDT 2026
Clazz_declarePackage("JSV.api");
Clazz_declareInterface(JSV.api, "JSVAppInterface", JSV.api.JSVAppletInterface);
;//5.0.1-v7 Mon Aug 17 10:07:10 MDT 2026
Clazz_declarePackage("JSV.api");
Clazz_declareInterface(JSV.api, "JSVAppletInterface");
;//5.0.1-v7 Mon Aug 17 10:07:10 MDT 2026
Clazz_declarePackage("JSV.api");
Clazz_declareInterface(JSV.api, "JSVFileHelper");
;//5.0.1-v7 Mon Aug 17 10:07:10 MDT 2026
Clazz_declarePackage("JSV.api");
Clazz_declareInterface(JSV.api, "JSVMainPanel", JSV.api.JSVViewPanel);
;//5.0.1-v7 Mon Aug 17 10:07:10 MDT 2026
Clazz_declarePackage("JSV.api");
Clazz_declareInterface(JSV.api, "JSVPanel", JSV.api.JSVViewPanel);
;//5.0.1-v7 Mon Aug 17 10:07:10 MDT 2026
Clazz_declarePackage("JSV.api");
Clazz_declareInterface(JSV.api, "JSVTree");
;//5.0.1-v7 Mon Aug 17 10:07:10 MDT 2026
Clazz_declarePackage("JSV.api");
Clazz_declareInterface(JSV.api, "JSVTreeNode");
;//5.0.1-v7 Mon Aug 17 10:07:10 MDT 2026
Clazz_declarePackage("JSV.api");
Clazz_declareInterface(JSV.api, "JSVTreePath");
;//5.0.1-v7 Mon Aug 17 10:07:10 MDT 2026
Clazz_declarePackage("JSV.api");
Clazz_declareInterface(JSV.api, "JSVViewPanel");
;//5.0.1-v7 Mon Aug 17 10:07:10 MDT 2026
Clazz_declarePackage("JSV.api");
Clazz_declareInterface(JSV.api, "JSVZipReader");
;//5.0.1-v7 Mon Aug 17 10:07:10 MDT 2026
Clazz_declarePackage("JSV.api");
Clazz_declareInterface(JSV.api, "PanelListener");
;//5.0.1-v7 Mon Aug 17 10:07:10 MDT 2026
Clazz_declarePackage("JSV.api");
Clazz_declareInterface(JSV.api, "ScriptInterface");
;//5.0.1-v7 Mon Aug 17 10:07:10 MDT 2026
Clazz_declarePackage("JSV.app");
Clazz_load(["JSV.api.JSVAppInterface", "$.PanelListener", "$.ScriptInterface"], "JSV.app.JSVApp", ["JU.Lst", "$.PT", "JSV.common.Coordinate", "$.JSVFileManager", "$.JSVersion", "$.JSViewer", "$.ScriptToken", "JU.Logger"], function(){
var c$ = Clazz_decorateAsClass(function(){
this.appletFrame = null;
this.isNewWindow = false;
this.appletReadyCallbackFunctionName = null;
this.coordCallbackFunctionName = null;
this.loadFileCallbackFunctionName = null;
this.peakCallbackFunctionName = null;
this.syncCallbackFunctionName = null;
this.vwr = null;
this.prevPanel = null;
Clazz_instantialize(this, arguments);}, JSV.app, "JSVApp", null, [JSV.api.PanelListener, JSV.api.JSVAppInterface, JSV.api.ScriptInterface]);
Clazz_makeConstructor(c$, 
function(appletFrame, isJS){
this.appletFrame = appletFrame;
this.vwr =  new JSV.common.JSViewer(this, true, isJS, true);
appletFrame.setDropTargetListener(this.isSigned(), this.vwr);
var path = appletFrame.getDocumentBase();
JSV.common.JSVFileManager.setDocumentBase(this.vwr, path);
this.initParams(appletFrame.getParameter("script"));
}, "JSV.api.AppletFrame,~B");
Clazz_overrideMethod(c$, "isPro", 
function(){
return this.isSigned();
});
Clazz_overrideMethod(c$, "isSigned", 
function(){
{
return true;
}});
Clazz_defineMethod(c$, "getAppletFrame", 
function(){
return this.appletFrame;
});
Clazz_defineMethod(c$, "dispose", 
function(){
try {
this.vwr.dispose();
} catch (e) {
if (Clazz_exceptionOf(e, Exception)){
e.printStackTrace();
} else {
throw e;
}
}
});
Clazz_overrideMethod(c$, "getPropertyAsJavaObject", 
function(key){
return this.vwr.getPropertyAsJavaObject(key);
}, "~S");
Clazz_overrideMethod(c$, "getPropertyAsJSON", 
function(key){
return JU.PT.toJSON(null, this.getPropertyAsJavaObject(key));
}, "~S");
Clazz_overrideMethod(c$, "getCoordinate", 
function(){
return this.vwr.getCoordinate();
});
Clazz_overrideMethod(c$, "loadInline", 
function(data){
this.siOpenDataOrFile(data, "[inline]", null, null, -1, -1, true, null, null);
this.appletFrame.validateContent(3);
}, "~S");
Clazz_overrideMethod(c$, "exportSpectrum", 
function(type, n){
return this.vwr.$export(type, n);
}, "~S,~N");
Clazz_overrideMethod(c$, "setFilePath", 
function(tmpFilePath){
this.runScript("load " + JU.PT.esc(tmpFilePath));
}, "~S");
Clazz_overrideMethod(c$, "setSpectrumNumber", 
function(n){
this.runScript(JSV.common.ScriptToken.SPECTRUMNUMBER + " " + n);
}, "~N");
Clazz_overrideMethod(c$, "reversePlot", 
function(){
this.toggle(JSV.common.ScriptToken.REVERSEPLOT);
});
Clazz_overrideMethod(c$, "toggleGrid", 
function(){
this.toggle(JSV.common.ScriptToken.GRIDON);
});
Clazz_overrideMethod(c$, "toggleCoordinate", 
function(){
this.toggle(JSV.common.ScriptToken.COORDINATESON);
});
Clazz_overrideMethod(c$, "togglePointsOnly", 
function(){
this.toggle(JSV.common.ScriptToken.POINTSONLY);
});
Clazz_overrideMethod(c$, "toggleIntegration", 
function(){
this.toggle(JSV.common.ScriptToken.INTEGRATE);
});
Clazz_defineMethod(c$, "toggle", 
function(st){
if (this.vwr.selectedPanel != null) this.runScript(st + " TOGGLE");
}, "JSV.common.ScriptToken");
Clazz_overrideMethod(c$, "addHighlight", 
function(x1, x2, r, g, b, a){
this.runScript("HIGHLIGHT " + x1 + " " + x2 + " " + r + " " + g + " " + b + " " + a);
}, "~N,~N,~N,~N,~N,~N");
Clazz_overrideMethod(c$, "removeHighlight", 
function(x1, x2){
this.runScript("HIGHLIGHT " + x1 + " " + x2 + " OFF");
}, "~N,~N");
Clazz_overrideMethod(c$, "removeAllHighlights", 
function(){
this.runScript("HIGHLIGHT OFF");
});
Clazz_overrideMethod(c$, "syncScript", 
function(peakScript){
this.vwr.syncScript(peakScript);
}, "~S");
Clazz_overrideMethod(c$, "writeStatus", 
function(msg){
JU.Logger.info(msg);
}, "~S");
Clazz_defineMethod(c$, "initParams", 
function(params){
this.vwr.parseInitScript(params);
this.newAppletPanel();
this.vwr.setPopupMenu(this.vwr.allowMenu, this.vwr.parameters.getBoolean(JSV.common.ScriptToken.ENABLEZOOM));
if (this.vwr.allowMenu) {
this.vwr.closeSource(null);
}this.runScriptNow(params);
}, "~S");
Clazz_defineMethod(c$, "newAppletPanel", 
function(){
JU.Logger.info("newAppletPanel");
this.appletFrame.createMainPanel(this.vwr);
});
Clazz_overrideMethod(c$, "repaint", 
function(){
var applet = (this.vwr == null ? null : this.vwr.html5Applet);
if (JSV.common.JSViewer.jsmolObject == null) {
this.appletFrame.repaint();
} else if (applet != null) {
JSV.common.JSViewer.jsmolObject.repaint(applet, true);
}});
Clazz_defineMethod(c$, "updateJS", 
function(width, height){
}, "~N,~N");
Clazz_overrideMethod(c$, "runScriptNow", 
function(params){
return this.vwr.runScriptNow(params);
}, "~S");
Clazz_defineMethod(c$, "checkCallbacks", 
function(){
if (this.coordCallbackFunctionName == null && this.peakCallbackFunctionName == null) return;
var coord =  new JSV.common.Coordinate();
var actualCoord = (this.peakCallbackFunctionName == null ? null :  new JSV.common.Coordinate());
if (!this.vwr.pd().getPickedCoordinates(coord, actualCoord)) return;
var iSpec = this.vwr.mainPanel.getCurrentPanelIndex();
if (actualCoord == null) this.appletFrame.callToJavaScript(this.coordCallbackFunctionName,  Clazz_newArray(-1, [Double.$valueOf(coord.getXVal()), Double.$valueOf(coord.getYVal()), Integer.$valueOf(iSpec + 1)]));
 else this.appletFrame.callToJavaScript(this.peakCallbackFunctionName,  Clazz_newArray(-1, [Double.$valueOf(coord.getXVal()), Double.$valueOf(coord.getYVal()), Double.$valueOf(actualCoord.getXVal()), Double.$valueOf(actualCoord.getYVal()), Integer.$valueOf(iSpec + 1)]));
});
Clazz_defineMethod(c$, "doAdvanced", 
function(filePath){
}, "~S");
Clazz_overrideMethod(c$, "panelEvent", 
function(eventObj){
if (Clazz_instanceOf(eventObj,"JSV.common.PeakPickEvent")) {
this.vwr.processPeakPickEvent(eventObj, false);
} else if (Clazz_instanceOf(eventObj,"JSV.common.ZoomEvent")) {
} else if (Clazz_instanceOf(eventObj,"JSV.common.SubSpecChangeEvent")) {
}}, "~O");
Clazz_overrideMethod(c$, "getSolnColour", 
function(){
return this.vwr.getSolutionColorStr(true);
});
Clazz_defineMethod(c$, "updateJSView", 
function(msg){
var applet = this.vwr.html5Applet;
var panel = (applet == null ? null : this.vwr.selectedPanel);
{
if (!applet || applet._viewSet == null) return;
}applet._updateView(panel, msg);
}, "~S");
Clazz_overrideMethod(c$, "syncToJmol", 
function(msg){
this.updateJSView(msg);
if (this.syncCallbackFunctionName == null) return;
JU.Logger.info("JSVApp.syncToJmol JSV>Jmol " + msg);
this.appletFrame.callToJavaScript(this.syncCallbackFunctionName,  Clazz_newArray(-1, [this.vwr.fullName, msg]));
}, "~S");
Clazz_overrideMethod(c$, "setVisible", 
function(b){
this.appletFrame.setPanelVisible(b);
}, "~B");
Clazz_overrideMethod(c$, "setCursor", 
function(id){
this.vwr.apiPlatform.setCursor(id, this.appletFrame);
}, "~N");
Clazz_overrideMethod(c$, "runScript", 
function(script){
this.vwr.runScript(script);
}, "~S");
Clazz_overrideMethod(c$, "getScriptQueue", 
function(){
return this.vwr.scriptQueue;
});
Clazz_overrideMethod(c$, "siSetCurrentSource", 
function(source){
this.vwr.currentSource = source;
}, "JSV.source.JDXSource");
Clazz_overrideMethod(c$, "siSendPanelChange", 
function(){
if (this.vwr.selectedPanel === this.prevPanel) return;
this.prevPanel = this.vwr.selectedPanel;
this.vwr.sendPanelChange();
});
Clazz_overrideMethod(c$, "siNewWindow", 
function(isSelected, fromFrame){
this.isNewWindow = isSelected;
if (fromFrame) {
if (this.vwr.jsvpPopupMenu != null) this.vwr.jsvpPopupMenu.setSelected("Window", false);
} else {
this.appletFrame.newWindow(isSelected);
}}, "~B,~B");
Clazz_overrideMethod(c$, "siValidateAndRepaint", 
function(isAll){
var pd = this.vwr.pd();
if (pd != null) pd.setTaintedAll();
this.appletFrame.validate();
this.repaint();
}, "~B");
Clazz_overrideMethod(c$, "siSyncLoad", 
function(filePath){
this.newAppletPanel();
JU.Logger.info("JSVP syncLoad reading " + filePath);
this.siOpenDataOrFile(null, null, null, filePath, -1, -1, false, null, null);
this.appletFrame.validateContent(3);
}, "~S");
Clazz_overrideMethod(c$, "siOpenDataOrFile", 
function(data, name, specs, url, firstSpec, lastSpec, isAppend, script, id){
switch (this.vwr.openDataOrFile(data, name, specs, url, firstSpec, lastSpec, isAppend, id)) {
case 0:
if (script != null) this.runScript(script);
break;
case -1:
return;
default:
this.siSetSelectedPanel(null);
return;
}
JU.Logger.info(this.appletFrame.getAppletInfo() + " File " + this.vwr.currentSource.getFilePath() + " Loaded Successfully");
}, "~O,~S,JU.Lst,~S,~N,~N,~B,~S,~S");
Clazz_overrideMethod(c$, "siProcessCommand", 
function(scriptItem){
this.vwr.runScriptNow(scriptItem);
}, "~S");
Clazz_overrideMethod(c$, "siSetSelectedPanel", 
function(jsvp){
this.vwr.mainPanel.setSelectedPanel(this.vwr, jsvp, this.vwr.panelNodes);
this.vwr.spectraTree.setSelectedPanel(this, jsvp);
if (jsvp == null) {
jsvp = this.appletFrame.getJSVPanel(this.vwr, null);
this.vwr.mainPanel.setSelectedPanel(this.vwr, jsvp, null);
}this.appletFrame.validate();
if (jsvp != null) {
jsvp.setEnabled(true);
jsvp.setFocusable(true);
}}, "JSV.api.JSVPanel");
Clazz_overrideMethod(c$, "siExecSetCallback", 
function(st, value){
switch (st) {
case JSV.common.ScriptToken.APPLETREADYCALLBACKFUNCTIONNAME:
this.appletReadyCallbackFunctionName = value;
break;
case JSV.common.ScriptToken.LOADFILECALLBACKFUNCTIONNAME:
this.loadFileCallbackFunctionName = value;
break;
case JSV.common.ScriptToken.PEAKCALLBACKFUNCTIONNAME:
this.peakCallbackFunctionName = value;
break;
case JSV.common.ScriptToken.SYNCCALLBACKFUNCTIONNAME:
this.syncCallbackFunctionName = value;
break;
case JSV.common.ScriptToken.COORDCALLBACKFUNCTIONNAME:
this.coordCallbackFunctionName = value;
break;
}
}, "JSV.common.ScriptToken,~S");
Clazz_overrideMethod(c$, "siLoaded", 
function(value){
if (this.loadFileCallbackFunctionName != null) this.appletFrame.callToJavaScript(this.loadFileCallbackFunctionName,  Clazz_newArray(-1, [this.vwr.appletName, value]));
this.updateJSView(null);
return null;
}, "~S");
Clazz_overrideMethod(c$, "siExecHidden", 
function(b){
}, "~B");
Clazz_overrideMethod(c$, "siExecScriptComplete", 
function(msg, isOK){
if (!isOK) this.vwr.showMessage(msg);
this.siValidateAndRepaint(false);
}, "~S,~B");
Clazz_overrideMethod(c$, "siUpdateBoolean", 
function(st, TF){
}, "JSV.common.ScriptToken,~B");
Clazz_overrideMethod(c$, "siCheckCallbacks", 
function(title){
this.checkCallbacks();
}, "~S");
Clazz_overrideMethod(c$, "siNodeSet", 
function(panelNode){
this.appletFrame.validateContent(2);
this.siValidateAndRepaint(false);
}, "JSV.common.PanelNode");
Clazz_overrideMethod(c$, "siSourceClosed", 
function(source){
}, "JSV.source.JDXSource");
Clazz_overrideMethod(c$, "siGetNewJSVPanel", 
function(spec){
if (spec == null) {
this.vwr.initialEndIndex = this.vwr.initialStartIndex = -1;
return null;
}var specs =  new JU.Lst();
specs.addLast(spec);
var jsvp = this.appletFrame.getJSVPanel(this.vwr, specs);
jsvp.getPanelData().addListener(this);
this.vwr.parameters.setFor(jsvp, null, true);
return jsvp;
}, "JSV.common.Spectrum");
Clazz_overrideMethod(c$, "siGetNewJSVPanel2", 
function(specs){
if (specs == null) {
this.vwr.initialEndIndex = this.vwr.initialStartIndex = -1;
return this.appletFrame.getJSVPanel(this.vwr, null);
}var jsvp = this.appletFrame.getJSVPanel(this.vwr, specs);
this.vwr.initialEndIndex = this.vwr.initialStartIndex = -1;
jsvp.getPanelData().addListener(this);
this.vwr.parameters.setFor(jsvp, null, true);
return jsvp;
}, "JU.Lst");
Clazz_overrideMethod(c$, "siSetPropertiesFromPreferences", 
function(jsvp, includeMeasures){
this.vwr.checkAutoIntegrate();
}, "JSV.api.JSVPanel,~B");
Clazz_overrideMethod(c$, "siSetLoaded", 
function(fileName, filePath){
}, "~S,~S");
Clazz_overrideMethod(c$, "siSetMenuEnables", 
function(node, isSplit){
}, "JSV.common.PanelNode,~B");
Clazz_overrideMethod(c$, "siUpdateRecentMenus", 
function(filePath){
}, "~S");
Clazz_overrideMethod(c$, "siExecTest", 
function(value){
var data = "";
this.loadInline(data);
}, "~S");
Clazz_overrideMethod(c$, "print", 
function(fileName){
return this.vwr.print(fileName);
}, "~S");
Clazz_overrideMethod(c$, "checkScript", 
function(script){
return this.vwr.checkScript(script);
}, "~S");
c$.getAppletInfo = Clazz_defineMethod(c$, "getAppletInfo", 
function(){
return "JSpecView Applet " + JSV.common.JSVersion.VERSION + "\n\n" + "Authors:\nProf. Robert M. Hanson,\nD. Facey, K. Bryan, C. Walters, Prof. Robert J. Lancashire and\nvolunteer developers through sourceforge.";
});
});
;//5.0.1-v7 Mon Aug 17 10:07:10 MDT 2026
Clazz_declarePackage("JSV.app");
Clazz_load(["J.api.GenericMouseInterface"], "JSV.app.GenericMouse", ["JU.Logger"], function(){
var c$ = Clazz_decorateAsClass(function(){
this.pd = null;
this.jsvp = null;
this.xWhenPressed = 0;
this.yWhenPressed = 0;
this.modifiersWhenPressed10 = 0;
this.isMouseDown = false;
this.disposed = false;
Clazz_instantialize(this, arguments);}, JSV.app, "GenericMouse", null, J.api.GenericMouseInterface);
Clazz_makeConstructor(c$, 
function(jsvp){
this.jsvp = jsvp;
this.pd = jsvp.getPanelData();
}, "JSV.api.JSVPanel");
Clazz_overrideMethod(c$, "clear", 
function(){
});
Clazz_overrideMethod(c$, "processEvent", 
function(id, x, y, modifiers, time){
if (this.pd == null) {
if (!this.disposed && id == 501 && (modifiers & 4) != 0) this.jsvp.showMenu(x, y);
return true;
}if (id != 507) modifiers = JSV.app.GenericMouse.applyLeftMouse(modifiers);
switch (id) {
case 507:
this.wheeled(time, x, modifiers | 32);
break;
case 501:
this.xWhenPressed = x;
this.yWhenPressed = y;
this.modifiersWhenPressed10 = modifiers;
this.pressed(time, x, y, modifiers, false);
break;
case 506:
this.dragged(time, x, y, modifiers);
break;
case 504:
this.entered(time, x, y);
break;
case 505:
this.exited(time, x, y);
break;
case 503:
this.moved(time, x, y, modifiers);
break;
case 502:
this.released(time, x, y, modifiers);
if (x == this.xWhenPressed && y == this.yWhenPressed && modifiers == this.modifiersWhenPressed10) {
this.clicked(time, x, y, modifiers, 1);
}break;
default:
return false;
}
return true;
}, "~N,~N,~N,~N,~N");
Clazz_defineMethod(c$, "mouseEntered", 
function(e){
this.entered(e.getWhen(), e.getX(), e.getY());
}, "java.awt.event.MouseEvent");
Clazz_defineMethod(c$, "mouseExited", 
function(e){
this.exited(e.getWhen(), e.getX(), e.getY());
}, "java.awt.event.MouseEvent");
Clazz_defineMethod(c$, "mouseMoved", 
function(e){
this.moved(e.getWhen(), e.getX(), e.getY(), e.getModifiers());
}, "java.awt.event.MouseEvent");
Clazz_defineMethod(c$, "mousePressed", 
function(e){
this.pressed(e.getWhen(), e.getX(), e.getY(), e.getModifiers(), e.isPopupTrigger());
}, "java.awt.event.MouseEvent");
Clazz_defineMethod(c$, "mouseDragged", 
function(e){
var modifiers = e.getModifiers();
if ((modifiers & 28) == 0) modifiers |= 16;
this.dragged(e.getWhen(), e.getX(), e.getY(), modifiers);
}, "java.awt.event.MouseEvent");
Clazz_defineMethod(c$, "mouseReleased", 
function(e){
this.released(e.getWhen(), e.getX(), e.getY(), e.getModifiers());
}, "java.awt.event.MouseEvent");
Clazz_defineMethod(c$, "mouseClicked", 
function(e){
this.clicked(e.getWhen(), e.getX(), e.getY(), e.getModifiers(), e.getClickCount());
}, "java.awt.event.MouseEvent");
Clazz_defineMethod(c$, "mouseWheelMoved", 
function(e){
e.consume();
this.wheeled(e.getWhen(), e.getWheelRotation(), e.getModifiers() | 32);
}, "java.awt.event.MouseWheelEvent");
Clazz_defineMethod(c$, "keyTyped", 
function(ke){
if (this.pd == null) return;
var ch = ke.getKeyChar();
var modifiers = ke.getModifiers();
if (JU.Logger.debuggingHigh || true) JU.Logger.info("MouseManager keyTyped: " + ch + " " + (0 + ch.charCodeAt(0)) + " " + modifiers);
if (this.pd.keyTyped(ch.charCodeAt(0), modifiers)) ke.consume();
}, "java.awt.event.KeyEvent");
Clazz_defineMethod(c$, "keyPressed", 
function(ke){
if (this.pd != null && this.pd.keyPressed(ke.getKeyCode(), ke.getModifiers())) ke.consume();
}, "java.awt.event.KeyEvent");
Clazz_defineMethod(c$, "keyReleased", 
function(ke){
if (this.pd != null) this.pd.keyReleased(ke.getKeyCode());
}, "java.awt.event.KeyEvent");
Clazz_overrideMethod(c$, "processKeyEvent", 
function(event){
var e = event;
switch (e.getID()) {
case 401:
this.keyPressed(e);
break;
case 402:
this.keyReleased(e);
break;
case 400:
this.keyTyped(e);
break;
}
}, "~O");
Clazz_defineMethod(c$, "entered", 
function(time, x, y){
if (this.pd != null) this.pd.mouseEnterExit(time, x, y, false);
}, "~N,~N,~N");
Clazz_defineMethod(c$, "exited", 
function(time, x, y){
if (this.pd != null) this.pd.mouseEnterExit(time, x, y, true);
}, "~N,~N,~N");
Clazz_defineMethod(c$, "clicked", 
function(time, x, y, modifiers, clickCount){
if (this.pd != null) this.pd.mouseAction(2, time, x, y, 1, modifiers);
}, "~N,~N,~N,~N,~N");
Clazz_defineMethod(c$, "moved", 
function(time, x, y, modifiers){
if (this.pd == null) return;
if (this.isMouseDown) this.pd.mouseAction(1, time, x, y, 0, JSV.app.GenericMouse.applyLeftMouse(modifiers));
 else this.pd.mouseAction(0, time, x, y, 0, modifiers & -29);
}, "~N,~N,~N,~N");
Clazz_defineMethod(c$, "wheeled", 
function(time, rotation, modifiers){
if (this.pd != null) this.pd.mouseAction(3, time, 0, rotation, 0, modifiers);
}, "~N,~N,~N");
Clazz_defineMethod(c$, "pressed", 
function(time, x, y, modifiers, isPopupTrigger){
if (this.pd == null) {
if (!this.disposed) this.jsvp.showMenu(x, y);
return;
}this.isMouseDown = true;
this.pd.mouseAction(4, time, x, y, 0, modifiers);
}, "~N,~N,~N,~N,~B");
Clazz_defineMethod(c$, "released", 
function(time, x, y, modifiers){
if (this.pd == null) return;
this.isMouseDown = false;
this.pd.mouseAction(5, time, x, y, 0, modifiers);
}, "~N,~N,~N,~N");
Clazz_defineMethod(c$, "dragged", 
function(time, x, y, modifiers){
if (this.pd == null) return;
if ((modifiers & 20) == 20) modifiers = modifiers & -5 | 2;
this.pd.mouseAction(1, time, x, y, 0, modifiers);
}, "~N,~N,~N,~N");
c$.applyLeftMouse = Clazz_defineMethod(c$, "applyLeftMouse", 
function(modifiers){
return ((modifiers & 28) == 0) ? (modifiers | 16) : modifiers;
}, "~N");
Clazz_overrideMethod(c$, "processTwoPointGesture", 
function(touches){
}, "~A");
Clazz_overrideMethod(c$, "dispose", 
function(){
this.pd = null;
this.jsvp = null;
this.disposed = true;
});
});
;//5.0.1-v7 Mon Aug 17 10:07:10 MDT 2026
Clazz_declarePackage("JSV.appletjs");
Clazz_load(["javajs.api.JSInterface", "JSV.api.AppletFrame", "$.JSVAppletInterface"], "JSV.appletjs.JSVApplet", ["java.net.URL", "java.util.Hashtable", "JU.PT", "JSV.app.JSVApp", "JSV.js2d.JsMainPanel", "$.JsPanel", "JU.Logger"], function(){
var c$ = Clazz_decorateAsClass(function(){
this.app = null;
this.viewer = null;
this.isStandalone = false;
this.viewerOptions = null;
this.htParams = null;
Clazz_instantialize(this, arguments);}, JSV.appletjs, "JSVApplet", null, [JSV.api.JSVAppletInterface, JSV.api.AppletFrame, javajs.api.JSInterface]);
Clazz_makeConstructor(c$, 
function(viewerOptions){
if (viewerOptions == null) viewerOptions =  new java.util.Hashtable();
this.viewerOptions = viewerOptions;
this.htParams =  new java.util.Hashtable();
for (var entry, $entry = viewerOptions.entrySet().iterator (); $entry.hasNext()&& ((entry = $entry.next ()) || true);) this.htParams.put(entry.getKey().toLowerCase(), entry.getValue());

this.init();
}, "java.util.Map");
Clazz_defineMethod(c$, "init", 
function(){
this.app =  new JSV.app.JSVApp(this, true);
this.initViewer();
if (this.app.appletReadyCallbackFunctionName != null && this.viewer.fullName != null) this.callToJavaScript(this.app.appletReadyCallbackFunctionName,  Clazz_newArray(-1, [this.viewer.appletName, this.viewer.fullName, Boolean.TRUE, this]));
});
Clazz_defineMethod(c$, "initViewer", 
function(){
this.viewer = this.app.vwr;
this.setLogging();
this.viewerOptions.remove("debug");
var o = this.viewerOptions.get("display");
{
o = document.getElementById(o);
}this.viewer.setDisplay(o);
JU.Logger.info(this.getAppletInfo());
});
Clazz_defineMethod(c$, "setLogging", 
function(){
var iLevel = ((this.getValue("logLevel", (this.getBooleanValue("debug", false) ? "5" : "4"))).charAt(0)).charCodeAt(0) - 48;
if (iLevel != 4) System.out.println("setting logLevel=" + iLevel + " -- To change, use script \"set logLevel [0-5]\"");
JU.Logger.setLogLevel(iLevel);
});
Clazz_defineMethod(c$, "getParameter", 
function(paramName){
var o = this.htParams.get(paramName.toLowerCase());
return (o == null ? null : o.toString());
}, "~S");
Clazz_defineMethod(c$, "getBooleanValue", 
function(propertyName, defaultValue){
var value = this.getValue(propertyName, defaultValue ? "true" : "");
return (value.equalsIgnoreCase("true") || value.equalsIgnoreCase("on") || value.equalsIgnoreCase("yes"));
}, "~S,~B");
Clazz_defineMethod(c$, "getValue", 
function(propertyName, defaultValue){
var stringValue = this.getParameter(propertyName);
System.out.println("getValue " + propertyName + " = " + stringValue);
if (stringValue != null) return stringValue;
return defaultValue;
}, "~S,~S");
Clazz_overrideMethod(c$, "isPro", 
function(){
return this.app.isPro();
});
Clazz_overrideMethod(c$, "isSigned", 
function(){
return this.app.isSigned();
});
Clazz_overrideMethod(c$, "destroy", 
function(){
this.app.dispose();
this.app = null;
});
Clazz_defineMethod(c$, "getParameter", 
function(key, def){
return this.isStandalone ? System.getProperty(key, def) : (this.getParameter(key) != null ? this.getParameter(key) : def);
}, "~S,~S");
Clazz_overrideMethod(c$, "getAppletInfo", 
function(){
return JSV.app.JSVApp.getAppletInfo();
});
Clazz_overrideMethod(c$, "getSolnColour", 
function(){
return this.app.getSolnColour();
});
Clazz_overrideMethod(c$, "getCoordinate", 
function(){
return this.app.getCoordinate();
});
Clazz_overrideMethod(c$, "loadInline", 
function(data){
this.app.loadInline(data);
}, "~S");
Clazz_defineMethod(c$, "$export", 
function(type, n){
return this.app.exportSpectrum(type, n);
}, "~S,~N");
Clazz_overrideMethod(c$, "exportSpectrum", 
function(type, n){
return this.app.exportSpectrum(type, n);
}, "~S,~N");
Clazz_overrideMethod(c$, "setFilePath", 
function(tmpFilePath){
this.app.setFilePath(tmpFilePath);
}, "~S");
Clazz_overrideMethod(c$, "setSpectrumNumber", 
function(i){
this.app.setSpectrumNumber(i);
}, "~N");
Clazz_overrideMethod(c$, "toggleGrid", 
function(){
this.app.toggleGrid();
});
Clazz_overrideMethod(c$, "toggleCoordinate", 
function(){
this.app.toggleCoordinate();
});
Clazz_overrideMethod(c$, "togglePointsOnly", 
function(){
this.app.togglePointsOnly();
});
Clazz_overrideMethod(c$, "toggleIntegration", 
function(){
this.app.toggleIntegration();
});
Clazz_overrideMethod(c$, "addHighlight", 
function(x1, x2, r, g, b, a){
this.app.addHighlight(x1, x2, r, g, b, a);
}, "~N,~N,~N,~N,~N,~N");
Clazz_overrideMethod(c$, "removeAllHighlights", 
function(){
this.app.removeAllHighlights();
});
Clazz_overrideMethod(c$, "removeHighlight", 
function(x1, x2){
this.app.removeHighlight(x1, x2);
}, "~N,~N");
Clazz_overrideMethod(c$, "reversePlot", 
function(){
this.app.reversePlot();
});
Clazz_defineMethod(c$, "script", 
function(script){
this.app.initParams(script);
}, "~S");
Clazz_overrideMethod(c$, "runScript", 
function(script){
this.app.runScript(script);
}, "~S");
Clazz_overrideMethod(c$, "syncScript", 
function(peakScript){
this.app.syncScript(peakScript);
}, "~S");
Clazz_overrideMethod(c$, "writeStatus", 
function(msg){
this.app.writeStatus(msg);
}, "~S");
Clazz_overrideMethod(c$, "getPropertyAsJavaObject", 
function(key){
return this.app.getPropertyAsJavaObject(key);
}, "~S");
Clazz_overrideMethod(c$, "getPropertyAsJSON", 
function(key){
return this.app.getPropertyAsJSON(key);
}, "~S");
Clazz_overrideMethod(c$, "runScriptNow", 
function(script){
return this.app.runScriptNow(script);
}, "~S");
Clazz_overrideMethod(c$, "print", 
function(fileName){
return this.app.print(fileName);
}, "~S");
Clazz_overrideMethod(c$, "setDropTargetListener", 
function(isSigned, viewer){
}, "~B,JSV.common.JSViewer");
Clazz_overrideMethod(c$, "validateContent", 
function(mode){
}, "~N");
Clazz_overrideMethod(c$, "createMainPanel", 
function(viewer){
viewer.mainPanel =  new JSV.js2d.JsMainPanel();
}, "JSV.common.JSViewer");
Clazz_overrideMethod(c$, "newWindow", 
function(isSelected){
}, "~B");
Clazz_overrideMethod(c$, "callToJavaScript", 
function(callback, data){
var tokens = JU.PT.split(callback, ".");
{
try{
var o = window[tokens[0]]
for (var i = 1; i < tokens.length; i++){
o = o[tokens[i]]
}
return o(data[0],data[1],data[2],data[3],data[4],data[5],data[6],data[7],data[8],data[9]);
} catch (e) {
System.out.println(callback + " failed " + e);
}
}}, "~S,~A");
Clazz_overrideMethod(c$, "setPanelVisible", 
function(b){
}, "~B");
Clazz_overrideMethod(c$, "getJSVPanel", 
function(viewer, specs){
return (specs == null ? JSV.js2d.JsPanel.getEmptyPanel(viewer) : JSV.js2d.JsPanel.getPanelMany(viewer, specs));
}, "JSV.common.JSViewer,JU.Lst");
Clazz_overrideMethod(c$, "getDocumentBase", 
function(){
try {
return  new java.net.URL(Clazz_castNullAs("java.net.URL"), this.viewerOptions.get("documentBase"), null);
} catch (e) {
if (Clazz_exceptionOf(e,"java.net.MalformedURLException")){
return null;
} else {
throw e;
}
}
});
Clazz_overrideMethod(c$, "repaint", 
function(){
});
Clazz_overrideMethod(c$, "validate", 
function(){
});
Clazz_overrideMethod(c$, "doExitJmol", 
function(){
});
Clazz_overrideMethod(c$, "getApp", 
function(){
return this.app;
});
Clazz_overrideMethod(c$, "setStatusDragDropped", 
function(mode, x, y, fileName, retType){
return true;
}, "~N,~N,~N,~S,~A");
Clazz_overrideMethod(c$, "cacheFileByName", 
function(fileName, isAdd){
return 0;
}, "~S,~B");
Clazz_overrideMethod(c$, "cachePut", 
function(key, data){
}, "~S,~O");
Clazz_overrideMethod(c$, "getFullName", 
function(){
return this.app.vwr.fullName;
});
Clazz_overrideMethod(c$, "processMouseEvent", 
function(id, x, y, modifiers, time){
return this.app.vwr.processMouseEvent(id, x, y, modifiers, time);
}, "~N,~N,~N,~N,~N");
Clazz_overrideMethod(c$, "setDisplay", 
function(canvas){
this.app.vwr.setDisplay(canvas);
}, "~O");
Clazz_overrideMethod(c$, "startHoverWatcher", 
function(enable){
}, "~B");
Clazz_overrideMethod(c$, "update", 
function(){
this.app.vwr.updateJS();
});
Clazz_defineMethod(c$, "openFile", 
function(fileName){
this.app.vwr.openFile(fileName, true);
return null;
}, "~S");
Clazz_overrideMethod(c$, "openFileAsyncSpecial", 
function(fileName, flags){
this.app.vwr.openFileAsyncSpecial(fileName, flags);
}, "~S,~N");
Clazz_overrideMethod(c$, "openFileAsyncSpecialType", 
function(fileName, flags, type){
this.openFileAsyncSpecial(fileName, flags);
}, "~S,~N,~S");
Clazz_overrideMethod(c$, "processTwoPointGesture", 
function(touches){
this.app.vwr.processTwoPointGesture(touches);
}, "~A");
Clazz_overrideMethod(c$, "setScreenDimension", 
function(width, height){
this.app.vwr.setScreenDimension(width, height);
}, "~N,~N");
Clazz_overrideMethod(c$, "checkScript", 
function(script){
var s = this.app.checkScript(script);
if (s != null) System.out.println(s);
return s;
}, "~S");
Clazz_overrideMethod(c$, "processKeyEvent", 
function(event){
}, "~O");
});
;//5.0.1-v7 Mon Aug 17 10:07:10 MDT 2026
Clazz_declarePackage("JSV.common");
Clazz_load(["java.lang.Enum", "JSV.common.Coordinate"], "JSV.common.Annotation", ["JU.CU"], function(){
var c$ = Clazz_decorateAsClass(function(){
this.text = "";
this.$isPixels = false;
this.is2D = false;
this.offsetX = 0;
this.offsetY = 0;
this.spec = null;
Clazz_instantialize(this, arguments);}, JSV.common, "Annotation", JSV.common.Coordinate);
Clazz_defineMethod(c$, "setA", 
function(x, y, spec, text, isPixels, is2D, offsetX, offsetY){
this.set(x, y);
this.spec = spec;
this.text = text;
this.$isPixels = isPixels;
this.is2D = is2D;
this.offsetX = offsetX;
this.offsetY = offsetY;
return this;
}, "~N,~N,JSV.common.Spectrum,~S,~B,~B,~N,~N");
Clazz_defineMethod(c$, "setSpec", 
function(spec){
this.spec = spec;
return this;
}, "JSV.common.Spectrum");
Clazz_defineMethod(c$, "addSpecShift", 
function(dx){
this.setXVal(this.getXVal() + dx);
}, "~N");
Clazz_defineMethod(c$, "isPixels", 
function(){
return this.$isPixels;
});
Clazz_overrideMethod(c$, "toString", 
function(){
return "[" + this.getXVal() + ", " + this.getYVal() + "," + this.text + "]";
});
c$.getColoredAnnotation = Clazz_defineMethod(c$, "getColoredAnnotation", 
function(g2d, spec, args, lastAnnotation){
var arg;
var xPt = 0;
var yPt = 1;
var colorPt = 2;
var textPt = 3;
var nArgs = args.size();
try {
switch (nArgs) {
default:
return null;
case 1:
arg = args.get(0);
xPt = yPt = -1;
if (arg.charAt(0) == '\"') {
textPt = 0;
colorPt = -1;
} else {
colorPt = 0;
textPt = -1;
}break;
case 2:
xPt = yPt = -1;
arg = args.get(0);
if (arg.charAt(0) == '\"') {
textPt = 0;
colorPt = 1;
} else {
colorPt = 0;
textPt = 1;
}break;
case 3:
case 4:
arg = args.get(2);
if (arg.charAt(0) == '\"') {
textPt = 2;
colorPt = (nArgs == 4 ? 3 : -1);
} else {
colorPt = 2;
textPt = (nArgs == 4 ? 3 : -1);
}arg = args.get(2);
if (arg.charAt(0) == '\"') {
textPt = 2;
colorPt = -1;
} else {
colorPt = 2;
textPt = -1;
}}
if (lastAnnotation == null && (xPt < 0 || yPt < 0 || textPt < 0 || colorPt < 0)) return null;
var x = (xPt < 0 ? lastAnnotation.getXVal() : Double.$valueOf(args.get(xPt)).doubleValue());
var y = (yPt < 0 ? lastAnnotation.getYVal() : Double.$valueOf(args.get(yPt)).doubleValue());
var color = (colorPt < 0 ? (lastAnnotation).getColor() : g2d.getColor1(JU.CU.getArgbFromString(args.get(colorPt))));
var text;
if (textPt < 0) {
text = lastAnnotation.text;
} else {
text = args.get(textPt);
if (text.charAt(0) == '\"') text = text.substring(1, text.length - 1);
}return  new JSV.common.ColoredAnnotation().setCA(x, y, spec, text, color, false, false, 0, 0);
} catch (e) {
if (Clazz_exceptionOf(e, Exception)){
return null;
} else {
throw e;
}
}
}, "J.api.GenericGraphics,JSV.common.Spectrum,JU.Lst,JSV.common.Annotation");
/*if2*/;(function(){
var c$ = Clazz_declareType(JSV.common.Annotation, "AType", Enum);
Clazz_defineEnumConstant(c$, "Integration", 0, []);
Clazz_defineEnumConstant(c$, "PeakList", 1, []);
Clazz_defineEnumConstant(c$, "Measurements", 2, []);
Clazz_defineEnumConstant(c$, "OverlayLegend", 3, []);
Clazz_defineEnumConstant(c$, "Views", 4, []);
Clazz_defineEnumConstant(c$, "NONE", 5, []);
/*eoif2*/})();
});
;//5.0.1-v7 Mon Aug 17 10:07:10 MDT 2026
Clazz_declarePackage("JSV.common");
Clazz_load(["JSV.common.Annotation"], "JSV.common.ColoredAnnotation", null, function(){
var c$ = Clazz_decorateAsClass(function(){
this.color = null;
Clazz_instantialize(this, arguments);}, JSV.common, "ColoredAnnotation", JSV.common.Annotation);
Clazz_makeConstructor(c$, 
function(){
Clazz_superConstructor (this, JSV.common.ColoredAnnotation, []);
});
Clazz_defineMethod(c$, "getColor", 
function(){
return this.color;
});
Clazz_defineMethod(c$, "setCA", 
function(x, y, spec, text, color, isPixels, is2D, offsetX, offsetY){
this.setA(x, y, spec, text, isPixels, is2D, offsetX, offsetY);
this.color = color;
return this;
}, "~N,~N,JSV.common.Spectrum,~S,javajs.api.GenericColor,~B,~B,~N,~N");
});
;//5.0.1-v7 Mon Aug 17 10:07:10 MDT 2026
Clazz_declarePackage("JSV.common");
Clazz_load(["JSV.common.Parameters"], "JSV.common.ColorParameters", ["java.util.Hashtable", "$.StringTokenizer", "JU.CU", "$.Lst", "JSV.common.ScriptToken"], function(){
var c$ = Clazz_decorateAsClass(function(){
this.titleFontName = null;
this.displayFontName = null;
this.elementColors = null;
this.plotColors = null;
this.isDefault = false;
Clazz_instantialize(this, arguments);}, JSV.common, "ColorParameters", JSV.common.Parameters);
Clazz_makeConstructor(c$, 
function(){
Clazz_superConstructor (this, JSV.common.ColorParameters, []);
JSV.common.ColorParameters.BLACK = this.getColor3(0, 0, 0);
JSV.common.ColorParameters.RED = this.getColor3(255, 0, 0);
JSV.common.ColorParameters.LIGHT_GRAY = this.getColor3(200, 200, 200);
JSV.common.ColorParameters.DARK_GRAY = this.getColor3(80, 80, 80);
JSV.common.ColorParameters.BLUE = this.getColor3(0, 0, 255);
JSV.common.ColorParameters.WHITE = this.getColor3(255, 255, 255);
this.elementColors =  new java.util.Hashtable();
this.setColor(JSV.common.ScriptToken.TITLECOLOR, JSV.common.ColorParameters.BLACK);
this.setColor(JSV.common.ScriptToken.UNITSCOLOR, JSV.common.ColorParameters.RED);
this.setColor(JSV.common.ScriptToken.SCALECOLOR, JSV.common.ColorParameters.BLACK);
this.setColor(JSV.common.ScriptToken.COORDINATESCOLOR, JSV.common.ColorParameters.RED);
this.setColor(JSV.common.ScriptToken.GRIDCOLOR, JSV.common.ColorParameters.LIGHT_GRAY);
this.setColor(JSV.common.ScriptToken.PLOTCOLOR, JSV.common.ColorParameters.BLUE);
this.setColor(JSV.common.ScriptToken.PLOTAREACOLOR, JSV.common.ColorParameters.WHITE);
this.setColor(JSV.common.ScriptToken.BACKGROUNDCOLOR, this.getColor3(192, 192, 192));
this.setColor(JSV.common.ScriptToken.INTEGRALPLOTCOLOR, JSV.common.ColorParameters.RED);
this.setColor(JSV.common.ScriptToken.PEAKTABCOLOR, JSV.common.ColorParameters.RED);
this.setColor(JSV.common.ScriptToken.PEAKOVERCOLOR, JSV.common.ColorParameters.RED);
this.setColor(JSV.common.ScriptToken.HIGHLIGHTCOLOR, JSV.common.ColorParameters.DARK_GRAY);
for (var i = 0; i < 8; i++) JSV.common.ColorParameters.defaultPlotColors[i] = this.getColorFromString(JSV.common.ColorParameters.defaultPlotColorNames[i]);

this.plotColors =  new Array(8);
System.arraycopy(JSV.common.ColorParameters.defaultPlotColors, 0, this.plotColors, 0, 8);
});
Clazz_defineMethod(c$, "setFor", 
function(jsvp, ds, includeMeasures){
if (ds == null) ds = this;
if (includeMeasures) jsvp.getPanelData().setBooleans(ds, null);
var pd = jsvp.getPanelData();
if (pd.getCurrentPlotColor(1) != null) pd.setPlotColors(this.plotColors);
pd.setColorOrFont(ds, null);
}, "JSV.api.JSVPanel,JSV.common.ColorParameters,~B");
Clazz_defineMethod(c$, "set", 
function(pd, st, value){
var param = null;
switch (st) {
default:
this.setP(pd, st, value);
return;
case JSV.common.ScriptToken.PLOTCOLORS:
if (pd == null) this.getPlotColors(value);
 else pd.setPlotColors(this.getPlotColors(value));
return;
case JSV.common.ScriptToken.BACKGROUNDCOLOR:
case JSV.common.ScriptToken.COORDINATESCOLOR:
case JSV.common.ScriptToken.GRIDCOLOR:
case JSV.common.ScriptToken.HIGHLIGHTCOLOR:
case JSV.common.ScriptToken.INTEGRALPLOTCOLOR:
case JSV.common.ScriptToken.PEAKOVERCOLOR:
case JSV.common.ScriptToken.PEAKTABCOLOR:
case JSV.common.ScriptToken.PLOTAREACOLOR:
case JSV.common.ScriptToken.PLOTCOLOR:
case JSV.common.ScriptToken.SCALECOLOR:
case JSV.common.ScriptToken.TITLECOLOR:
case JSV.common.ScriptToken.UNITSCOLOR:
param = this.setColorFromString(st, value);
break;
case JSV.common.ScriptToken.TITLEFONTNAME:
case JSV.common.ScriptToken.DISPLAYFONTNAME:
param = this.getFontName(st, value);
break;
}
if (pd == null) return;
if (param != null) pd.setColorOrFont(this, st);
}, "JSV.common.PanelData,JSV.common.ScriptToken,~S");
Clazz_defineMethod(c$, "getElementColor", 
function(st){
return this.elementColors.get(st);
}, "JSV.common.ScriptToken");
Clazz_defineMethod(c$, "setColor", 
function(st, color){
if (color != null) this.elementColors.put(st, color);
return color;
}, "JSV.common.ScriptToken,javajs.api.GenericColor");
Clazz_defineMethod(c$, "copy", 
function(){
return this.copy(this.name);
});
Clazz_defineMethod(c$, "setElementColors", 
function(p){
this.displayFontName = p.displayFontName;
for (var entry, $entry = p.elementColors.entrySet().iterator (); $entry.hasNext()&& ((entry = $entry.next ()) || true);) this.setColor(entry.getKey(), entry.getValue());

return this;
}, "JSV.common.ColorParameters");
Clazz_defineMethod(c$, "getColorFromString", 
function(name){
return this.getColor1(JU.CU.getArgbFromString(name));
}, "~S");
Clazz_defineMethod(c$, "getPlotColors", 
function(plotColorsStr){
if (plotColorsStr == null) {
this.plotColors[0] = this.getElementColor(JSV.common.ScriptToken.PLOTCOLOR);
return this.plotColors;
}var st =  new java.util.StringTokenizer(plotColorsStr, ",;.- ");
var colors =  new JU.Lst();
try {
while (st.hasMoreTokens()) colors.addLast(this.getColorFromString(st.nextToken()));

} catch (e) {
if (Clazz_exceptionOf(e, Exception)){
return null;
} else {
throw e;
}
}
return colors.toArray( new Array(colors.size()));
}, "~S");
Clazz_defineMethod(c$, "setColorFromString", 
function(st, value){
return this.setColor(st, this.getColorFromString(value));
}, "JSV.common.ScriptToken,~S");
Clazz_defineMethod(c$, "getFontName", 
function(st, value){
var isValid = this.isValidFontName(value);
switch (st) {
case JSV.common.ScriptToken.TITLEFONTNAME:
return (isValid ? this.titleFontName = value : this.titleFontName);
case JSV.common.ScriptToken.DISPLAYFONTNAME:
return (isValid ? this.displayFontName = value : this.displayFontName);
}
return null;
}, "JSV.common.ScriptToken,~S");
c$.BLACK = null;
c$.RED = null;
c$.LIGHT_GRAY = null;
c$.DARK_GRAY = null;
c$.BLUE = null;
c$.WHITE = null;
c$.defaultPlotColors =  new Array(8);
c$.defaultPlotColorNames =  Clazz_newArray(-1, ["black", "darkGreen", "darkred", "orange", "magenta", "cyan", "maroon", "darkGray"]);
});
;//5.0.1-v7 Mon Aug 17 10:07:10 MDT 2026
Clazz_declarePackage("JSV.common");
(function(){
var c$ = Clazz_declareType(JSV.common, "CoordComparator", null, java.util.Comparator);
Clazz_overrideMethod(c$, "compare", 
function(c1, c2){
return (c1.getXVal() > c2.getXVal() ? 1 : c1.getXVal() < c2.getXVal() ? -1 : 0);
}, "JSV.common.Coordinate,JSV.common.Coordinate");
})();
;//5.0.1-v7 Mon Aug 17 10:07:10 MDT 2026
Clazz_declarePackage("JSV.common");
Clazz_load(["JSV.common.CoordComparator"], "JSV.common.Coordinate", ["java.util.Arrays", "$.StringTokenizer", "JU.Lst"], function(){
var c$ = Clazz_decorateAsClass(function(){
this.xVal = 0;
this.yVal = 0;
Clazz_instantialize(this, arguments);}, JSV.common, "Coordinate", null);
/*LV!1824 unnec constructor*/Clazz_defineMethod(c$, "set", 
function(x, y){
this.xVal = x;
this.yVal = y;
return this;
}, "~N,~N");
Clazz_defineMethod(c$, "getXVal", 
function(){
return this.xVal;
});
Clazz_defineMethod(c$, "getYVal", 
function(){
return this.yVal;
});
Clazz_defineMethod(c$, "setXVal", 
function(val){
this.xVal = val;
}, "~N");
Clazz_defineMethod(c$, "setYVal", 
function(val){
this.yVal = val;
}, "~N");
Clazz_defineMethod(c$, "copy", 
function(){
return  new JSV.common.Coordinate().set(this.xVal, this.yVal);
});
Clazz_defineMethod(c$, "equals", 
function(coord){
return (coord.xVal == this.xVal && coord.yVal == this.yVal);
}, "JSV.common.Coordinate");
Clazz_overrideMethod(c$, "toString", 
function(){
return "[" + this.xVal + ", " + this.yVal + "]";
});
c$.isYInRange = Clazz_defineMethod(c$, "isYInRange", 
function(xyCoords, min, max){
return (JSV.common.Coordinate.getMinY(xyCoords, 0, xyCoords.length - 1) >= min && JSV.common.Coordinate.getMaxY(xyCoords, 0, xyCoords.length - 1) >= max);
}, "~A,~N,~N");
c$.normalise = Clazz_defineMethod(c$, "normalise", 
function(xyCoords, min, max){
var newXYCoords =  new Array(xyCoords.length);
var minY = JSV.common.Coordinate.getMinY(xyCoords, 0, xyCoords.length - 1);
var maxY = JSV.common.Coordinate.getMaxY(xyCoords, 0, xyCoords.length - 1);
var factor = (maxY - minY) / (max - min);
for (var i = 0; i < xyCoords.length; i++) newXYCoords[i] =  new JSV.common.Coordinate().set(xyCoords[i].getXVal(), ((xyCoords[i].getYVal() - minY) / factor) - min);

return newXYCoords;
}, "~A,~N,~N");
c$.reverse = Clazz_defineMethod(c$, "reverse", 
function(x){
var n = x.length;
for (var i = 0; i < n; i++) {
var v = x[i];
x[i] = x[--n];
x[n] = v;
}
return x;
}, "~A");
c$.parseDSV = Clazz_defineMethod(c$, "parseDSV", 
function(dataPoints, xFactor, yFactor){
var point;
var xval = 0;
var yval = 0;
var xyCoords =  new JU.Lst();
if (dataPoints.indexOf('(') >= 0) {
dataPoints = dataPoints.$replace('(', ' ').$replace(')', ' ').$replace(',', ' ');
}var delim = " \t\n\r\f,;";
var st =  new java.util.StringTokenizer(dataPoints, delim);
var tmp1;
var tmp2;
while (st.hasMoreTokens()) {
tmp1 = st.nextToken().trim();
tmp2 = st.nextToken().trim();
xval = Double.parseDouble(tmp1);
yval = Double.parseDouble(tmp2);
point =  new JSV.common.Coordinate().set(xval * xFactor, yval * yFactor);
xyCoords.addLast(point);
}
var coord =  new Array(xyCoords.size());
return xyCoords.toArray(coord);
}, "~S,~N,~N");
c$.deltaX = Clazz_defineMethod(c$, "deltaX", 
function(last, first, numPoints){
return (last - first) / (numPoints - 1);
}, "~N,~N,~N");
c$.removeScale = Clazz_defineMethod(c$, "removeScale", 
function(xyCoords, xScale, yScale){
JSV.common.Coordinate.applyScale(xyCoords, (1 / xScale), (1 / yScale));
}, "~A,~N,~N");
c$.applyScale = Clazz_defineMethod(c$, "applyScale", 
function(xyCoords, xScale, yScale){
if (xScale != 1 || yScale != 1) {
for (var i = 0; i < xyCoords.length; i++) {
xyCoords[i].setXVal(xyCoords[i].getXVal() * xScale);
xyCoords[i].setYVal(xyCoords[i].getYVal() * yScale);
}
}}, "~A,~N,~N");
c$.getMinX = Clazz_defineMethod(c$, "getMinX", 
function(coords, start, end){
var min = 1.7976931348623157E308;
for (var index = start; index <= end; index++) {
var tmp = coords[index].getXVal();
if (tmp < min) min = tmp;
}
return min;
}, "~A,~N,~N");
c$.getMinX = Clazz_defineMethod(c$, "getMinX", 
function(spectra, vd){
var min = 1.7976931348623157E308;
for (var i = 0; i < spectra.size(); i++) {
var xyCoords = spectra.get(i).getXYCoords();
var tmp = JSV.common.Coordinate.getMinX(xyCoords, vd.getStartingPointIndex(i), vd.getEndingPointIndex(i));
if (tmp < min) min = tmp;
}
return min;
}, "JU.Lst,JSV.common.ViewData");
c$.getMaxX = Clazz_defineMethod(c$, "getMaxX", 
function(coords, start, end){
var max = -1.7976931348623157E308;
for (var index = start; index <= end; index++) {
var tmp = coords[index].getXVal();
if (tmp > max) max = tmp;
}
return max;
}, "~A,~N,~N");
c$.getMaxX = Clazz_defineMethod(c$, "getMaxX", 
function(spectra, vd){
var max = -1.7976931348623157E308;
for (var i = 0; i < spectra.size(); i++) {
var xyCoords = spectra.get(i).getXYCoords();
var tmp = JSV.common.Coordinate.getMaxX(xyCoords, vd.getStartingPointIndex(i), vd.getEndingPointIndex(i));
if (tmp > max) max = tmp;
}
return max;
}, "JU.Lst,JSV.common.ViewData");
c$.getMinY = Clazz_defineMethod(c$, "getMinY", 
function(coords, start, end){
var min = 1.7976931348623157E308;
for (var index = start; index <= end; index++) {
var tmp = coords[index].getYVal();
if (tmp < min) min = tmp;
}
return min;
}, "~A,~N,~N");
c$.getMinYUser = Clazz_defineMethod(c$, "getMinYUser", 
function(spectra, vd){
var min = 1.7976931348623157E308;
for (var i = 0; i < spectra.size(); i++) {
var u = spectra.get(i).getUserYFactor();
var yref = spectra.get(i).getYRef();
var xyCoords = spectra.get(i).getXYCoords();
var tmp = (JSV.common.Coordinate.getMinY(xyCoords, vd.getStartingPointIndex(i), vd.getEndingPointIndex(i)) - yref) * u + yref;
if (tmp < min) min = tmp;
}
return min;
}, "JU.Lst,JSV.common.ViewData");
c$.getMaxY = Clazz_defineMethod(c$, "getMaxY", 
function(coords, start, end){
var max = -1.7976931348623157E308;
for (var index = start; index <= end; index++) {
var tmp = coords[index].getYVal();
if (tmp > max) max = tmp;
}
return max;
}, "~A,~N,~N");
c$.getMaxYUser = Clazz_defineMethod(c$, "getMaxYUser", 
function(spectra, vd){
var max = -1.7976931348623157E308;
for (var i = 0; i < spectra.size(); i++) {
var u = spectra.get(i).getUserYFactor();
var yref = spectra.get(i).getYRef();
var xyCoords = spectra.get(i).getXYCoords();
var tmp = (JSV.common.Coordinate.getMaxY(xyCoords, vd.getStartingPointIndex(i), vd.getEndingPointIndex(i)) - yref) * u + yref;
if (tmp > max) max = tmp;
}
return max;
}, "JU.Lst,JSV.common.ViewData");
c$.getYValueAt = Clazz_defineMethod(c$, "getYValueAt", 
function(xyCoords, xPt){
var i = JSV.common.Coordinate.getNearestIndexForX(xyCoords, xPt);
if (i == 0 || i == xyCoords.length) return NaN;
var x1 = xyCoords[i].getXVal();
var x0 = xyCoords[i - 1].getXVal();
var y1 = xyCoords[i].getYVal();
var y0 = xyCoords[i - 1].getYVal();
if (x1 == x0) return y1;
return y0 + (y1 - y0) / (x1 - x0) * (xPt - x0);
}, "~A,~N");
c$.intoRange = Clazz_defineMethod(c$, "intoRange", 
function(i, i0, i1){
return Math.max(Math.min(i, i1), i0);
}, "~N,~N,~N");
c$.getNearestIndexForX = Clazz_defineMethod(c$, "getNearestIndexForX", 
function(xyCoords, xPt){
var x =  new JSV.common.Coordinate().set(xPt, 0);
var i = java.util.Arrays.binarySearch(xyCoords, x, JSV.common.Coordinate.c);
if (i < 0) i = -1 - i;
if (i < 0) return 0;
if (i > xyCoords.length - 1) return xyCoords.length - 1;
return i;
}, "~A,~N");
c$.findXForPeakNearest = Clazz_defineMethod(c$, "findXForPeakNearest", 
function(xyCoords, x, isMin){
var pt = JSV.common.Coordinate.getNearestIndexForX(xyCoords, x);
var f = (isMin ? -1 : 1);
while (pt < xyCoords.length - 1 && f * (xyCoords[pt + 1].yVal - xyCoords[pt].yVal) > 0) pt++;

while (pt >= 1 && f * (xyCoords[pt - 1].yVal - xyCoords[pt].yVal) > 0) pt--;

if (pt == 0 || pt == xyCoords.length - 1) return xyCoords[pt].xVal;
return JSV.common.Coordinate.parabolicInterpolation(xyCoords, pt);
}, "~A,~N,~B");
c$.parabolicInterpolation = Clazz_defineMethod(c$, "parabolicInterpolation", 
function(xyCoords, pt){
var alpha = xyCoords[pt - 1].yVal;
var beta = xyCoords[pt].yVal;
var gamma = xyCoords[pt + 1].yVal;
var p = (alpha - gamma) / 2 / (alpha - 2 * beta + gamma);
return xyCoords[pt].xVal + p * (xyCoords[pt + 1].xVal - xyCoords[pt].xVal);
}, "~A,~N");
c$.getPickedCoordinates = Clazz_defineMethod(c$, "getPickedCoordinates", 
function(coordsClicked, coordClicked, coord, actualCoord){
if (coordClicked == null) return false;
var x = coordClicked.getXVal();
coord.setXVal(x);
coord.setYVal(coordClicked.getYVal());
if (actualCoord == null) return true;
var pt = JSV.common.Coordinate.getNearestIndexForX(coordsClicked, x);
actualCoord.setXVal(coordsClicked[pt].getXVal());
actualCoord.setYVal(coordsClicked[pt].getYVal());
return true;
}, "~A,JSV.common.Coordinate,JSV.common.Coordinate,JSV.common.Coordinate");
c$.shiftX = Clazz_defineMethod(c$, "shiftX", 
function(xyCoords, dx){
for (var i = xyCoords.length; --i >= 0; ) xyCoords[i].xVal += dx;

}, "~A,~N");
c$.getNearestXWithYAbove = Clazz_defineMethod(c$, "getNearestXWithYAbove", 
function(xyCoords, x, y, inverted, andGreaterThanX){
var pt = JSV.common.Coordinate.getNearestIndexForX(xyCoords, x);
var f = (inverted ? -1 : 1);
if (andGreaterThanX) while (pt < xyCoords.length && f * (xyCoords[pt].yVal - y) < 0) pt++;

 else while (pt >= 0 && f * (xyCoords[pt].yVal - y) < 0) pt--;

if (pt == -1 || pt == xyCoords.length) return NaN;
return JSV.common.Coordinate.findXForPeakNearest(xyCoords, xyCoords[pt].getXVal(), inverted);
}, "~A,~N,~N,~B,~B");
c$.c =  new JSV.common.CoordComparator();
});
;//5.0.1-v7 Mon Aug 17 10:07:10 MDT 2026
Clazz_declarePackage("JSV.common");
Clazz_load(["java.lang.Enum"], "JSV.common.ExportType", null, function(){
var c$ = Clazz_declareType(JSV.common, "ExportType", Enum);
c$.getType = Clazz_defineMethod(c$, "getType", 
function(type){
type = type.toUpperCase();
if (type.equalsIgnoreCase("Original...")) return JSV.common.ExportType.SOURCE;
if (type.startsWith("XML")) return JSV.common.ExportType.AML;
for (var mode, $mode = 0, $$mode = JSV.common.ExportType.values(); $mode < $$mode.length && ((mode = $$mode[$mode]) || true); $mode++) if (mode.name().equals(type)) return mode;

return JSV.common.ExportType.UNK;
}, "~S");
c$.isExportMode = Clazz_defineMethod(c$, "isExportMode", 
function(ext){
return (JSV.common.ExportType.getType(ext) !== JSV.common.ExportType.UNK);
}, "~S");
Clazz_defineEnumConstant(c$, "UNK", 0, []);
Clazz_defineEnumConstant(c$, "SOURCE", 1, []);
Clazz_defineEnumConstant(c$, "DIF", 2, []);
Clazz_defineEnumConstant(c$, "FIX", 3, []);
Clazz_defineEnumConstant(c$, "SQZ", 4, []);
Clazz_defineEnumConstant(c$, "PAC", 5, []);
Clazz_defineEnumConstant(c$, "XY", 6, []);
Clazz_defineEnumConstant(c$, "DIFDUP", 7, []);
Clazz_defineEnumConstant(c$, "PNG", 8, []);
Clazz_defineEnumConstant(c$, "JPG", 9, []);
Clazz_defineEnumConstant(c$, "SVG", 10, []);
Clazz_defineEnumConstant(c$, "SVGI", 11, []);
Clazz_defineEnumConstant(c$, "CML", 12, []);
Clazz_defineEnumConstant(c$, "AML", 13, []);
Clazz_defineEnumConstant(c$, "PDF", 14, []);
});
;//5.0.1-v7 Mon Aug 17 10:07:10 MDT 2026
Clazz_declarePackage("JSV.common");
Clazz_load(["JSV.common.XYScaleConverter", "java.util.Hashtable", "JU.BS", "$.Lst", "JSV.common.Coordinate"], "JSV.common.GraphSet", ["JU.DF", "$.PT", "JSV.common.Annotation", "$.ColorParameters", "$.ColoredAnnotation", "$.ImageView", "$.IntegralData", "$.Measurement", "$.MeasurementData", "$.PanelData", "$.Parameters", "$.PeakData", "$.PeakPickEvent", "$.PlotWidget", "$.ScaleData", "$.ScriptToken", "$.Spectrum", "$.ViewData", "JU.Logger"], function(){
var c$ = Clazz_decorateAsClass(function(){
this.gs2dLinkedX = null;
this.gs2dLinkedY = null;
this.cur1D2Locked = false;
this.highlights = null;
this.spectra = null;
this.isSplittable = true;
this.allowStacking = true;
this.annotations = null;
this.selectedSpectrumMeasurements = null;
this.selectedSpectrumIntegrals = null;
this.lastAnnotation = null;
this.pendingMeasurement = null;
this.pendingIntegral = null;
this.graphsTemp = null;
this.widgets = null;
this.isLinked = false;
this.haveSingleYScale = false;
this.iSpectrumMovedTo = -1;
this.iSpectrumClicked = 0;
this.iSpectrumSelected = -1;
this.stackSelected = false;
this.bsSelected = null;
this.viewData = null;
this.reversePlot = false;
this.nSplit = 1;
this.yStackOffsetPercent = 0;
this.showAllStacked = true;
this.viewList = null;
this.imageView = null;
this.pd = null;
this.sticky2Dcursor = false;
this.nSpectra = 0;
this.fracX = 1;
this.fracY = 1;
this.fX0 = 0;
this.fY0 = 0;
this.zoomBox1D = null;
this.zoomBox2D = null;
this.pin1Dx0 = null;
this.pin1Dx1 = null;
this.pin1Dy0 = null;
this.pin1Dy1 = null;
this.pin1Dx01 = null;
this.pin1Dy01 = null;
this.pin2Dx0 = null;
this.pin2Dx1 = null;
this.pin2Dy0 = null;
this.pin2Dy1 = null;
this.pin2Dx01 = null;
this.pin2Dy01 = null;
this.cur2Dx0 = null;
this.cur2Dx1 = null;
this.cur1D2x1 = null;
this.cur1D2x2 = null;
this.cur2Dy = null;
this.xPixel0 = 0;
this.yPixel0 = 0;
this.xPixel1 = 0;
this.yPixel1 = 0;
this.xPixels = 0;
this.yPixels = 0;
this.xPixel00 = 0;
this.yPixel00 = 0;
this.xPixel11 = 0;
this.yPixel11 = 0;
this.yPixel000 = 0;
this.xPixel10 = 0;
this.xPixels0 = 0;
this.xVArrows = 0;
this.xHArrows = 0;
this.yHArrows = 0;
this.allowStackedYScale = true;
this.drawXAxisLeftToRight = false;
this.xAxisLeftToRight = true;
this.iPreviousSpectrumClicked = -1;
this.$haveSelectedSpectrum = false;
this.zoomEnabled = false;
this.currentZoomIndex = 0;
this.lastClickX = NaN;
this.lastPixelX = 2147483647;
this.height = 0;
this.width = 0;
this.right = 0;
this.top = 0;
this.left = 0;
this.bottom = 0;
this.piMouseOver = null;
this.coordTemp = null;
this.FONT_PLAIN = 0;
this.FONT_BOLD = 1;
this.FONT_ITALIC = 2;
this.is2DSpectrum = false;
this.selectedMeasurement = null;
this.selectedIntegral = null;
this.lastXMax = NaN;
this.lastSpecClicked = -1;
this.inPlotMove = false;
this.xPixelMovedTo = -1;
this.xPixelMovedTo2 = -1;
this.yValueMovedTo = 0;
this.xValueMovedTo = 0;
this.haveLeftRightArrows = false;
this.xPixelPlot1 = 0;
this.xPixelPlot0 = 0;
this.yPixelPlot0 = 0;
this.yPixelPlot1 = 0;
this.nextClickForSetPeak = null;
this.closerX = 0;
this.closerY = 0;
this.splitterX = 0;
this.splitterY = 0;
this.isPrintingOrSaving = false;
this.mapX = null;
if (!Clazz_isClassDefined("JSV.common.GraphSet.Highlight")) {
JSV.common.GraphSet.$GraphSet$Highlight$ ();
}
this.widgetsAreSet = true;
this.lastIntDragX = 0;
this.nextClickMode = 0;
this.dialogs = null;
this.aIntegrationRatios = null;
this.jsvp = null;
this.image2D = null;
this.plotColors = null;
this.g2d = null;
this.gMain = null;
this.COLOR_GREY = -3;
this.COLOR_BLACK = -2;
this.COLOR_INTEGRAL = -1;
Clazz_instantialize(this, arguments);}, JSV.common, "GraphSet", null, JSV.common.XYScaleConverter);
Clazz_prepareFields (c$, function(){
this.highlights =  new JU.Lst();
this.spectra =  new JU.Lst();
this.graphsTemp =  new JU.Lst();
this.bsSelected =  new JU.BS();
this.coordTemp =  new JSV.common.Coordinate();
this.mapX =  new java.util.Hashtable();
});
Clazz_makeConstructor(c$, 
function(pd){
this.pd = pd;
this.jsvp = pd.jsvp;
this.g2d = pd.g2d;
}, "JSV.common.PanelData");
Clazz_defineMethod(c$, "setSpectrumMovedTo", 
function(i){
return this.iSpectrumMovedTo = i;
}, "~N");
Clazz_defineMethod(c$, "setSpectrumClicked", 
function(i){
this.stackSelected = this.showAllStacked;
if (i < 0 || this.iSpectrumClicked != i) {
this.lastClickX = NaN;
this.lastPixelX = 2147483647;
}this.iSpectrumClicked = this.setSpectrumSelected(this.setSpectrumMovedTo(i));
}, "~N");
Clazz_defineMethod(c$, "setSpectrumSelected", 
function(i){
var isNew = (i != this.iSpectrumSelected);
this.iSpectrumSelected = i;
if (isNew) {
this.getCurrentView();
}return this.iSpectrumSelected;
}, "~N");
Clazz_defineMethod(c$, "closeDialogsExcept", 
function(type){
if (this.dialogs != null) for (var e, $e = this.dialogs.entrySet().iterator (); $e.hasNext()&& ((e = $e.next ()) || true);) {
var ad = e.getValue();
if (JSV.common.GraphSet.isDialog(ad) && (type === JSV.common.Annotation.AType.NONE || ad.getAType() !== type)) (ad).setVisible(false);
}
}, "JSV.common.Annotation.AType");
Clazz_defineMethod(c$, "dispose", 
function(){
this.spectra = null;
this.viewData = null;
this.viewList = null;
this.annotations = null;
this.lastAnnotation = null;
this.pendingMeasurement = null;
this.imageView = null;
this.graphsTemp = null;
this.widgets = null;
this.disposeImage();
if (this.dialogs != null) for (var e, $e = this.dialogs.entrySet().iterator (); $e.hasNext()&& ((e = $e.next ()) || true);) {
var ad = e.getValue();
if (JSV.common.GraphSet.isDialog(ad)) (ad).dispose();
}
this.dialogs = null;
});
Clazz_defineMethod(c$, "isDrawNoSpectra", 
function(){
return (this.iSpectrumSelected == -2147483648);
});
Clazz_defineMethod(c$, "getFixedSelectedSpectrumIndex", 
function(){
return Math.max(this.iSpectrumSelected, 0);
});
Clazz_defineMethod(c$, "getSpectrum", 
function(){
return this.getSpectrumAt(this.getFixedSelectedSpectrumIndex()).getCurrentSubSpectrum();
});
Clazz_defineMethod(c$, "getSpectrumAt", 
function(index){
return this.spectra.get(index);
}, "~N");
Clazz_defineMethod(c$, "getSpectrumIndex", 
function(spec){
for (var i = this.spectra.size(); --i >= 0; ) if (this.spectra.get(i) === spec) return i;

return -1;
}, "JSV.common.Spectrum");
Clazz_defineMethod(c$, "addSpec", 
function(spec){
this.spectra.addLast(spec);
this.nSpectra++;
}, "JSV.common.Spectrum");
Clazz_defineMethod(c$, "splitStack", 
function(doSplit){
if (doSplit && this.isSplittable) {
this.nSplit = this.nSpectra;
this.showAllStacked = false;
this.setSpectrumClicked(this.iSpectrumSelected);
this.pd.currentSplitPoint = this.iSpectrumSelected;
} else {
this.nSplit = 1;
this.showAllStacked = this.allowStacking && !doSplit;
this.setSpectrumClicked(this.iSpectrumSelected);
}this.stackSelected = false;
JSV.common.GraphSet.setFractionalPositions(this.pd, this.pd.graphSets, JSV.common.PanelData.LinkMode.NONE);
this.pd.setTaintedAll();
}, "~B");
Clazz_defineMethod(c$, "setPositionForFrame", 
function(iSplit){
if (iSplit < 0) iSplit = 0;
var marginalHeight = this.height - 50;
this.xPixel00 = Clazz_doubleToInt(this.width * this.fX0);
this.xPixel11 = Clazz_doubleToInt(this.xPixel00 + this.width * this.fracX - 1);
this.xHArrows = this.xPixel00 + 25;
this.xVArrows = this.xPixel11 - Clazz_doubleToInt(this.right / 2);
this.xPixel0 = this.xPixel00 + Clazz_doubleToInt(this.left * (1 - this.fX0));
this.xPixel10 = this.xPixel1 = this.xPixel11 - this.right;
this.xPixels0 = this.xPixels = this.xPixel1 - this.xPixel0 + 1;
this.yPixel000 = (this.pd.isPrinting ? 100 : !this.isPrintingOrSaving && this.fY0 == 0 ? 25 : 0) + Clazz_doubleToInt(this.height * this.fY0);
this.yPixel00 = this.yPixel000 + Clazz_doubleToInt(marginalHeight * this.fracY * iSplit);
this.yPixel11 = this.yPixel00 + Clazz_doubleToInt(marginalHeight * this.fracY) - 1;
this.yHArrows = this.yPixel11 - 12;
this.yPixel0 = this.yPixel00 + Clazz_doubleToInt(this.top / 2);
this.yPixel1 = this.yPixel11 - Clazz_doubleToInt(this.bottom / 2);
this.yPixels = this.yPixel1 - this.yPixel0 + 1;
if (this.imageView != null && this.is2DSpectrum) {
this.setImageWindow();
if (this.pd.display1D) {
var widthRatio = (this.pd.display1D ? 1.0 * (this.xPixels0 - this.imageView.xPixels) / this.xPixels0 : 1);
this.xPixels = Clazz_doubleToInt(Math.floor(widthRatio * this.xPixels0 * 0.8));
this.xPixel1 = this.xPixel0 + this.xPixels - 1;
} else {
this.xPixels = 0;
this.xPixel1 = this.imageView.xPixel0 - 30;
}}}, "~N");
Clazz_defineMethod(c$, "hasPoint", 
function(xPixel, yPixel){
return (xPixel >= this.xPixel00 && xPixel <= this.xPixel11 && yPixel >= this.yPixel000 && yPixel <= this.yPixel11 * this.nSplit);
}, "~N,~N");
Clazz_defineMethod(c$, "isInPlotRegion", 
function(xPixel, yPixel){
return (xPixel >= this.xPixel0 && xPixel <= this.xPixel1 && yPixel >= this.yPixel0 && yPixel <= this.yPixel1);
}, "~N,~N");
Clazz_defineMethod(c$, "getSplitPoint", 
function(yPixel){
return (this.yPixel1 == this.yPixel00 ? 0 : Math.max(0, Math.min(Clazz_doubleToInt((yPixel - this.yPixel000) / (this.yPixel11 - this.yPixel00)), this.nSplit - 1)));
}, "~N");
Clazz_defineMethod(c$, "isSplitWidget", 
function(xPixel, yPixel){
return this.isFrameBox(xPixel, yPixel, this.splitterX, this.splitterY);
}, "~N,~N");
Clazz_defineMethod(c$, "isCloserWidget", 
function(xPixel, yPixel){
return this.isFrameBox(xPixel, yPixel, this.closerX, this.closerY);
}, "~N,~N");
Clazz_defineMethod(c$, "initGraphSet", 
function(startIndex, endIndex){
if (JSV.common.GraphSet.veryLightGrey == null) JSV.common.GraphSet.veryLightGrey = this.g2d.getColor3(200, 200, 200);
this.setPlotColors(JSV.common.ColorParameters.defaultPlotColors);
this.xAxisLeftToRight = this.getSpectrumAt(0).shouldDisplayXAxisIncreasing();
this.setDrawXAxis();
var startIndices =  Clazz_newIntArray (this.nSpectra, 0);
var endIndices =  Clazz_newIntArray (this.nSpectra, 0);
this.bsSelected.setBits(0, this.nSpectra);
this.allowStackedYScale = true;
if (endIndex <= 0) endIndex = 2147483647;
this.isSplittable = (this.nSpectra > 1);
this.allowStacking = (this.spectra.get(0).isStackable());
this.showAllStacked = this.allowStacking && (this.nSpectra > 1);
for (var i = 0; i < this.nSpectra; i++) {
var iLast = this.spectra.get(i).getXYCoords().length - 1;
startIndices[i] = JSV.common.Coordinate.intoRange(startIndex, 0, iLast);
endIndices[i] = JSV.common.Coordinate.intoRange(endIndex, 0, iLast);
this.allowStackedYScale = new Boolean (this.allowStackedYScale & (this.spectra.get(i).getYUnits().equals(this.spectra.get(0).getYUnits()) && this.spectra.get(i).getUserYFactor() == this.spectra.get(0).getUserYFactor())).valueOf();
}
this.getView(0, 0, 0, 0, startIndices, endIndices, null, null);
this.viewList =  new JU.Lst();
this.viewList.addLast(this.viewData);
}, "~N,~N");
Clazz_defineMethod(c$, "getView", 
function(x1, x2, y1, y2, startIndices, endIndices, viewScales, yScales){
var graphs = (this.graphsTemp.size() == 0 ? this.spectra : this.graphsTemp);
var subspecs = this.getSpectrumAt(0).getSubSpectra();
var dontUseSubspecs = (subspecs == null || subspecs.size() == 2 && subspecs.get(1).isImaginary());
var is2D = !this.getSpectrumAt(0).is1D();
var useFirstSubSpecOnly = false;
if (is2D && useFirstSubSpecOnly || dontUseSubspecs && y1 == y2) {
graphs = this.spectra;
} else if (y1 == y2) {
this.viewData =  new JSV.common.ViewData(subspecs, y1, y2, this.getSpectrum().isContinuous());
graphs = null;
}if (graphs != null) {
this.viewData =  new JSV.common.ViewData(graphs, y1, y2, startIndices, endIndices, this.getSpectrumAt(0).isContinuous(), is2D);
if (x1 != x2) this.getScale().setXRange(x1, x2);
}if (viewScales != null) {
JSV.common.ScaleData.copyScaleFactors(viewScales, this.viewData.getScaleData());
if (yScales != null) JSV.common.ScaleData.copyYScales(yScales, this.viewData.getScaleData());
this.getCurrentView();
}}, "~N,~N,~N,~N,~A,~A,~A,~A");
Clazz_defineMethod(c$, "isNearby", 
function(a1, a2, c, range){
var x = a1.getXVal();
var xp1 = c.toPixelX(x);
var yp1 = this.toPixelY(a1.getYVal());
x = a2.getXVal();
var xp2 = c.toPixelX(x);
var yp2 = this.toPixelY(a2.getYVal());
return (Math.abs(xp1 - xp2) + Math.abs(yp1 - yp2) < range);
}, "JSV.common.Coordinate,JSV.common.Coordinate,JSV.common.XYScaleConverter,~N");
Clazz_defineMethod(c$, "setReversePlot", 
function(val){
this.reversePlot = val;
if (this.reversePlot) this.closeDialogsExcept(JSV.common.Annotation.AType.NONE);
this.setDrawXAxis();
}, "~B");
Clazz_defineMethod(c$, "setDrawXAxis", 
function(){
this.drawXAxisLeftToRight =  new Boolean (this.xAxisLeftToRight ^ this.reversePlot).valueOf();
for (var i = 0; i < this.spectra.size(); i++) (this.spectra.get(i)).setExportXAxisDirection(this.drawXAxisLeftToRight);

});
Clazz_defineMethod(c$, "isInTopBar", 
function(xPixel, yPixel){
return (xPixel == this.fixX(xPixel) && yPixel > this.pin1Dx0.yPixel0 - 2 && yPixel < this.pin1Dx0.yPixel1);
}, "~N,~N");
Clazz_defineMethod(c$, "isInTopBar2D", 
function(xPixel, yPixel){
return (this.imageView != null && xPixel == this.imageView.fixX(xPixel) && yPixel > this.pin2Dx0.yPixel0 - 2 && yPixel < this.pin2Dx0.yPixel1);
}, "~N,~N");
Clazz_defineMethod(c$, "isInRightBar", 
function(xPixel, yPixel){
return (yPixel == this.fixY(yPixel) && xPixel > this.pin1Dy0.xPixel1 && xPixel < this.pin1Dy0.xPixel0 + 2);
}, "~N,~N");
Clazz_defineMethod(c$, "isInRightBar2D", 
function(xPixel, yPixel){
return (this.imageView != null && yPixel == this.fixY(yPixel) && xPixel > this.pin2Dy0.xPixel1 && xPixel < this.pin2Dy0.xPixel0 + 2);
}, "~N,~N");
Clazz_defineMethod(c$, "toX0", 
function(xPixel){
return this.viewList.get(0).getScale().toX0(this.fixX(xPixel), this.xPixel0, this.xPixel1, this.drawXAxisLeftToRight);
}, "~N");
Clazz_defineMethod(c$, "toY0", 
function(yPixel){
return this.viewList.get(0).getScale().toY0(this.fixY(yPixel), this.yPixel0, this.yPixel1);
}, "~N");
Clazz_overrideMethod(c$, "toX", 
function(xPixel){
if (this.imageView != null && this.imageView.isXWithinRange(xPixel)) return this.imageView.toX(xPixel);
return this.getScale().toX(this.fixX(xPixel), this.xPixel1, this.drawXAxisLeftToRight);
}, "~N");
Clazz_overrideMethod(c$, "toY", 
function(yPixel){
return this.getScale().toY(yPixel, this.yPixel0);
}, "~N");
Clazz_defineMethod(c$, "toPixelX", 
function(dx){
return this.getScale().toPixelX(dx, this.xPixel0, this.xPixel1, this.drawXAxisLeftToRight);
}, "~N");
Clazz_defineMethod(c$, "toPixelY", 
function(yVal){
return this.getScale().toPixelY(yVal, this.yPixel1);
}, "~N");
Clazz_defineMethod(c$, "toPixelX0", 
function(x){
return this.viewList.get(0).getScale().toPixelX0(x, this.xPixel0, this.xPixel1, this.drawXAxisLeftToRight);
}, "~N");
Clazz_defineMethod(c$, "toPixelY0", 
function(y){
return this.fixY(this.viewList.get(0).getScale().toPixelY0(y, this.yPixel0, this.yPixel1));
}, "~N");
Clazz_defineMethod(c$, "fixX", 
function(xPixel){
return JSV.common.Coordinate.intoRange(xPixel, this.xPixel0, this.xPixel1);
}, "~N");
Clazz_defineMethod(c$, "fixY", 
function(yPixel){
return JSV.common.Coordinate.intoRange(yPixel, this.yPixel0, this.yPixel1);
}, "~N");
Clazz_defineMethod(c$, "getXPixel0", 
function(){
return this.xPixel0;
});
Clazz_defineMethod(c$, "getXPixels", 
function(){
return this.xPixels;
});
Clazz_overrideMethod(c$, "getYPixels", 
function(){
return this.yPixels;
});
Clazz_defineMethod(c$, "getScale", 
function(){
return this.viewData.getScale();
});
Clazz_defineMethod(c$, "toPixelYint", 
function(yVal){
return this.yPixel1 - Clazz_doubleToInt(Double.isNaN(yVal) ? -2147483648 : this.yPixels * yVal);
}, "~N");
Clazz_defineMethod(c$, "findAnnotation2D", 
function(xy){
for (var i = this.annotations.size(); --i >= 0; ) {
var a = this.annotations.get(i);
if (this.isNearby(a, xy, this.imageView, 10)) return a;
}
return null;
}, "JSV.common.Coordinate");
Clazz_defineMethod(c$, "addAnnotation", 
function(annotation, isToggle){
if (this.annotations == null) this.annotations =  new JU.Lst();
var removed = false;
for (var i = this.annotations.size(); --i >= 0; ) if (annotation.is2D ? this.isNearby(this.annotations.get(i), annotation, this.imageView, 10) : annotation.equals(this.annotations.get(i))) {
removed = true;
this.annotations.removeItemAt(i);
}
if (annotation.text.length > 0 && (!removed || !isToggle)) this.annotations.addLast(annotation);
}, "JSV.common.Annotation,~B");
Clazz_defineMethod(c$, "setImageWindow", 
function(){
this.imageView.setPixelWidthHeight(Clazz_doubleToInt((this.pd.display1D ? 0.6 : 1) * this.xPixels0), this.yPixels);
this.imageView.setXY0(this.getSpectrumAt(0), Clazz_doubleToInt(Math.floor(this.xPixel10 - this.imageView.xPixels)), this.yPixel0);
});
Clazz_defineMethod(c$, "findNearestMaxMin", 
function(){
if (this.nSpectra > 1 && this.iSpectrumClicked < 0) return false;
this.xValueMovedTo = this.getSpectrum().findXForPeakNearest(this.xValueMovedTo);
this.setXPixelMovedTo(this.xValueMovedTo, 1.7976931348623157E308, 0, 0);
return !Double.isNaN(this.xValueMovedTo);
});
Clazz_defineMethod(c$, "setXPixelMovedTo", 
function(x1, x2, xPixel1, xPixel2){
if (x1 == 1.7976931348623157E308 && x2 == 1.7976931348623157E308) {
this.xPixelMovedTo = xPixel1;
this.xPixelMovedTo2 = xPixel2;
if (this.isLinked && this.sticky2Dcursor) {
this.pd.setlinkedXMove(this, this.toX(this.xPixelMovedTo), false);
}return;
}if (x1 != 1.7976931348623157E308) {
this.xPixelMovedTo = this.toPixelX(x1);
if (this.fixX(this.xPixelMovedTo) != this.xPixelMovedTo) this.xPixelMovedTo = -1;
this.xPixelMovedTo2 = -1;
if (x1 != 1e10) this.setSpectrumClicked(this.getFixedSelectedSpectrumIndex());
}if (x2 != 1.7976931348623157E308) {
this.xPixelMovedTo2 = this.toPixelX(x2);
}}, "~N,~N,~N,~N");
Clazz_defineMethod(c$, "processPendingMeasurement", 
function(xPixel, yPixel, clickCount){
if (!this.isInPlotRegion(xPixel, yPixel) || this.is2dClick(xPixel, yPixel)) {
this.pendingMeasurement = null;
return;
}var x = this.toX(xPixel);
var y = this.toY(yPixel);
var x0 = x;
var m;
switch (clickCount) {
case 0:
this.pendingMeasurement.setPt2(this.toX(xPixel), this.toY(yPixel));
break;
case 3:
case 2:
if (this.iSpectrumClicked < 0) return;
var spec = this.spectra.get(this.iSpectrumClicked);
this.setScale(this.iSpectrumClicked);
if (clickCount == 3) {
} else {
m = this.findMeasurement(this.selectedSpectrumMeasurements, xPixel, yPixel, 1);
if (m != null) {
x = m.getXVal();
y = m.getYVal();
} else if ((m = this.findMeasurement(this.selectedSpectrumMeasurements, xPixel, yPixel, 2)) != null) {
x = m.getXVal2();
y = m.getYVal2();
} else {
x = this.getNearestPeak(spec, x, y);
}}this.pendingMeasurement =  new JSV.common.Measurement().setM1(x, y, spec);
this.pendingMeasurement.setPt2(x0, y);
this.pd.setTaintedAll();
this.pd.repaint();
break;
case 1:
case -2:
case -3:
var isOK = (this.pendingMeasurement != null && this.isVisible(this.getDialog(JSV.common.Annotation.AType.Measurements, -1)));
while (isOK) {
this.setScale(this.getSpectrumIndex(this.pendingMeasurement.spec));
if (clickCount != 3) {
if (!this.findNearestMaxMin()) {
isOK = false;
break;
}xPixel = this.xPixelMovedTo;
}x = this.toX(xPixel);
y = this.toY(yPixel);
this.pendingMeasurement.setPt2(x, y);
if (this.pendingMeasurement.text.length == 0) {
isOK = false;
break;
}this.setMeasurement(this.pendingMeasurement);
if (clickCount != 1) {
isOK = false;
break;
}this.setSpectrumClicked(this.getSpectrumIndex(this.pendingMeasurement.spec));
this.pendingMeasurement =  new JSV.common.Measurement().setM1(x, y, this.pendingMeasurement.spec);
break;
}
if (!isOK) this.pendingMeasurement = null;
this.pd.setTaintedAll();
this.pd.repaint();
break;
case 5:
if (this.findNearestMaxMin()) {
var iSpec = this.getFixedSelectedSpectrumIndex();
if (Double.isNaN(this.lastXMax) || this.lastSpecClicked != iSpec || this.pendingMeasurement == null) {
this.lastXMax = this.xValueMovedTo;
this.lastSpecClicked = iSpec;
this.pendingMeasurement =  new JSV.common.Measurement().setM1(this.xValueMovedTo, this.yValueMovedTo, this.spectra.get(iSpec));
} else {
this.pendingMeasurement.setPt2(this.xValueMovedTo, this.yValueMovedTo);
if (this.pendingMeasurement.text.length > 0) this.setMeasurement(this.pendingMeasurement);
this.pendingMeasurement = null;
this.lastXMax = NaN;
}} else {
this.lastXMax = NaN;
}break;
}
}, "~N,~N,~N");
Clazz_defineMethod(c$, "checkIntegralNormalizationClick", 
function(xPixel, yPixel){
if (this.selectedSpectrumIntegrals == null) return false;
var integral = this.findMeasurement(this.selectedSpectrumIntegrals, xPixel, yPixel, -5);
if (integral == null) return false;
this.selectedIntegral = integral;
this.pd.normalizeIntegral();
this.updateDialog(JSV.common.Annotation.AType.Integration, -1);
this.setSpectrumClicked(this.getSpectrumIndex(integral.spec));
return true;
}, "~N,~N");
Clazz_defineMethod(c$, "getNearestPeak", 
function(spec, x, y){
var x0 = JSV.common.Coordinate.getNearestXWithYAbove(spec.getXYCoords(), x, y, spec.isInverted(), false);
var x1 = JSV.common.Coordinate.getNearestXWithYAbove(spec.getXYCoords(), x, y, spec.isInverted(), true);
return (Double.isNaN(x0) ? x1 : Double.isNaN(x1) ? x0 : Math.abs(x0 - x) < Math.abs(x1 - x) ? x0 : x1);
}, "JSV.common.Spectrum,~N,~N");
Clazz_defineMethod(c$, "findMeasurement", 
function(measurements, xPixel, yPixel, iPt){
if (measurements == null || measurements.size() == 0) return null;
if (iPt == 0) {
var m = this.findMeasurement(measurements, xPixel, yPixel, -1);
if (m != null || Clazz_instanceOf(measurements.get(0),"JSV.common.Integral")) return m;
return this.findMeasurement(measurements, xPixel, yPixel, -2);
}for (var i = measurements.size(); --i >= 0; ) {
var m = measurements.get(i);
var x1;
var x2;
var y1;
var y2;
if (Clazz_instanceOf(m,"JSV.common.Integral")) {
x1 = x2 = this.toPixelX(m.getXVal2());
y1 = this.toPixelYint(m.getYVal());
y2 = this.toPixelYint(m.getYVal2());
} else {
x1 = this.toPixelX(m.getXVal());
x2 = this.toPixelX(m.getXVal2());
y1 = y2 = (iPt == -2 ? this.yPixel1 - 2 : this.toPixelY(m.getYVal()));
}switch (iPt) {
case 1:
if (Math.abs(xPixel - x1) + Math.abs(yPixel - y1) < 4) return m;
break;
case 2:
if (Math.abs(xPixel - x2) + Math.abs(yPixel - y2) < 4) return m;
break;
case -5:
y1 = y2 = Clazz_doubleToInt((y1 + y2) / 2);
x2 = x1 + 20;
default:
case -1:
case -2:
if (JSV.common.GraphSet.isOnLine(xPixel, yPixel, x1, y1, x2, y2)) return m;
break;
}
}
return null;
}, "JSV.common.MeasurementData,~N,~N,~N");
Clazz_defineMethod(c$, "setMeasurement", 
function(m){
var iSpec = this.getSpectrumIndex(m.spec);
var ad = this.getDialog(JSV.common.Annotation.AType.Measurements, iSpec);
if (ad == null) this.addDialog(iSpec, JSV.common.Annotation.AType.Measurements, ad =  new JSV.common.MeasurementData(JSV.common.Annotation.AType.Measurements, m.spec));
ad.getData().addLast(m.copyM());
this.updateDialog(JSV.common.Annotation.AType.Measurements, -1);
}, "JSV.common.Measurement");
Clazz_defineMethod(c$, "checkArrowUpDownClick", 
function(xPixel, yPixel){
var ok = false;
var f = (this.isArrowClick(xPixel, yPixel, 3) ? JSV.common.GraphSet.RT2 : this.isArrowClick(xPixel, yPixel, 4) ? 1 / JSV.common.GraphSet.RT2 : 0);
if (f != 0) {
if (this.nSplit > 1) this.setSpectrumSelected(this.iSpectrumMovedTo);
if ((this.nSpectra == 1 || this.iSpectrumSelected >= 0) && this.spectra.get(this.getFixedSelectedSpectrumIndex()).isTransmittance()) f = 1 / f;
this.viewData.scaleSpectrum(this.imageView == null ? this.iSpectrumSelected : -2, f);
ok = true;
} else if (this.isArrowClick(xPixel, yPixel, -1)) {
this.resetViewCompletely();
ok = true;
}if (ok) {
if (this.imageView != null) {
this.update2dImage(false);
this.resetPinsFromView();
}this.pd.setTaintedAll();
}return ok;
}, "~N,~N");
Clazz_defineMethod(c$, "resetViewCompletely", 
function(){
this.clearViews();
if (this.showAllStacked && !this.stackSelected) this.closeDialogsExcept(JSV.common.Annotation.AType.NONE);
this.viewData.resetScaleFactors();
this.updateDialogs();
});
Clazz_defineMethod(c$, "checkArrowLeftRightClick", 
function(xPixel, yPixel){
if (this.haveLeftRightArrows) {
var dx = (this.isArrowClick(xPixel, yPixel, 1) ? -1 : this.isArrowClick(xPixel, yPixel, 2) ? 1 : 0);
if (dx != 0) {
this.setSpectrumClicked((this.iSpectrumSelected + dx) % this.nSpectra);
return true;
}if (this.isArrowClick(xPixel, yPixel, 0)) {
if (this.showAllStacked) {
this.showAllStacked = false;
this.setSpectrumClicked(this.getFixedSelectedSpectrumIndex());
return true;
}this.showAllStacked = this.allowStacking;
this.setSpectrumSelected(-1);
this.stackSelected = false;
}}return false;
}, "~N,~N");
Clazz_defineMethod(c$, "isArrowClick", 
function(xPixel, yPixel, type){
var pt;
switch (type) {
case 3:
case 4:
case -1:
pt = Clazz_doubleToInt((this.yPixel00 + this.yPixel11) / 2) + (type == 3 ? -1 : type == 4 ? 1 : 0) * 15;
return (Math.abs(this.xVArrows - xPixel) < 10 && Math.abs(pt - yPixel) < 10);
case 1:
case 2:
case 0:
pt = this.xHArrows + (type == 1 ? -1 : type == 2 ? 1 : 0) * 15;
return (Math.abs(pt - xPixel) < 10 && Math.abs(this.yHArrows - yPixel) < 10);
}
return false;
}, "~N,~N,~N");
Clazz_defineMethod(c$, "setWidgetValueByUser", 
function(pw){
var sval;
if (pw === this.cur2Dy) sval = "" + this.imageView.toSubspectrumIndex(pw.yPixel0);
 else if (pw === this.pin1Dx01) sval = "" + Math.min(this.pin1Dx0.getXVal(), this.pin1Dx1.getXVal()) + " - " + Math.max(this.pin1Dx0.getXVal(), this.pin1Dx1.getXVal());
 else if (pw === this.pin1Dy01) sval = "" + Math.min(this.pin1Dy0.getYVal(), this.pin1Dy1.getYVal()) + " - " + Math.max(this.pin1Dy0.getYVal(), this.pin1Dy1.getYVal());
 else if (pw === this.pin2Dx01) sval = "" + Math.min(this.pin2Dx0.getXVal(), this.pin2Dx1.getXVal()) + " - " + Math.max(this.pin2Dx0.getXVal(), this.pin2Dx1.getXVal());
 else if (pw === this.pin2Dy01) sval = "" + Clazz_doubleToInt(Math.min(this.pin2Dy0.getYVal(), this.pin2Dy1.getYVal())) + " - " + Clazz_doubleToInt(Math.max(this.pin2Dy0.getYVal(), this.pin2Dy1.getYVal()));
 else sval = "" + pw.getValue();
sval = this.pd.getInput("New value?", "Set Slider", sval);
if (sval == null) return;
sval = sval.trim();
try {
if (pw === this.pin1Dx01 || pw === this.pin1Dy01 || pw === this.pin2Dx01 || pw === this.pin2Dy01) {
var pt = sval.indexOf("-", 1);
if (pt < 0) return;
var val1 = Double.$valueOf(sval.substring(0, pt)).doubleValue();
var val2 = Double.$valueOf(sval.substring(pt + 1)).doubleValue();
if (pw === this.pin1Dx01) {
this.doZoom(val1, this.pin1Dy0.getYVal(), val2, this.pin1Dy1.getYVal(), true, false, false, true, true);
} else if (pw === this.pin1Dy01) {
this.doZoom(this.pin1Dx0.getXVal(), val1, this.pin1Dx1.getXVal(), val2, this.imageView == null, this.imageView == null, false, false, true);
} else if (pw === this.pin2Dx01) {
this.imageView.setView0(this.imageView.toPixelX0(val1), this.pin2Dy0.yPixel0, this.imageView.toPixelX0(val2), this.pin2Dy1.yPixel0);
this.doZoom(val1, this.pin1Dy0.getYVal(), val2, this.pin1Dy1.getYVal(), false, false, false, true, true);
} else if (pw === this.pin2Dy01) {
this.imageView.setView0(this.pin2Dx0.xPixel0, this.imageView.toPixelY0(val1), this.pin2Dx1.xPixel0, this.imageView.toPixelY0(val2));
this.doZoom(this.imageView.toX(this.imageView.xPixel0), this.getScale().minY, this.imageView.toX(this.imageView.xPixel0 + this.imageView.xPixels - 1), this.getScale().maxY, false, false, false, false, true);
}} else {
var val = Double.$valueOf(sval).doubleValue();
if (pw.isXtype) {
var val2 = (pw === this.pin1Dx0 || pw === this.cur2Dx0 || pw === this.pin2Dx0 ? this.pin1Dx1.getXVal() : this.pin1Dx0.getXVal());
this.doZoom(val, 0, val2, 0, !pw.is2D, false, false, true, true);
} else if (pw === this.cur2Dy) {
this.setCurrentSubSpectrum(Clazz_doubleToInt(val));
} else if (pw === this.pin2Dy0 || pw === this.pin2Dy1) {
var val2 = (pw === this.pin2Dy0 ? this.pin2Dy1.yPixel0 : this.pin2Dy0.yPixel0);
this.imageView.setView0(this.pin2Dx0.xPixel0, this.imageView.subIndexToPixelY(Clazz_doubleToInt(val)), this.pin2Dx1.xPixel0, val2);
} else {
var val2 = (pw === this.pin1Dy0 ? this.pin1Dy1.getYVal() : this.pin1Dy0.getYVal());
this.doZoom(this.pin1Dx0.getXVal(), val, this.pin1Dx1.getXVal(), val2, this.imageView == null, this.imageView == null, false, false, true);
}}} catch (e) {
if (Clazz_exceptionOf(e, Exception)){
} else {
throw e;
}
}
}, "JSV.common.PlotWidget");
Clazz_defineMethod(c$, "removeAllHighlights", 
function(spec){
if (spec == null) this.highlights.clear();
 else for (var i = this.highlights.size(); --i >= 0; ) if (this.highlights.get(i).spectrum === spec) this.highlights.removeItemAt(i);

}, "JSV.common.Spectrum");
Clazz_defineMethod(c$, "setCoordClicked", 
function(xPixel, x, y){
if (y == 0) this.nextClickForSetPeak = null;
if (Double.isNaN(x)) {
this.pd.coordClicked = null;
this.pd.coordsClicked = null;
return null;
}this.pd.coordClicked =  new JSV.common.Coordinate().set(this.lastClickX = x, y);
this.pd.coordsClicked = this.getSpectrum().getXYCoords();
this.pd.xPixelClicked = (this.lastPixelX = xPixel);
return this.pd.coordClicked;
}, "~N,~N,~N");
Clazz_defineMethod(c$, "setWidgets", 
function(needNewPins, subIndex, doDraw1DObjects){
if (needNewPins || this.pin1Dx0 == null) {
if (this.zoomBox1D == null) this.newPins();
 else this.resetPinPositions();
}this.setDerivedPins(subIndex);
this.setPinSliderPositions(doDraw1DObjects);
}, "~B,~N,~B");
Clazz_defineMethod(c$, "newPins", 
function(){
this.zoomBox1D =  new JSV.common.PlotWidget("zoomBox1D");
this.pin1Dx0 =  new JSV.common.PlotWidget("pin1Dx0");
this.pin1Dx1 =  new JSV.common.PlotWidget("pin1Dx1");
this.pin1Dy0 =  new JSV.common.PlotWidget("pin1Dy0");
this.pin1Dy1 =  new JSV.common.PlotWidget("pin1Dy1");
this.pin1Dx01 =  new JSV.common.PlotWidget("pin1Dx01");
this.pin1Dy01 =  new JSV.common.PlotWidget("pin1Dy01");
this.cur1D2x1 =  new JSV.common.PlotWidget("cur1D2x1");
this.cur1D2x1.color = JSV.common.ScriptToken.PEAKTABCOLOR;
this.cur1D2x2 =  new JSV.common.PlotWidget("cur1D2x2");
this.cur1D2x2.color = JSV.common.ScriptToken.PEAKTABCOLOR;
if (this.imageView != null) {
this.zoomBox2D =  new JSV.common.PlotWidget("zoomBox2D");
this.pin2Dx0 =  new JSV.common.PlotWidget("pin2Dx0");
this.pin2Dx1 =  new JSV.common.PlotWidget("pin2Dx1");
this.pin2Dy0 =  new JSV.common.PlotWidget("pin2Dy0");
this.pin2Dy1 =  new JSV.common.PlotWidget("pin2Dy1");
this.pin2Dx01 =  new JSV.common.PlotWidget("pin2Dx01");
this.pin2Dy01 =  new JSV.common.PlotWidget("pin2Dy01");
this.cur2Dx0 =  new JSV.common.PlotWidget("cur2Dx0");
this.cur2Dx1 =  new JSV.common.PlotWidget("cur2Dx1");
this.cur2Dy =  new JSV.common.PlotWidget("cur2Dy");
this.pin2Dy0.setY(0, this.imageView.toPixelY0(0));
var n = this.getSpectrumAt(0).getSubSpectra().size();
this.pin2Dy1.setY(n, this.imageView.toPixelY0(n));
}this.setWidgetX(this.pin1Dx0, this.getScale().minX);
this.setWidgetX(this.pin1Dx1, this.getScale().maxX);
this.setWidgetY(this.pin1Dy0, this.getScale().minY);
this.setWidgetY(this.pin1Dy1, this.getScale().maxY);
this.widgets =  Clazz_newArray(-1, [this.zoomBox1D, this.zoomBox2D, this.pin1Dx0, this.pin1Dx01, this.pin1Dx1, this.pin1Dy0, this.pin1Dy01, this.pin1Dy1, this.pin2Dx0, this.pin2Dx01, this.pin2Dx1, this.pin2Dy0, this.pin2Dy01, this.pin2Dy1, this.cur2Dx0, this.cur2Dx1, this.cur2Dy, this.cur1D2x1, this.cur1D2x2]);
});
Clazz_defineMethod(c$, "setWidgetX", 
function(pw, x){
pw.setX(x, this.toPixelX0(x));
}, "JSV.common.PlotWidget,~N");
Clazz_defineMethod(c$, "setWidgetY", 
function(pw, y){
pw.setY(y, this.toPixelY0(y));
}, "JSV.common.PlotWidget,~N");
Clazz_defineMethod(c$, "resetPinsFromView", 
function(){
if (this.pin1Dx0 == null) return;
this.setWidgetX(this.pin1Dx0, this.getScale().minXOnScale);
this.setWidgetX(this.pin1Dx1, this.getScale().maxXOnScale);
this.setWidgetY(this.pin1Dy0, this.getScale().minYOnScale);
this.setWidgetY(this.pin1Dy1, this.getScale().maxYOnScale);
});
Clazz_defineMethod(c$, "resetPinPositions", 
function(){
this.resetX(this.pin1Dx0);
this.resetY(this.pin1Dy0);
this.resetY(this.pin1Dy1);
if (this.imageView == null) {
if (this.gs2dLinkedX != null) this.resetX(this.cur1D2x1);
if (this.gs2dLinkedY != null) this.resetX(this.cur1D2x2);
} else {
this.pin2Dy0.setY(this.pin2Dy0.getYVal(), this.imageView.toPixelY0(this.pin2Dy0.getYVal()));
this.pin2Dy1.setY(this.pin2Dy1.getYVal(), this.imageView.toPixelY0(this.pin2Dy1.getYVal()));
}});
Clazz_defineMethod(c$, "resetX", 
function(p){
this.setWidgetX(p, p.getXVal());
}, "JSV.common.PlotWidget");
Clazz_defineMethod(c$, "resetY", 
function(p){
this.setWidgetY(p, p.getYVal());
}, "JSV.common.PlotWidget");
Clazz_defineMethod(c$, "setPinSliderPositions", 
function(doDraw1DObjects){
this.pin1Dx0.yPixel0 = this.pin1Dx1.yPixel0 = this.pin1Dx01.yPixel0 = this.yPixel0 - 5;
this.pin1Dx0.yPixel1 = this.pin1Dx1.yPixel1 = this.pin1Dx01.yPixel1 = this.yPixel0;
this.cur1D2x1.yPixel1 = this.cur1D2x2.yPixel1 = this.yPixel0 - 5;
this.cur1D2x1.yPixel0 = this.cur1D2x2.yPixel0 = this.yPixel1 + 6;
if (this.imageView == null) {
this.pin1Dy0.xPixel0 = this.pin1Dy1.xPixel0 = this.pin1Dy01.xPixel0 = this.xPixel1 + 5;
this.pin1Dy0.xPixel1 = this.pin1Dy1.xPixel1 = this.pin1Dy01.xPixel1 = this.xPixel1;
} else {
this.pin1Dy0.xPixel0 = this.pin1Dy1.xPixel0 = this.pin1Dy01.xPixel0 = this.imageView.xPixel1 + 15;
this.pin1Dy0.xPixel1 = this.pin1Dy1.xPixel1 = this.pin1Dy01.xPixel1 = this.imageView.xPixel1 + 10;
this.pin2Dx0.yPixel0 = this.pin2Dx1.yPixel0 = this.pin2Dx01.yPixel0 = this.yPixel0 - 5;
this.pin2Dx0.yPixel1 = this.pin2Dx1.yPixel1 = this.pin2Dx01.yPixel1 = this.yPixel0;
this.pin2Dy0.xPixel0 = this.pin2Dy1.xPixel0 = this.pin2Dy01.xPixel0 = this.imageView.xPixel1 + 5;
this.pin2Dy0.xPixel1 = this.pin2Dy1.xPixel1 = this.pin2Dy01.xPixel1 = this.imageView.xPixel1;
this.cur2Dx0.yPixel0 = this.cur2Dx1.yPixel0 = this.yPixel1 + 6;
this.cur2Dx0.yPixel1 = this.cur2Dx1.yPixel1 = this.yPixel0 - 5;
this.cur2Dx0.yPixel0 = this.cur2Dx1.yPixel0 = this.yPixel1 + 6;
this.cur2Dx1.yPixel1 = this.cur2Dx1.yPixel1 = this.yPixel0 - 5;
this.cur2Dy.xPixel0 = (doDraw1DObjects ? Clazz_doubleToInt((this.xPixel1 + this.imageView.xPixel0) / 2) : this.imageView.xPixel0 - 6);
this.cur2Dy.xPixel1 = this.imageView.xPixel1 + 5;
}}, "~B");
Clazz_defineMethod(c$, "setDerivedPins", 
function(subIndex){
if (this.gs2dLinkedX != null) this.cur1D2x1.setX(this.cur1D2x1.getXVal(), this.toPixelX(this.cur1D2x1.getXVal()));
if (this.gs2dLinkedY != null) this.cur1D2x2.setX(this.cur1D2x2.getXVal(), this.toPixelX(this.cur1D2x2.getXVal()));
this.pin1Dx01.setX(0, Clazz_doubleToInt((this.pin1Dx0.xPixel0 + this.pin1Dx1.xPixel0) / 2));
this.pin1Dy01.setY(0, Clazz_doubleToInt((this.pin1Dy0.yPixel0 + this.pin1Dy1.yPixel0) / 2));
this.pin1Dx01.setEnabled(Math.min(this.pin1Dx0.xPixel0, this.pin1Dx1.xPixel0) > this.xPixel0 || Math.max(this.pin1Dx0.xPixel0, this.pin1Dx1.xPixel0) < this.xPixel1);
this.pin1Dy01.setEnabled(Math.min(this.pin1Dy0.yPixel0, this.pin1Dy1.yPixel0) > Math.min(this.toPixelY(this.getScale().minY), this.toPixelY(this.getScale().maxY)) || Math.max(this.pin1Dy0.yPixel0, this.pin1Dy1.yPixel0) < Math.max(this.toPixelY(this.getScale().minY), this.toPixelY(this.getScale().maxY)));
if (this.imageView == null) return;
var x = this.pin1Dx0.getXVal();
this.cur2Dx0.setX(x, this.imageView.toPixelX(x));
x = this.pin1Dx1.getXVal();
this.cur2Dx1.setX(x, this.imageView.toPixelX(x));
x = this.imageView.toX(this.imageView.xPixel0);
this.pin2Dx0.setX(x, this.imageView.toPixelX0(x));
x = this.imageView.toX(this.imageView.xPixel1);
this.pin2Dx1.setX(x, this.imageView.toPixelX0(x));
this.pin2Dx01.setX(0, Clazz_doubleToInt((this.pin2Dx0.xPixel0 + this.pin2Dx1.xPixel0) / 2));
var y = this.imageView.imageHeight - 1 - this.imageView.yView1;
this.pin2Dy0.setY(y, this.imageView.toPixelY0(y));
y = this.imageView.imageHeight - 1 - this.imageView.yView2;
this.pin2Dy1.setY(y, this.imageView.toPixelY0(y));
this.pin2Dy01.setY(0, Clazz_doubleToInt((this.pin2Dy0.yPixel0 + this.pin2Dy1.yPixel0) / 2));
this.cur2Dy.yPixel0 = this.cur2Dy.yPixel1 = this.imageView.subIndexToPixelY(subIndex);
this.pin2Dx01.setEnabled(Math.min(this.pin2Dx0.xPixel0, this.pin2Dx1.xPixel0) != this.imageView.xPixel0 || Math.max(this.pin2Dx0.xPixel0, this.pin2Dx1.xPixel1) != this.imageView.xPixel1);
this.pin2Dy01.setEnabled(Math.min(this.pin2Dy0.yPixel0, this.pin2Dy1.yPixel0) != this.yPixel0 || Math.max(this.pin2Dy0.yPixel0, this.pin2Dy1.yPixel1) != this.yPixel1);
}, "~N");
Clazz_defineMethod(c$, "doZoom", 
function(initX, initY, finalX, finalY, is1D, is1DY, checkRange, checkLinked, addZoom){
if (initX == finalX) {
initX = this.getScale().minXOnScale;
finalX = this.getScale().maxXOnScale;
} else if (this.isLinked && checkLinked) this.pd.doZoomLinked(this, initX, finalX, addZoom, checkRange, is1D);
if (initX > finalX) {
var tempX = initX;
initX = finalX;
finalX = tempX;
}if (initY > finalY) {
var tempY = initY;
initY = finalY;
finalY = tempY;
}var is2DGrayScaleChange = (!is1D && this.imageView != null && (this.imageView.minZ != initY || this.imageView.maxZ != finalY));
if (!this.zoomEnabled && !is2DGrayScaleChange) return;
if (checkRange) {
if (!this.getScale().isInRangeX(initX) && !this.getScale().isInRangeX(finalX)) return;
if (!this.getScale().isInRangeX(initX)) {
initX = this.getScale().minX;
} else if (!this.getScale().isInRangeX(finalX)) {
finalX = this.getScale().maxX;
}} else {
}this.pd.setTaintedAll();
var viewScales = this.viewData.getScaleData();
var startIndices =  Clazz_newIntArray (this.nSpectra, 0);
var endIndices =  Clazz_newIntArray (this.nSpectra, 0);
this.graphsTemp.clear();
var subspecs = this.getSpectrumAt(0).getSubSpectra();
var dontUseSubspecs = (subspecs == null || subspecs.size() == 2);
var is2D = !this.getSpectrumAt(0).is1D();
if (!is2D && !dontUseSubspecs) {
this.graphsTemp.addLast(this.getSpectrum());
if (!JSV.common.ScaleData.setDataPointIndices(this.graphsTemp, initX, finalX, 3, startIndices, endIndices)) return;
} else {
if (!JSV.common.ScaleData.setDataPointIndices(this.spectra, initX, finalX, 3, startIndices, endIndices)) return;
}var y1 = initY;
var y2 = finalY;
var isXOnly = (y1 == y2);
if (isXOnly) {
var f = (!is2DGrayScaleChange && is1D ? f = this.getScale().spectrumScaleFactor : 1);
if (Math.abs(f - 1) < 0.0001) {
y1 = this.getScale().minYOnScale;
y2 = this.getScale().maxYOnScale;
}}var yScales = null;
if (isXOnly || is1DY) {
this.getCurrentView();
yScales = this.viewData.getNewScales(this.iSpectrumSelected, isXOnly, y1, y2);
}this.getView(initX, finalX, y1, y2, startIndices, endIndices, viewScales, yScales);
this.setXPixelMovedTo(1E10, 1.7976931348623157E308, 0, 0);
this.setWidgetX(this.pin1Dx0, initX);
this.setWidgetX(this.pin1Dx1, finalX);
this.setWidgetY(this.pin1Dy0, y1);
this.setWidgetY(this.pin1Dy1, y2);
if (this.imageView == null) {
this.updateDialogs();
} else {
var isub = this.getSpectrumAt(0).getSubIndex();
var ifix = this.imageView.fixSubIndex(isub);
if (ifix != isub) this.setCurrentSubSpectrum(ifix);
if (is2DGrayScaleChange) this.update2dImage(false);
}if (addZoom) this.addCurrentZoom();
}, "~N,~N,~N,~N,~B,~B,~B,~B,~B");
Clazz_defineMethod(c$, "updateDialogs", 
function(){
this.updateDialog(JSV.common.Annotation.AType.PeakList, -1);
this.updateDialog(JSV.common.Annotation.AType.Measurements, -1);
});
Clazz_defineMethod(c$, "setCurrentSubSpectrum", 
function(i){
var spec0 = this.getSpectrumAt(0);
i = spec0.setCurrentSubSpectrum(i);
if (spec0.isForcedSubset()) this.viewData.setXRangeForSubSpectrum(this.getSpectrum().getXYCoords());
this.pd.notifySubSpectrumChange(i, this.getSpectrum());
}, "~N");
Clazz_defineMethod(c$, "addCurrentZoom", 
function(){
if (this.viewList.size() > this.currentZoomIndex + 1) for (var i = this.viewList.size() - 1; i > this.currentZoomIndex; i--) this.viewList.removeItemAt(i);

this.viewList.addLast(this.viewData);
this.currentZoomIndex++;
});
Clazz_defineMethod(c$, "setZoomTo", 
function(i){
this.currentZoomIndex = i;
this.viewData = this.viewList.get(i);
this.resetPinsFromView();
}, "~N");
Clazz_defineMethod(c$, "clearViews", 
function(){
if (this.isLinked) {
this.pd.clearLinkViews(this);
}this.setZoom(0, 0, 0, 0);
for (var i = this.viewList.size(); --i >= 1; ) this.viewList.removeItemAt(i);

});
Clazz_defineMethod(c$, "drawAll", 
function(gMain, gFront, gBack, iSplit, needNewPins, doAll, pointsOnly){
this.setPositionForFrame(iSplit);
this.g2d = this.pd.g2d;
this.gMain = gMain;
var spec0 = this.getSpectrumAt(0);
var subIndex = spec0.getSubIndex();
this.is2DSpectrum = (!spec0.is1D() && (this.isLinked || this.pd.getBoolean(JSV.common.ScriptToken.DISPLAY2D)) && (this.imageView != null || this.get2DImage(spec0)));
if (this.imageView != null && doAll) {
if (this.isPrintingOrSaving) this.g2d.newGrayScaleImage(gMain, this.image2D, this.imageView.imageWidth, this.imageView.imageHeight, this.imageView.getBuffer());
if (this.is2DSpectrum) this.setPositionForFrame(iSplit);
this.draw2DImage();
}var iSelected = (this.stackSelected || !this.showAllStacked ? this.iSpectrumSelected : -1);
var doYScale = (!this.showAllStacked || this.nSpectra == 1 || iSelected >= 0);
var doDraw1DObjects = (this.imageView == null || this.pd.display1D);
var n = (iSelected >= 0 ? 1 : 0);
var iSpectrumForScale = this.getFixedSelectedSpectrumIndex();
if (doDraw1DObjects && doAll) {
this.fillBox(gMain, this.xPixel0, this.yPixel0, this.xPixel1, this.yPixel1, JSV.common.ScriptToken.PLOTAREACOLOR);
if (iSelected < 0) {
doYScale = true;
for (var i = 0; i < this.nSpectra; i++) if (this.doPlot(i, iSplit)) {
if (n++ == 0) continue;
doYScale = new Boolean (doYScale & this.viewData.areYScalesSame(i - 1, i)).valueOf();
}
}}var iSpecForFrame = (this.nSpectra == 1 ? 0 : !this.showAllStacked ? this.iSpectrumMovedTo : this.iSpectrumSelected);
var g2 = (gBack === gMain ? gFront : gBack);
if (doAll) {
var addCurrentBox = (this.pd.getCurrentGraphSet() === this && !this.isLinked && (!this.isSplittable || (this.nSplit == 1 || this.pd.currentSplitPoint == iSplit)));
var drawUpDownArrows = (this.zoomEnabled && !this.isPrintingOrSaving && !this.isDrawNoSpectra() && this.pd.isCurrentGraphSet(this) && this.spectra.get(0).isScalable() && (addCurrentBox || this.nSpectra == 1) && (this.nSplit == 1 || this.pd.currentSplitPoint == this.iSpectrumMovedTo));
var addSplitBox = this.isSplittable;
this.drawFrame(gMain, iSpecForFrame, addCurrentBox, addSplitBox, drawUpDownArrows);
}if (this.pd.isCurrentGraphSet(this) && iSplit == this.pd.currentSplitPoint && (n < 2 || this.iSpectrumSelected >= 0)) this.$haveSelectedSpectrum = true;
this.haveSingleYScale = (this.showAllStacked && this.nSpectra > 1 ? this.allowStackedYScale && doYScale : true);
if (doDraw1DObjects) {
var yOffsetPixels = Clazz_floatToInt(this.yPixels * (this.yStackOffsetPercent / 100));
this.haveLeftRightArrows = false;
for (var i = 0, offset = 0; i < this.nSpectra; i++) {
if (!this.doPlot(i, iSplit)) continue;
var spec = this.spectra.get(i);
var isContinuous = spec.isContinuous();
var onSpectrum = (!this.pd.isPrinting && this.iSpectrumMovedTo >= 0 && (this.nSplit > 1 ? i == this.iSpectrumMovedTo : this.isLinked || i == iSpectrumForScale));
var isGrey = (this.stackSelected && this.iSpectrumSelected >= 0 && this.iSpectrumSelected != i);
var ig = (!this.reversePlot && this.getShowAnnotation(JSV.common.Annotation.AType.Integration, i) && (!this.showAllStacked || this.iSpectrumSelected == i) ? this.getDialog(JSV.common.Annotation.AType.Integration, i).getData() : null);
this.setScale(i);
if (this.nSplit > 1) {
iSpectrumForScale = i;
}var doDrawWidgets = !isGrey && (this.nSplit == 1 || this.showAllStacked || this.iSpectrumSelected == iSplit);
var doDraw1DY = (doDrawWidgets && this.$haveSelectedSpectrum && i == iSpectrumForScale);
if (doDrawWidgets) {
this.widgetsAreSet = true;
this.resetPinsFromView();
this.drawWidgets(gFront, g2, subIndex, needNewPins, doDraw1DObjects, doDraw1DY, false);
}if (this.haveSingleYScale && i == iSpectrumForScale && doAll) {
this.drawGrid(gMain);
if (this.pd.isPrinting && this.nSplit == 1 && this.pd.graphSets.size() == 1) this.drawSpectrumSource(gMain, i);
}if (doDrawWidgets) this.drawWidgets(gFront, g2, subIndex, false, doDraw1DObjects, doDraw1DY, true);
if (!this.isDrawNoSpectra() && !this.isPrintingOrSaving && (this.nSpectra == 1 || this.iSpectrumSelected >= 0) && (this.haveSingleYScale && i == iSpectrumForScale || this.showAllStacked && this.stackSelected && i == this.iSpectrumSelected)) this.drawHighlightsAndPeakTabs(gFront, g2, i);
if (doAll) {
if ((onSpectrum || this.isPrintingOrSaving) && !this.is2DSpectrum) {
if (this.pd.titleOn && !this.pd.titleDrawn) {
this.drawTitle(i, gMain);
}}if (this.haveSingleYScale && i == iSpectrumForScale) {
if (this.pd.getBoolean(JSV.common.ScriptToken.YSCALEON)) this.drawYScale(gMain, this);
}if (this.haveSingleYScale && this.yPixel00 < 30) {
if (this.pd.getBoolean(JSV.common.ScriptToken.YUNITSON)) this.drawYUnits(gMain);
}}var hasPendingIntegral = (!isGrey && this.pendingIntegral != null && spec === this.pendingIntegral.spec);
if (doAll || hasPendingIntegral) {
this.drawPlot(hasPendingIntegral && !doAll ? gFront : gMain, i, spec, isContinuous, offset, isGrey, null, onSpectrum, hasPendingIntegral, pointsOnly);
}this.drawIntegration(gFront, i, offset, isGrey, ig, isContinuous && onSpectrum);
this.drawMeasurements(gFront, i);
if (this.pendingMeasurement != null && this.pendingMeasurement.spec === spec) this.drawMeasurement(gFront, this.pendingMeasurement);
if (isContinuous && onSpectrum && this.xPixelMovedTo >= 0) {
this.drawSpectrumPointer(gFront, spec, offset, ig);
}if (this.nSpectra > 1 && this.nSplit == 1 && this.pd.isCurrentGraphSet(this) && doAll) {
this.haveLeftRightArrows = true;
if (!this.isPrintingOrSaving) {
this.setScale(0);
iSpecForFrame = (this.iSpectrumSelected);
if (this.nSpectra != 2) {
this.setPlotColor(gMain, (iSpecForFrame + this.nSpectra - 1) % this.nSpectra);
this.fillArrow(gMain, 1, this.yHArrows, this.xHArrows - 9, true);
this.setCurrentBoxColor(gMain);
this.fillArrow(gMain, 1, this.yHArrows, this.xHArrows - 9, false);
}if (iSpecForFrame >= 0) {
this.setPlotColor(gMain, iSpecForFrame);
this.fillCircle(gMain, this.xHArrows, this.yHArrows, true);
}this.setCurrentBoxColor(gMain);
this.fillCircle(gMain, this.xHArrows, this.yHArrows, false);
this.setPlotColor(gMain, (iSpecForFrame + 1) % this.nSpectra);
this.fillArrow(gMain, 2, this.yHArrows, this.xHArrows + 9, true);
this.setCurrentBoxColor(gMain);
this.fillArrow(gMain, 2, this.yHArrows, this.xHArrows + 9, false);
}}offset -= yOffsetPixels;
}
if (doAll) {
if (this.pd.getBoolean(JSV.common.ScriptToken.XSCALEON)) this.drawXScale(gMain, this);
if (this.pd.getBoolean(JSV.common.ScriptToken.XUNITSON)) this.drawXUnits(gMain);
}} else {
if (doAll) {
if (this.pd.getBoolean(JSV.common.ScriptToken.XSCALEON)) this.drawXScale(gMain, this.imageView);
if (this.pd.getBoolean(JSV.common.ScriptToken.YSCALEON)) this.drawYScale(gMain, this.imageView);
if (subIndex >= 0) this.draw2DUnits(gMain);
}this.drawWidgets(gFront, g2, subIndex, needNewPins, doDraw1DObjects, true, false);
this.drawWidgets(gFront, g2, subIndex, needNewPins, doDraw1DObjects, true, true);
this.widgetsAreSet = true;
}if (this.annotations != null) this.drawAnnotations(gFront, this.annotations, null);
this.isPrintingOrSaving = false;
}, "~O,~O,~O,~N,~B,~B,~B");
Clazz_defineMethod(c$, "drawTitle", 
function(i, gMain){
var title = this.getSpectrumAt(i).getPeakTitle();
if (title.length > 0) {
var y = (this.isPrintingOrSaving ? this.yPixel11 + 20 : this.height);
this.pd.drawTitle(gMain, y, this.width, title);
this.pd.titleDrawn = !this.isPrintingOrSaving;
}}, "~N,~O");
Clazz_defineMethod(c$, "drawSpectrumSource", 
function(g, i){
this.pd.printFilePath(g, this.pd.thisWidth - this.pd.right, this.yPixel0 - 20, this.spectra.get(i).getFilePath());
}, "~O,~N");
Clazz_defineMethod(c$, "doPlot", 
function(i, iSplit){
var isGrey = (this.stackSelected && this.iSpectrumSelected >= 0 && this.iSpectrumSelected != i);
var ok = (this.showAllStacked || this.iSpectrumSelected == -1 || this.iSpectrumSelected == i);
return (this.nSplit > 1 ? i == iSplit : ok && (!this.pd.isPrinting || !isGrey));
}, "~N,~N");
Clazz_defineMethod(c$, "drawSpectrumPointer", 
function(gFront, spec, yOffset, ig){
if (this.isPrintingOrSaving) return;
this.setColorFromToken(gFront, JSV.common.ScriptToken.PEAKTABCOLOR);
var iHandle = this.pd.integralShiftMode;
if (ig != null) {
if ((!this.pd.ctrlPressed || this.pd.isIntegralDrag) && !this.isOnSpectrum(this.pd.mouseX, this.pd.mouseY, -1)) {
ig = null;
} else if (iHandle == 0) {
iHandle = this.getShiftMode(this.pd.mouseX, this.pd.mouseY);
if (iHandle == 0) iHandle = 2147483647;
}}var y0 = this.yValueMovedTo;
this.yValueMovedTo = (ig == null ? spec.getYValueAt(this.xValueMovedTo) : ig.getPercentYValueAt(this.xValueMovedTo));
this.setCoordStr(this.xValueMovedTo, this.yValueMovedTo);
if (iHandle != 0) {
this.setPlotColor(gFront, iHandle == 2147483647 ? -1 : 0);
if (iHandle < 0 || iHandle == 2147483647) {
this.drawHandle(gFront, this.xPixelPlot1, this.yPixelPlot0, 3, false);
}if (iHandle > 0) {
this.drawHandle(gFront, this.xPixelPlot0, this.yPixelPlot1, 3, false);
}if (iHandle != 2147483647) return;
}if (ig != null) this.g2d.setStrokeBold(gFront, true);
if (Double.isNaN(y0) || this.pendingMeasurement != null) {
this.g2d.drawLine(gFront, this.xPixelMovedTo, this.yPixel0, this.xPixelMovedTo, this.yPixel1);
if (this.xPixelMovedTo2 >= 0) this.g2d.drawLine(gFront, this.xPixelMovedTo2, this.yPixel0, this.xPixelMovedTo2, this.yPixel1);
this.yValueMovedTo = NaN;
} else {
var y = (ig == null ? yOffset + this.toPixelY(this.yValueMovedTo) : this.toPixelYint(this.yValueMovedTo / 100));
if (y == this.fixY(y)) this.g2d.drawLine(gFront, this.xPixelMovedTo, y - 10, this.xPixelMovedTo, y + 10);
}if (ig != null) this.g2d.setStrokeBold(gFront, false);
}, "~O,JSV.common.Spectrum,~N,JSV.common.IntegralData");
Clazz_defineMethod(c$, "setScale", 
function(i){
this.viewData.setScale(i, this.xPixels, this.yPixels, this.spectra.get(i).isInverted());
}, "~N");
Clazz_defineMethod(c$, "draw2DUnits", 
function(g){
var nucleusX = this.getSpectrumAt(0).nucleusX;
var nucleusY = this.getSpectrumAt(0).nucleusY;
this.setColorFromToken(g, JSV.common.ScriptToken.PLOTCOLOR);
this.drawUnits(g, nucleusX, this.imageView.xPixel1 + 5 * this.pd.scalingFactor, this.yPixel1, 1, 1.0);
this.drawUnits(g, nucleusY, this.imageView.xPixel0 - 5 * this.pd.scalingFactor, this.yPixel0, 1, 0);
}, "~O");
Clazz_defineMethod(c$, "drawPeakTabs", 
function(gFront, g2, spec){
if (this.isPrintingOrSaving) return;
var list = (this.nSpectra == 1 || this.iSpectrumSelected >= 0 ? spec.getPeakList() : null);
if (list != null && list.size() > 0) {
if (this.piMouseOver != null && this.piMouseOver.spectrum === spec && this.pd.isMouseUp()) {
this.setColorFromToken(g2, JSV.common.ScriptToken.PEAKOVERCOLOR);
this.drawPeak(g2, this.piMouseOver, 0);
spec.setHighlightedPeak(this.piMouseOver);
} else {
spec.setHighlightedPeak(null);
}this.setColorFromToken(gFront, JSV.common.ScriptToken.PEAKTABCOLOR);
for (var i = list.size(); --i >= 0; ) {
var p = list.get(i);
this.drawPeak(gFront, p, p === spec.getSelectedPeak() ? 14 : 7);
}
}}, "~O,~O,JSV.common.Spectrum");
Clazz_defineMethod(c$, "drawPeak", 
function(g, pi, tickSize){
if (this.isPrintingOrSaving) return;
var xMin = pi.getXMin();
var xMax = pi.getXMax();
if (xMin == xMax) return;
this.drawBar(g, pi, xMin, xMax, null, tickSize);
}, "~O,JSV.common.PeakInfo,~N");
Clazz_defineMethod(c$, "drawWidgets", 
function(gFront, gBack, subIndex, needNewPins, doDraw1DObjects, doDraw1DY, postGrid){
this.setWidgets(needNewPins, subIndex, doDraw1DObjects);
if (this.isPrintingOrSaving && (this.imageView == null ? !this.cur1D2Locked : this.sticky2Dcursor)) return;
if (!this.pd.isPrinting && !postGrid) {
if (doDraw1DObjects) {
this.fillBox(gFront, this.xPixel0, this.pin1Dx0.yPixel1, this.xPixel1, this.pin1Dx1.yPixel1 + 2, JSV.common.ScriptToken.GRIDCOLOR);
this.fillBox(gFront, this.pin1Dx0.xPixel0, this.pin1Dx0.yPixel1, this.pin1Dx1.xPixel0, this.pin1Dx1.yPixel1 + 2, JSV.common.ScriptToken.PLOTCOLOR);
} else {
this.fillBox(gFront, this.imageView.xPixel0, this.pin2Dx0.yPixel1, this.imageView.xPixel1, this.pin2Dx0.yPixel1 + 2, JSV.common.ScriptToken.GRIDCOLOR);
this.fillBox(gFront, this.pin2Dx0.xPixel0, this.pin2Dx0.yPixel1, this.pin2Dx1.xPixel0, this.pin2Dx1.yPixel1 + 2, JSV.common.ScriptToken.PLOTCOLOR);
this.fillBox(gFront, this.pin2Dy0.xPixel1, this.yPixel1, this.pin2Dy1.xPixel1 + 2, this.yPixel0, JSV.common.ScriptToken.GRIDCOLOR);
this.fillBox(gFront, this.pin2Dy0.xPixel1, this.pin2Dy0.yPixel1, this.pin2Dy1.xPixel1 + 2, this.pin2Dy1.yPixel0, JSV.common.ScriptToken.PLOTCOLOR);
}this.fillBox(gFront, this.pin1Dy0.xPixel1, this.yPixel1, this.pin1Dy1.xPixel1 + 2, this.yPixel0, JSV.common.ScriptToken.GRIDCOLOR);
if (doDraw1DY) this.fillBox(gFront, this.pin1Dy0.xPixel1, this.pin1Dy0.yPixel1, this.pin1Dy1.xPixel1 + 2, this.pin1Dy1.yPixel0, JSV.common.ScriptToken.PLOTCOLOR);
}for (var i = 0; i < this.widgets.length; i++) {
var pw = this.widgets[i];
if (pw == null || !pw.isPinOrCursor && !this.zoomEnabled) continue;
var isLockedCursor = (pw === this.cur1D2x1 || pw === this.cur1D2x2 || pw === this.cur2Dx0 || pw === this.cur2Dx1 || pw === this.cur2Dy);
if ((pw.isPin || !pw.isPinOrCursor) == postGrid) continue;
if (pw.is2D) {
if (pw === this.cur2Dx0 && !doDraw1DObjects) continue;
} else {
var isPin1Dy = (pw === this.pin1Dy0 || pw === this.pin1Dy1 || pw === this.pin1Dy01);
if ((this.imageView != null && doDraw1DObjects == isPin1Dy) || isPin1Dy && !doDraw1DY || pw === this.cur1D2x1 && this.gs2dLinkedX == null || pw === this.cur1D2x2 && this.gs2dLinkedY == null || pw === this.zoomBox1D && (this.pd.isIntegralDrag || this.pd.integralShiftMode != 0)) {
if (!this.isLinked || this.imageView != null) continue;
}}if (this.pd.isPrinting && !isLockedCursor) continue;
if (pw.isPinOrCursor) {
this.setColorFromToken(gFront, pw.color);
this.g2d.drawLine(gFront, pw.xPixel0, pw.yPixel0, pw.xPixel1, pw.yPixel1);
pw.isVisible = true;
if (pw.isPin) this.drawHandle(gFront, pw.xPixel0, pw.yPixel0, 2, !pw.isEnabled);
} else if (pw.xPixel1 != pw.xPixel0) {
this.fillBox(gBack, pw.xPixel0, pw.yPixel0, pw.xPixel1, pw.yPixel1, pw === this.zoomBox1D && this.pd.shiftPressed ? JSV.common.ScriptToken.ZOOMBOXCOLOR2 : JSV.common.ScriptToken.ZOOMBOXCOLOR);
}}
}, "~O,~O,~N,~B,~B,~B,~B");
Clazz_defineMethod(c$, "drawBar", 
function(g, pi, xMin, xMax, whatColor, tickSize){
var x1 = this.toPixelX(xMin);
var x2 = this.toPixelX(xMax);
if (x1 > x2) {
var tmp = x1;
x1 = x2;
x2 = tmp;
}x1 = this.fixX(x1);
x2 = this.fixX(x2);
if (x2 - x1 < 3) {
x1 -= 2;
x2 += 2;
}if (pi != null) pi.setPixelRange(x1, x2);
if (tickSize == 0) {
this.fillBox(g, x1, this.yPixel0, x2, this.yPixel0 + this.yPixels, whatColor);
} else {
this.fillBox(g, x1, this.yPixel0 + 2, x2, this.yPixel0 + 5, whatColor);
if (pi != null) {
x1 = Clazz_doubleToInt((x1 + x2) / 2);
this.fillBox(g, x1 - 1, this.yPixel0 + 2, x1 + 1, this.yPixel0 + 2 + tickSize, whatColor);
}}}, "~O,JSV.common.PeakInfo,~N,~N,JSV.common.ScriptToken,~N");
Clazz_defineMethod(c$, "drawIntegration", 
function(gFront, index, yOffset, isGrey, iData, isSelected){
if (iData != null) {
if (this.haveIntegralDisplayed(index)) this.drawPlot(gFront, index, this.spectra.get(index), true, yOffset, false, iData, true, false, false);
this.drawIntegralValues(gFront, index, yOffset);
}var ratios = this.getIntegrationRatios(index);
if (ratios != null) this.drawAnnotations(gFront, ratios, JSV.common.ScriptToken.INTEGRALPLOTCOLOR);
}, "~O,~N,~N,~B,JSV.common.IntegralData,~B");
Clazz_defineMethod(c$, "getMeasurements", 
function(type, iSpec){
var ad = this.getDialog(type, iSpec);
return (ad == null || ad.getData().size() == 0 || !ad.getState() ? null : ad.getData());
}, "JSV.common.Annotation.AType,~N");
Clazz_defineMethod(c$, "drawPlot", 
function(g, index, spec, isContinuous, yOffset, isGrey, ig, isSelected, hasPendingIntegral, pointsOnly){
var xyCoords = (ig == null ? spec.getXYCoords() : this.getIntegrationGraph(index).getXYCoords());
var isIntegral = (ig != null);
var bsDraw = (isIntegral ? ig.getBitSet() : null);
var fillPeaks = (hasPendingIntegral || spec.fillColor != null && isSelected);
var iColor = (isGrey ? -2 : isIntegral ? -1 : !this.allowStacking ? 0 : index);
this.setPlotColor(g, iColor);
var plotOn = true;
var y0 = this.toPixelY(0);
if (isIntegral) fillPeaks = new Boolean (fillPeaks & (y0 == this.fixY(y0))).valueOf();
 else y0 = this.fixY(y0);
var cInt = (isIntegral || fillPeaks ? this.pd.getColor(JSV.common.ScriptToken.INTEGRALPLOTCOLOR) : null);
var cFill = (cInt == null || spec.fillColor == null ? cInt : spec.fillColor);
var iFirst = this.viewData.getStartingPointIndex(index);
var iLast = this.viewData.getEndingPointIndex(index);
if (isContinuous && !pointsOnly) {
iLast--;
var doLineTo = (isIntegral || this.pendingIntegral != null) && this.g2d.canDoLineTo();
if (doLineTo) this.g2d.doStroke(g, true);
var isDown = false;
for (var i = iFirst; i <= iLast; i++) {
var point1 = xyCoords[i];
var point2 = xyCoords[i + 1];
var y1 = (isIntegral ? this.toPixelYint(point1.getYVal()) : this.toPixelY(point1.getYVal()));
if (y1 == -2147483648) continue;
var y2 = (isIntegral ? this.toPixelYint(point2.getYVal()) : this.toPixelY(point2.getYVal()));
if (y2 == -2147483648) continue;
var xv1 = point1.getXVal();
var xv2 = point2.getXVal();
var x1 = this.toPixelX(xv1);
var x2 = this.toPixelX(xv2);
y1 = this.fixY(yOffset + y1);
y2 = this.fixY(yOffset + y2);
if (isIntegral) {
if (i == iFirst) {
this.xPixelPlot1 = x1;
this.yPixelPlot0 = y1;
}this.xPixelPlot0 = x2;
this.yPixelPlot1 = y2;
}if (x2 == x1 && y1 == y2) continue;
if (fillPeaks && hasPendingIntegral && this.pendingIntegral.overlaps(xv1, xv2)) {
if (cFill != null) {
this.g2d.doStroke(g, false);
this.g2d.setGraphicsColor(g, cFill);
}this.g2d.fillRect(g, Math.min(x1, x2), Math.min(y0, y1), Math.max(1, Math.abs(x2 - x1)), Math.abs(y0 - y1));
if (cFill != null) {
this.g2d.doStroke(g, false);
this.g2d.doStroke(g, true);
isDown = false;
this.setPlotColor(g, iColor);
}continue;
}if (y1 == y2 && (y1 == this.yPixel0)) {
continue;
}if (bsDraw != null && bsDraw.get(i) != plotOn) {
plotOn = bsDraw.get(i);
if (doLineTo && isDown) {
this.g2d.doStroke(g, false);
this.g2d.doStroke(g, true);
isDown = false;
}if (!this.pd.isPrinting && this.pd.integralShiftMode != 0) this.setPlotColor(g, 0);
 else if (plotOn) this.setColorFromToken(g, JSV.common.ScriptToken.INTEGRALPLOTCOLOR);
 else this.setPlotColor(g, -3);
}if (this.pd.isPrinting && !plotOn) continue;
if (isDown) {
this.g2d.lineTo(g, x2, y2);
} else {
this.g2d.drawLine(g, x1, y1, x2, y2);
isDown = doLineTo;
}}
if (doLineTo) this.g2d.doStroke(g, false);
} else {
for (var i = iFirst; i <= iLast; i++) {
var point = xyCoords[i];
var y2 = this.toPixelY(point.getYVal());
if (y2 == -2147483648) continue;
var x1 = this.toPixelX(point.getXVal());
var y1 = this.toPixelY(Math.max(this.getScale().minYOnScale, 0));
y1 = this.fixY(yOffset + y1);
y2 = this.fixY(yOffset + y2);
if (y1 == y2 && (y1 == this.yPixel0 || y1 == this.yPixel1)) continue;
if (pointsOnly) this.g2d.fillRect(g, x1 - 1, y2 - 1, 3, 3);
 else this.g2d.drawLine(g, x1, y1, x1, y2);
}
if (!pointsOnly && this.getScale().isYZeroOnScale()) {
var y = yOffset + this.toPixelY(this.getScale().spectrumYRef);
if (y == this.fixY(y)) this.g2d.drawLine(g, this.xPixel1, y, this.xPixel0, y);
}}}, "~O,~N,JSV.common.Spectrum,~B,~N,~B,JSV.common.IntegralData,~B,~B,~B");
Clazz_defineMethod(c$, "drawFrame", 
function(g, iSpec, addCurrentBox, addSplitBox, drawUpDownArrows){
if (!this.pd.gridOn || this.isPrintingOrSaving) {
this.setColorFromToken(g, JSV.common.ScriptToken.GRIDCOLOR);
this.g2d.drawRect(g, this.xPixel0, this.yPixel0, this.xPixels, this.yPixels);
if (this.isPrintingOrSaving) return;
}this.setCurrentBoxColor(g);
if (drawUpDownArrows) {
if (iSpec >= 0) {
this.setPlotColor(g, iSpec);
this.fillArrow(g, 3, this.xVArrows, Clazz_doubleToInt((this.yPixel00 + this.yPixel11) / 2) - 9, true);
this.fillArrow(g, 4, this.xVArrows, Clazz_doubleToInt((this.yPixel00 + this.yPixel11) / 2) + 9, true);
this.setCurrentBoxColor(g);
}this.fillArrow(g, 3, this.xVArrows, Clazz_doubleToInt((this.yPixel00 + this.yPixel11) / 2) - 9, false);
this.fillCircle(g, this.xVArrows, Clazz_doubleToInt((this.yPixel00 + this.yPixel11) / 2), false);
this.fillArrow(g, 4, this.xVArrows, Clazz_doubleToInt((this.yPixel00 + this.yPixel11) / 2) + 9, false);
}if (this.imageView != null) return;
if (addCurrentBox) {
var x1 = this.xPixel00 + 10;
var x2 = this.xPixel11 - 10;
var y1 = this.yPixel00 + 1;
var y2 = this.yPixel11 - 2;
this.g2d.drawLine(g, x1, y1, x2, y1);
this.g2d.drawLine(g, x2, y1, x2, y2);
this.g2d.drawLine(g, x1, y2, x2, y2);
this.splitterX = this.closerX = -2147483648;
this.drawBox(g, x2 - 10, y1, x2, y1 + 10, null);
this.g2d.drawLine(g, x2 - 10, y1 + 10, x2, y1);
this.g2d.drawLine(g, x2, y1 + 10, x2 - 10, y1);
this.closerX = x2 - 10;
this.closerY = y1;
if (addSplitBox) {
x2 -= 10;
this.fillBox(g, x2 - 10, y1, x2, y1 + 10, null);
this.splitterX = x2 - 10;
this.splitterY = y1;
}}}, "~O,~N,~B,~B,~B");
Clazz_defineMethod(c$, "drawGrid", 
function(g){
if (!this.pd.gridOn || this.imageView != null) return;
this.setColorFromToken(g, JSV.common.ScriptToken.GRIDCOLOR);
var lastX;
if (Double.isNaN(this.getScale().firstX)) {
lastX = this.getScale().maxXOnScale + this.getScale().steps[0] / 2;
for (var val = this.getScale().minXOnScale; val < lastX; val += this.getScale().steps[0]) {
var x = this.toPixelX(val);
this.g2d.drawLine(g, x, this.yPixel0, x, this.yPixel1);
}
} else {
lastX = this.getScale().maxXOnScale * 1.0001;
for (var val = this.getScale().firstX; val <= lastX; val += this.getScale().steps[0]) {
var x = this.toPixelX(val);
this.g2d.drawLine(g, x, this.yPixel0, x, this.yPixel1);
}
}for (var val = this.getScale().firstY; val < this.getScale().maxYOnScale + this.getScale().steps[1] / 2; val += this.getScale().steps[1]) {
var y = this.toPixelY(val);
if (y == this.fixY(y)) this.g2d.drawLine(g, this.xPixel0, y, this.xPixel1, y);
}
}, "~O");
Clazz_defineMethod(c$, "drawXScale", 
function(g, c){
this.setColorFromToken(g, JSV.common.ScriptToken.SCALECOLOR);
if (this.pd.isPrinting) this.g2d.drawLine(g, c.getXPixel0(), this.yPixel1, c.getXPixel0() + c.getXPixels() - 1, this.yPixel1);
var precision = this.getScale().precision[0];
var font = this.pd.setFont(g, c.getXPixels(), 0, this.pd.isPrinting ? 10 : 12, false);
var y1 = this.yPixel1;
var y2 = this.yPixel1 + 4 * this.pd.scalingFactor;
var y3 = this.yPixel1 + 2 * this.pd.scalingFactor;
var h = font.getHeight();
var dx = c.toPixelX(this.getScale().steps[0]) - c.toPixelX(0);
var maxWidth = Math.abs(dx * 0.95);
var firstX = this.getScale().firstX - this.getScale().steps[0];
var lastX = (this.getScale().maxXOnScale + this.getScale().steps[0]) * 1.0001;
for (var pass = 0; pass < 2; pass++) {
if (pass == 1) JSV.common.ScaleData.fixScale(this.mapX);
var prevX = 1e10;
for (var val = firstX; val <= lastX; val += this.getScale().steps[0]) {
var x = c.toPixelX(val);
var d = Double.$valueOf(val);
var s;
switch (pass) {
case 0:
s = JU.DF.formatDecimalDbl(val, precision);
this.mapX.put(d, s);
this.drawTick(g, x, y1, y2, c);
dx = Math.abs(prevX - val);
var ntick = this.getScale().minorTickCounts[0];
if (ntick != 0) {
var step = dx / ntick;
for (var i = 1; i < ntick; i++) {
var x1 = val - i * step;
this.drawTick(g, c.toPixelX(x1), y1, y3, c);
}
}prevX = val;
continue;
case 1:
s = this.mapX.get(d);
if (s == null || x != c.fixX(x)) continue;
var w = this.pd.getStringWidth(s);
var n = (x + Clazz_doubleToInt(w / 2) == c.fixX(x + Clazz_doubleToInt(w / 2)) ? 2 : 0);
if (n > 0) this.g2d.drawString(g, s, x - Clazz_doubleToInt(w / n), y2 + h);
val += Math.floor(w / maxWidth) * this.getScale().steps[0];
break;
}
}
}
this.mapX.clear();
}, "~O,JSV.common.XYScaleConverter");
Clazz_defineMethod(c$, "drawTick", 
function(g, x, y1, y2, c){
if (x == c.fixX(x)) this.g2d.drawLine(g, x, y1, x, y2);
}, "~O,~N,~N,~N,JSV.common.XYScaleConverter");
Clazz_defineMethod(c$, "drawYScale", 
function(g, c){
var sd = c.getScale();
var precision = sd.precision[1];
var font = this.pd.setFont(g, c.getXPixels(), 0, this.pd.isPrinting ? 10 : 12, false);
var h = font.getHeight();
var max = sd.maxYOnScale + sd.steps[1] / 2;
var yLast = -2147483648;
this.setColorFromToken(g, JSV.common.ScriptToken.SCALECOLOR);
for (var pass = 0; pass < 2; pass++) {
if (pass == 1) JSV.common.ScaleData.fixScale(this.mapX);
for (var val = sd.firstY; val < max; val += sd.steps[1]) {
var d = Double.$valueOf(val);
var x1 = c.getXPixel0();
var y = c.toPixelY(val);
if (y != c.fixY(y)) continue;
var s;
if (pass == 0) this.g2d.drawLine(g, x1, y, x1 - 3 * this.pd.scalingFactor, y);
if (Math.abs(y - yLast) <= h) continue;
yLast = y;
switch (pass) {
case 0:
s = JU.DF.formatDecimalDbl(val, precision);
this.mapX.put(d, s);
break;
case 1:
s = this.mapX.get(d);
if (s == null) continue;
if (s.startsWith("0") && s.contains("E")) s = "0";
this.g2d.drawString(g, s, (x1 - 4 * this.pd.scalingFactor - this.pd.getStringWidth(s)), y + Clazz_doubleToInt(h / 3));
break;
}
}
}
this.mapX.clear();
}, "~O,JSV.common.XYScaleConverter");
Clazz_defineMethod(c$, "drawXUnits", 
function(g){
var units = this.spectra.get(0).getAxisLabel(true);
if (units != null) this.drawUnits(g, units, this.xPixel1 + 25 * this.pd.scalingFactor, this.yPixel1 + 5 * this.pd.scalingFactor, 1, 1);
}, "~O");
Clazz_defineMethod(c$, "drawUnits", 
function(g, s, x, y, hOff, vOff){
this.setColorFromToken(g, JSV.common.ScriptToken.UNITSCOLOR);
this.pd.setFont(g, (this.imageView == null ? this : this.imageView).getXPixels(), 3, 10, false);
this.g2d.drawString(g, s, Clazz_doubleToInt(x - this.pd.getStringWidth(s) * hOff), Clazz_doubleToInt(y + this.pd.getFontHeight() * vOff));
}, "~O,~S,~N,~N,~N,~N");
Clazz_defineMethod(c$, "drawYUnits", 
function(g){
var units = this.spectra.get(0).getAxisLabel(false);
if (units === "") units = "ARBITRARY UNITS";
if (units != null && !this.pd.unitsDrawn) {
this.drawUnits(g, units, (this.pd.isPrinting ? 30 : 5) * this.pd.scalingFactor, this.yPixel0 + (this.pd.isPrinting ? 0 : 5) * this.pd.scalingFactor, 0, -1);
}this.pd.unitsDrawn = true;
}, "~O");
Clazz_defineMethod(c$, "drawHighlightsAndPeakTabs", 
function(gFront, gBack, iSpec){
var md = this.getMeasurements(JSV.common.Annotation.AType.PeakList, iSpec);
var spec = this.spectra.get(iSpec);
if (this.isPrintingOrSaving) {
if (md != null) {
this.setColorFromToken(gFront, JSV.common.ScriptToken.PEAKTABCOLOR);
this.printPeakList(gFront, spec, md);
}return;
}if (md == null) {
for (var i = 0; i < this.highlights.size(); i++) {
var hl = this.highlights.get(i);
if (hl.spectrum === spec) {
this.pd.setHighlightColor(hl.color);
this.drawBar(gBack, null, hl.x1, hl.x2, JSV.common.ScriptToken.HIGHLIGHTCOLOR, 0);
}}
if (this.pd.peakTabsOn) this.drawPeakTabs(gFront, gBack, spec);
}var y;
if (md != null) {
y = (spec.isInverted() ? this.yPixel1 - 10 * this.pd.scalingFactor : this.yPixel0);
this.setColorFromToken(gFront, JSV.common.ScriptToken.PEAKTABCOLOR);
for (var i = md.size(); --i >= 0; ) {
var m = md.get(i);
var x = this.toPixelX(m.getXVal());
this.g2d.drawLine(gFront, x, y, x, y + 10 * this.pd.scalingFactor);
}
if (this.isVisible(this.getDialog(JSV.common.Annotation.AType.PeakList, iSpec))) {
y = this.toPixelY((md).getThresh());
if (y == this.fixY(y) && !this.pd.isPrinting) this.g2d.drawLine(gFront, this.xPixel0, y, this.xPixel1, y);
}}}, "~O,~O,~N");
Clazz_defineMethod(c$, "printPeakList", 
function(g, spec, data){
var sdata = data.getMeasurementListArray(null);
if (sdata.length == 0) return;
this.pd.setFont(g, this.xPixels, 0, 8, false);
var h = this.pd.getFontHeight();
var xs =  Clazz_newIntArray (data.size(), 0);
var xs0 =  Clazz_newIntArray (data.size(), 0);
var dx = 0;
var s5 = 5 * this.pd.scalingFactor;
var s10 = 10 * this.pd.scalingFactor;
var s15 = 15 * this.pd.scalingFactor;
var s25 = 25 * this.pd.scalingFactor;
for (var i = 0; i < sdata.length; i++) {
xs0[i] = this.toPixelX(Double.parseDouble(sdata[i][1]));
if (i == 0) {
xs[i] = xs0[i];
continue;
}xs[i] = Math.max(xs[i - 1] + h, xs0[i] + h);
dx += (xs[i] - xs0[i]);
}
dx /= 2 * sdata.length;
if (xs[0] - dx < this.xPixel0 + s25) dx = xs[0] - (this.xPixel0 + s25);
for (var i = 0; i < sdata.length; i++) xs[i] -= dx;

var inverted = spec.isInverted();
var y4 = this.pd.getStringWidth("99.9999");
var y2 = (sdata[0].length >= 6 ? this.pd.getStringWidth("99.99") : 0);
var f = (inverted ? -1 : 1);
var y = (inverted ? this.yPixel1 : this.yPixel0) + f * (y2 + y4 + s15);
for (var i = 0; i < sdata.length; i++) {
this.g2d.drawLine(g, xs[i], y, xs[i], y + s5 * f);
this.g2d.drawLine(g, xs[i], y + s5 * f, xs0[i], y + s10 * f);
this.g2d.drawLine(g, xs0[i], y + s10 * f, xs0[i], y + s15 * f);
if (y2 > 0 && sdata[i][4].length > 0) this.g2d.drawLine(g, Clazz_doubleToInt((xs[i] + xs[i - 1]) / 2), y - y4 + s5, Clazz_doubleToInt((xs[i] + xs[i - 1]) / 2), y - y4 - s5);
}
y -= f * 2 * this.pd.scalingFactor;
if (y2 > 0) {
this.drawStringRotated(g, -90, xs[0] - s15, y, "  ppm");
this.drawStringRotated(g, -90, xs[0] - s15, y - y4 - s5, " Hz");
}for (var i = data.size(); --i >= 0; ) {
this.drawStringRotated(g, -90 * f, xs[i] + Clazz_doubleToInt(f * h / 3), y, sdata[i][1]);
if (y2 > 0 && sdata[i][4].length > 0) {
var x = Clazz_doubleToInt((xs[i] + xs[i - 1]) / 2) + Clazz_doubleToInt(h / 3);
this.drawStringRotated(g, -90, x, y - y4 - s5, sdata[i][4]);
}}
}, "~O,JSV.common.Spectrum,JSV.common.PeakData");
Clazz_defineMethod(c$, "drawStringRotated", 
function(g, angle, x, y, s){
this.g2d.drawStringRotated(g, s, x, y, angle);
}, "~O,~N,~N,~N,~S");
Clazz_defineMethod(c$, "drawAnnotations", 
function(g, annotations, whatColor){
this.pd.setFont(g, this.xPixels, 1, 18, false);
for (var i = annotations.size(); --i >= 0; ) {
var note = annotations.get(i);
this.setAnnotationColor(g, note, whatColor);
var c = (note.is2D ? this.imageView : this);
var x = c.toPixelX(note.getXVal());
var y = (note.isPixels() ? Clazz_doubleToInt(this.yPixel0 + 10 + 10 * this.pd.scalingFactor - note.getYVal()) : note.is2D ? this.imageView.subIndexToPixelY(Clazz_doubleToInt(note.getYVal())) : this.toPixelY(note.getYVal()));
this.g2d.drawString(g, note.text, x + note.offsetX * this.pd.scalingFactor, y - note.offsetY * this.pd.scalingFactor);
}
}, "~O,JU.Lst,JSV.common.ScriptToken");
Clazz_defineMethod(c$, "drawIntegralValues", 
function(g, iSpec, yOffset){
var integrals = this.getMeasurements(JSV.common.Annotation.AType.Integration, iSpec);
if (integrals != null) {
if (this.pd.isPrinting) this.pd.setFont(g, this.xPixels, 0, 8, false);
 else this.pd.setFont(g, this.xPixels, 1, 12, false);
this.setColorFromToken(g, JSV.common.ScriptToken.INTEGRALPLOTCOLOR);
var h = this.pd.getFontHeight();
this.g2d.setStrokeBold(g, true);
for (var i = integrals.size(); --i >= 0; ) {
var $in = integrals.get(i);
if ($in.getValue() == 0) continue;
var x = this.toPixelX($in.getXVal2());
var y1 = yOffset * this.pd.scalingFactor + this.toPixelYint($in.getYVal());
var y2 = yOffset * this.pd.scalingFactor + this.toPixelYint($in.getYVal2());
if (x != this.fixX(x) || y1 != this.fixY(y1) || y2 != this.fixY(y2)) continue;
if (!this.pd.isPrinting) this.g2d.drawLine(g, x, y1, x, y2);
var s = "  " + $in.text;
this.g2d.drawString(g, s, x, Clazz_doubleToInt((y1 + y2) / 2) + Clazz_doubleToInt(h / 3));
}
this.g2d.setStrokeBold(g, false);
}if (iSpec == this.getFixedSelectedSpectrumIndex()) this.selectedSpectrumIntegrals = integrals;
}, "~O,~N,~N");
Clazz_defineMethod(c$, "drawMeasurements", 
function(g, iSpec){
var md = this.getMeasurements(JSV.common.Annotation.AType.Measurements, iSpec);
if (md != null) for (var i = md.size(); --i >= 0; ) this.drawMeasurement(g, md.get(i));

if (iSpec == this.getFixedSelectedSpectrumIndex()) this.selectedSpectrumMeasurements = md;
}, "~O,~N");
Clazz_defineMethod(c$, "drawMeasurement", 
function(g, m){
if (m.text.length == 0 && m !== this.pendingMeasurement) return;
this.pd.setFont(g, this.xPixels, 1, 12, false);
this.g2d.setGraphicsColor(g, (m === this.pendingMeasurement ? this.pd.getColor(JSV.common.ScriptToken.PEAKTABCOLOR) : this.pd.BLACK));
var x1 = this.toPixelX(m.getXVal());
var y1 = this.toPixelY(m.getYVal());
var x2 = this.toPixelX(m.getXVal2());
if (Double.isNaN(m.getXVal()) || x1 != this.fixX(x1) || x2 != this.fixX(x2)) return;
var drawString = (Math.abs(x1 - x2) >= 2);
var drawBaseLine = this.getScale().isYZeroOnScale() && m.spec.isHNMR();
var x = Clazz_doubleToInt((x1 + x2) / 2);
this.g2d.setStrokeBold(g, true);
if (drawString) this.g2d.drawLine(g, x1, y1, x2, y1);
if (drawBaseLine) this.g2d.drawLine(g, x1 + 1, this.yPixel1 - 1, x2, this.yPixel1 - 1);
this.g2d.setStrokeBold(g, false);
if (drawString) this.g2d.drawString(g, m.text, x + m.offsetX, y1 - m.offsetY);
if (drawBaseLine) {
this.g2d.drawLine(g, x1, this.yPixel1, x1, this.yPixel1 - 6 * this.pd.scalingFactor);
this.g2d.drawLine(g, x2, this.yPixel1, x2, this.yPixel1 - 6 * this.pd.scalingFactor);
}}, "~O,JSV.common.Measurement");
Clazz_defineMethod(c$, "getPinSelected", 
function(xPixel, yPixel){
if (this.widgets != null) for (var i = 0; i < this.widgets.length; i++) {
if (this.widgets[i] != null && this.widgets[i].isPinOrCursor && this.widgets[i].selected(xPixel, yPixel)) {
return this.widgets[i];
}}
return null;
}, "~N,~N");
Clazz_defineMethod(c$, "set2DCrossHairs", 
function(xPixel, yPixel){
var x;
if (xPixel == this.imageView.fixX(xPixel) && yPixel == this.fixY(yPixel)) {
this.pin1Dx1.setX(x = this.imageView.toX(xPixel), this.toPixelX(x));
this.cur2Dx1.setX(x, xPixel);
this.setCurrentSubSpectrum(this.imageView.toSubspectrumIndex(yPixel));
if (this.isLinked) {
var y = this.imageView.toY(yPixel);
this.pd.set2DCrossHairsLinked(this, x, y, !this.sticky2Dcursor);
}}}, "~N,~N");
Clazz_defineMethod(c$, "reset2D", 
function(isX){
if (isX) {
this.imageView.setView0(this.imageView.xPixel0, this.pin2Dy0.yPixel0, this.imageView.xPixel1, this.pin2Dy1.yPixel0);
this.doZoom(0, this.getScale().minY, 0, this.getScale().maxY, true, false, false, false, true);
} else {
this.imageView.setView0(this.pin2Dx0.xPixel0, this.imageView.yPixel0, this.pin2Dx1.xPixel0, this.imageView.yPixel1);
}}, "~B");
Clazz_defineMethod(c$, "setAnnotationText", 
function(a){
var sval = this.pd.getInput("New text?", "Set Label", a.text);
if (sval == null) return false;
if (sval.length == 0) this.annotations.removeObj(a);
 else a.text = sval;
return true;
}, "JSV.common.Annotation");
Clazz_defineMethod(c$, "checkIntegral", 
function(x1, x2, isFinal){
var ad = this.getDialog(JSV.common.Annotation.AType.Integration, -1);
if (ad == null) return false;
var integral = (ad.getData()).addIntegralRegion(x1, x2);
if (isFinal && JSV.common.GraphSet.isDialog(ad)) (ad).update(null, 0, 0);
if (Double.isNaN(x2)) return false;
this.pendingIntegral = (isFinal ? null : integral);
this.pd.isIntegralDrag = !isFinal;
this.selectedSpectrumIntegrals = null;
return true;
}, "~N,~N,~B");
Clazz_defineMethod(c$, "setToolTipForPixels", 
function(xPixel, yPixel){
if (this.iSpectrumMovedTo != this.iSpectrumClicked || this.pd.getCurrentGraphSet() !== this) {
this.pd.setToolTipText("click spectrum to activate");
return;
}if (this.isSplitWidget(xPixel, yPixel)) {
this.pd.setToolTipText("click to " + (this.nSplit > 1 ? "combine" : "split"));
return;
}if (this.isCloserWidget(xPixel, yPixel)) {
this.pd.setToolTipText("click to close");
return;
}var pw = this.getPinSelected(xPixel, yPixel);
var precisionX = this.getScale().precision[0];
var precisionY = this.getScale().precision[1];
if (pw != null) {
if (this.setStartupPinTip()) return;
var s;
if (pw === this.pin1Dx01 || pw === this.pin2Dx01) {
s = JU.DF.formatDecimalDbl(Math.min(this.pin1Dx0.getXVal(), this.pin1Dx1.getXVal()), precisionX) + " - " + JU.DF.formatDecimalDbl(Math.max(this.pin1Dx0.getXVal(), this.pin1Dx1.getXVal()), precisionX);
} else if (pw === this.pin1Dy01) {
s = JU.DF.formatDecimalDbl(Math.min(this.pin1Dy0.getYVal(), this.pin1Dy1.getYVal()), precisionY) + " - " + JU.DF.formatDecimalDbl(Math.max(this.pin1Dy0.getYVal(), this.pin1Dy1.getYVal()), precisionY);
} else if (pw === this.cur2Dy) {
var isub = this.imageView.toSubspectrumIndex(pw.yPixel0);
s = this.get2DYLabel(isub, precisionX);
} else if (pw === this.pin2Dy01) {
s = "" + Clazz_doubleToInt(Math.min(this.pin2Dy0.getYVal(), this.pin2Dy1.getYVal())) + " - " + Clazz_doubleToInt(Math.max(this.pin2Dy0.getYVal(), this.pin2Dy1.getYVal()));
} else if (pw.isXtype) {
s = JU.DF.formatDecimalDbl(pw.getXVal(), precisionX);
} else if (pw.is2D) {
s = "" + Clazz_doubleToInt(pw.getYVal());
} else {
s = JU.DF.formatDecimalDbl(pw.getYVal(), precisionY);
}this.pd.setToolTipText(s);
return;
}var yPt;
if (this.imageView != null) {
if (this.imageView.fixX(xPixel) == xPixel && this.fixY(yPixel) == yPixel) {
var isub = this.imageView.toSubspectrumIndex(yPixel);
var s = "y=" + this.get2DYLabel(isub, precisionX) + " / x=" + JU.DF.formatDecimalDbl(this.imageView.toX(xPixel), precisionX) + " " + this.getSpectrum().getAxisLabel(true);
this.pd.setToolTipText(s);
this.pd.coordStr = s;
return;
}if (!this.pd.display1D) {
this.pd.setToolTipText("");
this.pd.coordStr = "";
return;
}}var xPt = this.toX(this.fixX(xPixel));
yPt = (this.imageView != null && this.imageView.isXWithinRange(xPixel) ? this.imageView.toSubspectrumIndex(this.fixY(yPixel)) : this.toY(this.fixY(yPixel)));
var xx = this.setCoordStr(xPt, yPt);
var iSpec = this.getFixedSelectedSpectrumIndex();
if (!this.isInPlotRegion(xPixel, yPixel)) {
yPt = NaN;
} else if (this.nSpectra == 1) {
} else if (this.haveIntegralDisplayed(iSpec)) {
yPt = this.getIntegrationGraph(iSpec).getPercentYValueAt(xPt);
xx += ", " + JU.DF.formatDecimalDbl(yPt, 1);
}this.pd.setToolTipText((this.selectedIntegral != null ? "click to set value" : this.pendingMeasurement != null || this.selectedMeasurement != null ? (this.pd.hasFocus() ? "Press ESC to delete " + (this.selectedIntegral != null ? "integral, DEL to delete all visible, or N to normalize" : this.pendingMeasurement == null ? "\"" + this.selectedMeasurement.text + "\" or DEL to delete all visible" : "measurement") : "") : Double.isNaN(yPt) ? null : xx));
}, "~N,~N");
Clazz_defineMethod(c$, "isFrameBox", 
function(xPixel, yPixel, boxX, boxY){
return Math.abs(xPixel - (boxX + 5)) < 5 && Math.abs(yPixel - (boxY + 5)) < 5;
}, "~N,~N,~N,~N");
Clazz_defineMethod(c$, "setCoordStr", 
function(xPt, yPt){
var xx = JU.DF.formatDecimalDbl(xPt, this.getScale().precision[0]);
this.pd.coordStr = "(" + xx + (this.haveSingleYScale || this.iSpectrumSelected >= 0 ? ", " + JU.DF.formatDecimalDbl(yPt, this.getScale().precision[1]) : "") + ")";
return xx;
}, "~N,~N");
Clazz_defineMethod(c$, "setStartupPinTip", 
function(){
if (this.pd.startupPinTip == null) return false;
this.pd.setToolTipText(this.pd.startupPinTip);
this.pd.startupPinTip = null;
return true;
});
Clazz_defineMethod(c$, "get2DYLabel", 
function(isub, precision){
var spec = this.getSpectrumAt(0).getSubSpectra().get(isub);
return JU.DF.formatDecimalDbl(spec.getY2DPPM(), precision) + " PPM" + (spec.y2DUnits.equals("HZ") ? " (" + JU.DF.formatDecimalDbl(spec.getY2D(), precision) + " HZ) " : "");
}, "~N,~N");
Clazz_defineMethod(c$, "isOnSpectrum", 
function(xPixel, yPixel, index){
var xyCoords = null;
var isContinuous = true;
var isIntegral = (index < 0);
if (isIntegral) {
var ad = this.getDialog(JSV.common.Annotation.AType.Integration, -1);
if (ad == null) return false;
xyCoords = (ad.getData()).getXYCoords();
index = this.getFixedSelectedSpectrumIndex();
} else {
this.setScale(index);
var spec = this.spectra.get(index);
xyCoords = spec.xyCoords;
isContinuous = spec.isContinuous();
}var yOffset = index * Clazz_floatToInt(this.yPixels * (this.yStackOffsetPercent / 100));
var ix0 = this.viewData.getStartingPointIndex(index);
var ix1 = this.viewData.getEndingPointIndex(index);
if (isContinuous) {
for (var i = ix0; i < ix1; i++) {
var point1 = xyCoords[i];
var point2 = xyCoords[i + 1];
var x1 = this.toPixelX(point1.getXVal());
var x2 = this.toPixelX(point2.getXVal());
var y1 = (isIntegral ? this.toPixelYint(point1.getYVal()) : this.toPixelY(point1.getYVal()));
var y2 = (isIntegral ? this.toPixelYint(point2.getYVal()) : this.toPixelY(point2.getYVal()));
if (y1 == -2147483648 || y2 == -2147483648) continue;
y1 = this.fixY(y1) - yOffset;
y2 = this.fixY(y2) - yOffset;
if (JSV.common.GraphSet.isOnLine(xPixel, yPixel, x1, y1, x2, y2)) return true;
}
} else {
for (var i = ix0; i <= ix1; i++) {
var point = xyCoords[i];
var y2 = this.toPixelY(point.getYVal());
if (y2 == -2147483648) continue;
var x1 = this.toPixelX(point.getXVal());
var y1 = this.toPixelY(Math.max(this.getScale().minYOnScale, 0));
y1 = this.fixY(y1);
y2 = this.fixY(y2);
if (y1 == y2 && (y1 == this.yPixel0 || y1 == this.yPixel1)) continue;
if (JSV.common.GraphSet.isOnLine(xPixel, yPixel, x1, y1, x1, y2)) return true;
}
}return false;
}, "~N,~N,~N");
c$.distance = Clazz_defineMethod(c$, "distance", 
function(dx, dy){
return Math.sqrt(dx * dx + dy * dy);
}, "~N,~N");
c$.findCompatibleGraphSet = Clazz_defineMethod(c$, "findCompatibleGraphSet", 
function(graphSets, spec){
for (var i = 0; i < graphSets.size(); i++) if (JSV.common.Spectrum.areXScalesCompatible(spec, graphSets.get(i).getSpectrum(), false, false)) return graphSets.get(i);

return null;
}, "JU.Lst,JSV.common.Spectrum");
c$.isGoodEvent = Clazz_defineMethod(c$, "isGoodEvent", 
function(zOrP, p, asX){
return (p == null ? (Math.abs(zOrP.xPixel1 - zOrP.xPixel0) > 5 && Math.abs(zOrP.yPixel1 - zOrP.yPixel0) > 5) : asX ? Math.abs(zOrP.xPixel0 - p.xPixel0) > 5 : Math.abs(zOrP.yPixel0 - p.yPixel0) > 5);
}, "JSV.common.PlotWidget,JSV.common.PlotWidget,~B");
c$.isOnLine = Clazz_defineMethod(c$, "isOnLine", 
function(xPixel, yPixel, x1, y1, x2, y2){
var dx1 = Math.abs(x1 - xPixel);
if (dx1 < 2 && Math.abs(y1 - yPixel) < 2) return true;
var dx2 = x2 - xPixel;
if (Math.abs(dx2) < 2 && Math.abs(y2 - yPixel) < 2) return true;
var dy12 = y1 - y2;
if (Math.abs(dy12) > 2 && (y1 < yPixel) == (y2 < yPixel)) return false;
var dx12 = x1 - x2;
if (Math.abs(dx12) > 2 && (x1 < xPixel) == (x2 < xPixel)) return false;
return (JSV.common.GraphSet.distance(dx1, y1 - yPixel) + JSV.common.GraphSet.distance(dx2, yPixel - y2) < JSV.common.GraphSet.distance(dx12, dy12) + 2);
}, "~N,~N,~N,~N,~N,~N");
c$.setFractionalPositions = Clazz_defineMethod(c$, "setFractionalPositions", 
function(pd, graphSets, linkMode){
var n = graphSets.size();
var f = 0;
var n2d = 1;
var gs;
var y = 0;
pd.isLinked = (linkMode !== JSV.common.PanelData.LinkMode.NONE);
if (linkMode === JSV.common.PanelData.LinkMode.NONE) {
for (var i = 0; i < n; i++) {
gs = graphSets.get(i);
f += (gs.getSpectrumAt(0).is1D() ? 1 : n2d) * gs.nSplit;
}
f = 1 / f;
for (var i = 0; i < n; i++) {
gs = graphSets.get(i);
gs.isLinked = false;
var g = (gs.getSpectrumAt(0).is1D() ? f : n2d * f);
gs.fX0 = 0;
gs.fY0 = y;
gs.fracX = 1;
gs.fracY = g;
y += g * gs.nSplit;
}
} else {
var gs2d = null;
var i2d = -1;
if (n == 2 || n == 3) for (var i = 0; i < n; i++) {
gs = graphSets.get(i);
if (!gs.getSpectrum().is1D()) {
gs2d = gs;
if (i2d >= 0) i = -2;
i2d = i;
break;
}}
if (i2d == -2 || i2d == -1 && n != 2) {
JSV.common.GraphSet.setFractionalPositions(pd, graphSets, JSV.common.PanelData.LinkMode.NONE);
return;
}for (var i = 0; i < n; i++) {
gs = graphSets.get(i);
gs.isLinked = true;
var s1 = gs.getSpectrumAt(0);
var is1D = s1.is1D();
if (is1D) {
if (gs2d != null) {
var s2 = gs2d.getSpectrumAt(0);
if (JSV.common.Spectrum.areLinkableX(s1, s2)) gs.gs2dLinkedX = gs2d;
if (JSV.common.Spectrum.areLinkableY(s1, s2)) gs.gs2dLinkedY = gs2d;
}gs.fX0 = 0;
gs.fY0 = y;
gs.fracX = (gs2d == null ? 1 : 0.5);
gs.fracY = (n == 3 || gs2d == null ? 0.5 : 1);
y += 0.5;
} else {
gs.fX0 = 0.5;
gs.fY0 = 0;
gs.fracX = 0.5;
gs.fracY = 1;
}}
}}, "JSV.common.PanelData,JU.Lst,JSV.common.PanelData.LinkMode");
Clazz_defineMethod(c$, "addAnnotation", 
function(args, title){
if (args.size() == 0 || args.size() == 1 && args.get(0).equalsIgnoreCase("none")) {
this.annotations = null;
this.lastAnnotation = null;
return null;
}if (args.size() < 4 && this.lastAnnotation == null) this.lastAnnotation = this.getAnnotation((this.getScale().maxXOnScale + this.getScale().minXOnScale) / 2, (this.getScale().maxYOnScale + this.getScale().minYOnScale) / 2, title, false, false, 0, 0);
var annotation = this.getAnnotation(args, this.lastAnnotation);
if (annotation == null) return null;
if (this.annotations == null && args.size() == 1 && args.get(0).charAt(0) == '\"') {
var s = annotation.text;
this.getSpectrum().setTitle(s);
return s;
}this.lastAnnotation = annotation;
this.addAnnotation(annotation, false);
return null;
}, "JU.Lst,~S");
Clazz_defineMethod(c$, "addHighlight", 
function(x1, x2, spec, color){
if (spec == null) spec = this.getSpectrumAt(0);
var hl = Clazz_innerTypeInstance(JSV.common.GraphSet.Highlight, this, null, x1, x2, spec, (color == null ? this.pd.getColor(JSV.common.ScriptToken.HIGHLIGHTCOLOR) : color));
if (!this.highlights.contains(hl)) this.highlights.addLast(hl);
}, "~N,~N,JSV.common.Spectrum,javajs.api.GenericColor");
Clazz_defineMethod(c$, "addPeakHighlight", 
function(peakInfo){
for (var i = this.spectra.size(); --i >= 0; ) {
var spec = this.spectra.get(i);
this.removeAllHighlights(spec);
if (peakInfo == null || peakInfo.isClearAll() || spec !== peakInfo.spectrum) continue;
var peak = peakInfo.toString();
if (peak == null) {
continue;
}var xMin = JU.PT.getQuotedAttribute(peak, "xMin");
var xMax = JU.PT.getQuotedAttribute(peak, "xMax");
if (xMin == null || xMax == null) return;
var x1 = JU.PT.parseFloat(xMin);
var x2 = JU.PT.parseFloat(xMax);
if (Float.isNaN(x1) || Float.isNaN(x2)) return;
this.pd.addHighlight(this, x1, x2, spec, 200, 140, 140, 100);
spec.setSelectedPeak(peakInfo);
if (this.getScale().isInRangeX(x1) || this.getScale().isInRangeX(x2) || x1 < this.getScale().minX && this.getScale().maxX < x2) {
} else {
this.setZoomTo(0);
}}
}, "JSV.common.PeakInfo");
Clazz_defineMethod(c$, "advanceSubSpectrum", 
function(dir){
var spec0 = this.getSpectrumAt(0);
var i = spec0.advanceSubSpectrum(dir);
if (spec0.isForcedSubset()) this.viewData.setXRangeForSubSpectrum(this.getSpectrum().getXYCoords());
this.pd.notifySubSpectrumChange(i, this.getSpectrum());
}, "~N");
Clazz_defineMethod(c$, "checkSpectrumClickedEvent", 
function(xPixel, yPixel, clickCount){
if (this.nextClickForSetPeak != null) return false;
if (clickCount > 1 || this.pendingMeasurement != null || !this.isInPlotRegion(xPixel, yPixel)) return false;
if (clickCount == 0) {
var isOnIntegral = this.isOnSpectrum(xPixel, yPixel, -1);
this.pd.integralShiftMode = (isOnIntegral ? this.getShiftMode(xPixel, yPixel) : 0);
this.pd.isIntegralDrag = (this.pd.integralShiftMode == 0 && (isOnIntegral || this.haveIntegralDisplayed(-1) && this.findMeasurement(this.getIntegrationGraph(-1), xPixel, yPixel, 0) != null));
if (this.pd.integralShiftMode != 0) return false;
}if (!this.showAllStacked) return false;
this.stackSelected = false;
for (var i = 0; i < this.nSpectra; i++) {
if (!this.isOnSpectrum(xPixel, yPixel, i)) continue;
this.setSpectrumClicked(this.iPreviousSpectrumClicked = i);
return false;
}
if (this.isDialogOpen()) return false;
this.setSpectrumClicked(-1);
return this.stackSelected = false;
}, "~N,~N,~N");
Clazz_defineMethod(c$, "getShiftMode", 
function(xPixel, yPixel){
return (this.isStartEndIntegral(xPixel, false) ? yPixel : this.isStartEndIntegral(xPixel, true) ? -yPixel : 0);
}, "~N,~N");
Clazz_defineMethod(c$, "isDialogOpen", 
function(){
return (this.isVisible(this.getDialog(JSV.common.Annotation.AType.Integration, -1)) || this.isVisible(this.getDialog(JSV.common.Annotation.AType.Measurements, -1)) || this.isVisible(this.getDialog(JSV.common.Annotation.AType.PeakList, -1)));
});
Clazz_defineMethod(c$, "isStartEndIntegral", 
function(xPixel, isEnd){
return (isEnd ? this.xPixelPlot1 - xPixel < 20 : xPixel - this.xPixelPlot0 < 20);
}, "~N,~B");
Clazz_defineMethod(c$, "checkWidgetEvent", 
function(xPixel, yPixel, isPress){
if (!this.widgetsAreSet) return false;
this.widgetsAreSet = false;
var widget;
if (isPress) {
if (this.pd.clickCount == 2 && this.lastIntDragX != xPixel && !this.is2dClick(xPixel, yPixel)) {
if (this.pendingMeasurement == null) {
if (this.iSpectrumClicked == -1 && this.iPreviousSpectrumClicked >= 0) {
this.setSpectrumClicked(this.iPreviousSpectrumClicked);
}this.processPendingMeasurement(xPixel, yPixel, 2);
return true;
}} else if (!this.is2dClick(xPixel, yPixel)) {
if (this.isOnSpectrum(xPixel, yPixel, -1)) {
this.checkIntegral(this.toX(xPixel), NaN, false);
}if (this.lastIntDragX == xPixel) {
this.pd.isIntegralDrag = true;
if (!this.checkIntegral(this.toX(xPixel), this.toX(xPixel), false)) return false;
}}if (this.pendingMeasurement != null) return true;
widget = this.getPinSelected(xPixel, yPixel);
if (widget == null) {
yPixel = this.fixY(yPixel);
if (xPixel < this.xPixel1) {
if (this.pd.shiftPressed) this.setSpectrumClicked(this.iPreviousSpectrumClicked);
xPixel = this.fixX(xPixel);
if (this.zoomBox1D == null) this.newPins();
this.zoomBox1D.setX(this.toX(xPixel), xPixel);
this.zoomBox1D.yPixel0 = yPixel;
widget = this.zoomBox1D;
} else if (this.imageView != null && xPixel < this.imageView.xPixel1) {
this.zoomBox2D.setX(this.imageView.toX(xPixel), this.imageView.fixX(xPixel));
this.zoomBox2D.yPixel0 = yPixel;
widget = this.zoomBox2D;
}}this.pd.thisWidget = widget;
return false;
}this.nextClickForSetPeak = null;
widget = this.pd.thisWidget;
if (widget == null) return false;
if (widget === this.zoomBox1D) {
this.zoomBox1D.xPixel1 = this.fixX(xPixel);
this.zoomBox1D.yPixel1 = this.fixY(yPixel);
if (this.pd.isIntegralDrag && this.zoomBox1D.xPixel0 != this.zoomBox1D.xPixel1) {
if ((this.lastIntDragX <= xPixel) != (this.zoomBox1D.xPixel0 <= xPixel)) {
this.zoomBox1D.xPixel0 = this.lastIntDragX;
this.zoomBox1D.xPixel1 = xPixel;
this.zoomBox1D.setXVal(this.toX(this.zoomBox1D.xPixel0));
}this.lastIntDragX = xPixel;
this.checkIntegral(this.zoomBox1D.getXVal(), this.toX(this.zoomBox1D.xPixel1), false);
}return false;
}if (!this.zoomEnabled) return false;
if (widget === this.zoomBox2D) {
this.zoomBox2D.xPixel1 = this.imageView.fixX(xPixel);
this.zoomBox2D.yPixel1 = this.fixY(yPixel);
return true;
}if (widget === this.cur2Dy) {
yPixel = this.fixY(yPixel);
this.cur2Dy.yPixel0 = this.cur2Dy.yPixel1 = yPixel;
this.setCurrentSubSpectrum(this.imageView.toSubspectrumIndex(yPixel));
return true;
}if (widget === this.cur2Dx0 || widget === this.cur2Dx1) {
return false;
}if (widget === this.pin1Dx0 || widget === this.pin1Dx1 || widget === this.pin1Dx01) {
xPixel = this.fixX(xPixel);
widget.setX(this.toX0(xPixel), xPixel);
if (widget === this.pin1Dx01) {
var dp = xPixel - (Clazz_doubleToInt((this.pin1Dx0.xPixel0 + this.pin1Dx1.xPixel0) / 2));
var dp1 = (dp < 0 ? dp : dp);
var dp2 = (dp < 0 ? dp : dp);
xPixel = this.pin1Dx0.xPixel0 + dp2;
var xPixel1 = this.pin1Dx1.xPixel0 + dp1;
if (dp == 0 || this.fixX(xPixel) != xPixel || this.fixX(xPixel1) != xPixel1) return true;
this.pin1Dx0.setX(this.toX0(xPixel), xPixel);
this.pin1Dx1.setX(this.toX0(xPixel1), xPixel1);
}this.doZoom(this.pin1Dx0.getXVal(), 0, this.pin1Dx1.getXVal(), 0, true, false, false, true, false);
return true;
}if (widget === this.pin1Dy0 || widget === this.pin1Dy1 || widget === this.pin1Dy01) {
yPixel = this.fixY(yPixel);
widget.setY(this.toY0(yPixel), yPixel);
if (widget === this.pin1Dy01) {
var dp = yPixel - Clazz_doubleToInt((this.pin1Dy0.yPixel0 + this.pin1Dy1.yPixel0) / 2) + 1;
yPixel = this.pin1Dy0.yPixel0 + dp;
var yPixel1 = this.pin1Dy1.yPixel0 + dp;
var y0 = this.toY0(yPixel);
var y1 = this.toY0(yPixel1);
if (Math.min(y0, y1) == this.getScale().minY || Math.max(y0, y1) == this.getScale().maxY) return true;
this.pin1Dy0.setY(y0, yPixel);
this.pin1Dy1.setY(y1, yPixel1);
}this.doZoom(0, this.pin1Dy0.getYVal(), 0, this.pin1Dy1.getYVal(), this.imageView == null, this.imageView == null, false, false, false);
return true;
}if (widget === this.pin2Dx0 || widget === this.pin2Dx1 || widget === this.pin2Dx01) {
xPixel = this.imageView.fixX(xPixel);
widget.setX(this.imageView.toX0(xPixel), xPixel);
if (widget === this.pin2Dx01) {
var dp = xPixel - Clazz_doubleToInt((this.pin2Dx0.xPixel0 + this.pin2Dx1.xPixel0) / 2) + 1;
xPixel = this.pin2Dx0.xPixel0 + dp;
var xPixel1 = this.pin2Dx1.xPixel0 + dp;
if (this.imageView.fixX(xPixel) != xPixel || this.imageView.fixX(xPixel1) != xPixel1) return true;
this.pin2Dx0.setX(this.imageView.toX0(xPixel), xPixel);
this.pin2Dx1.setX(this.imageView.toX0(xPixel1), xPixel1);
}if (!JSV.common.GraphSet.isGoodEvent(this.pin2Dx0, this.pin2Dx1, true)) {
this.reset2D(true);
return true;
}this.imageView.setView0(this.pin2Dx0.xPixel0, this.pin2Dy0.yPixel0, this.pin2Dx1.xPixel0, this.pin2Dy1.yPixel0);
this.doZoom(this.pin2Dx0.getXVal(), this.getScale().minY, this.pin2Dx1.getXVal(), this.getScale().maxY, false, false, false, true, false);
return true;
}if (widget === this.pin2Dy0 || widget === this.pin2Dy1 || widget === this.pin2Dy01) {
yPixel = this.fixY(yPixel);
widget.setY(this.imageView.toSubspectrumIndex(yPixel), yPixel);
if (widget === this.pin2Dy01) {
var dp = yPixel - Clazz_doubleToInt((this.pin2Dy0.yPixel0 + this.pin2Dy1.yPixel0) / 2) + 1;
yPixel = this.pin2Dy0.yPixel0 + dp;
var yPixel1 = this.pin2Dy1.yPixel0 + dp;
if (yPixel != this.fixY(yPixel) || yPixel1 != this.fixY(yPixel1)) return true;
this.pin2Dy0.setY(this.imageView.toSubspectrumIndex(yPixel), yPixel);
this.pin2Dy1.setY(this.imageView.toSubspectrumIndex(yPixel1), yPixel1);
}if (!JSV.common.GraphSet.isGoodEvent(this.pin2Dy0, this.pin2Dy1, false)) {
this.reset2D(false);
return true;
}this.imageView.setView0(this.pin2Dx0.xPixel0, this.pin2Dy0.yPixel0, this.pin2Dx1.xPixel1, this.pin2Dy1.yPixel1);
return true;
}return false;
}, "~N,~N,~B");
Clazz_defineMethod(c$, "clearIntegrals", 
function(){
this.checkIntegral(NaN, 0, false);
});
Clazz_defineMethod(c$, "clearMeasurements", 
function(){
this.removeDialog(this.getFixedSelectedSpectrumIndex(), JSV.common.Annotation.AType.Measurements);
});
c$.createGraphSetsAndSetLinkMode = Clazz_defineMethod(c$, "createGraphSetsAndSetLinkMode", 
function(pd, jsvp, spectra, startIndex, endIndex, linkMode){
var graphSets =  new JU.Lst();
for (var i = 0; i < spectra.size(); i++) {
var spec = spectra.get(i);
var graphSet = (linkMode === JSV.common.PanelData.LinkMode.NONE ? JSV.common.GraphSet.findCompatibleGraphSet(graphSets, spec) : null);
if (graphSet == null) graphSets.addLast(graphSet =  new JSV.common.GraphSet(jsvp.getPanelData()));
graphSet.addSpec(spec);
}
JSV.common.GraphSet.setFractionalPositions(pd, graphSets, linkMode);
for (var i = graphSets.size(); --i >= 0; ) {
graphSets.get(i).initGraphSet(startIndex, endIndex);
JU.Logger.info("JSVGraphSet " + (i + 1) + " nSpectra = " + graphSets.get(i).nSpectra);
}
return graphSets;
}, "JSV.common.PanelData,JSV.api.JSVPanel,JU.Lst,~N,~N,JSV.common.PanelData.LinkMode");
Clazz_defineMethod(c$, "drawGraphSet", 
function(gMain, gFront, gBack, width, height, left, right, top, bottom, isResized, taintedAll, pointsOnly){
this.zoomEnabled = this.pd.getBoolean(JSV.common.ScriptToken.ENABLEZOOM);
this.isPrintingOrSaving = this.pd.isPrinting || this.pd.creatingImage;
this.height = (height - (this.pd.isPrinting ? 20 : this.pd.creatingImage ? 0 : 0)) * this.pd.scalingFactor;
this.width = width * this.pd.scalingFactor;
this.left = left * this.pd.scalingFactor;
this.right = right * this.pd.scalingFactor;
this.top = top * this.pd.scalingFactor;
this.bottom = bottom * this.pd.scalingFactor;
this.$haveSelectedSpectrum = false;
this.selectedSpectrumIntegrals = null;
this.selectedSpectrumMeasurements = null;
if (!this.isPrintingOrSaving && this.widgets != null) for (var j = 0; j < this.widgets.length; j++) if (this.widgets[j] != null) this.widgets[j].isVisible = false;

for (var iSplit = 0; iSplit < this.nSplit; iSplit++) {
this.drawAll(gMain, gFront, gBack, iSplit, isResized || this.nSplit > 1, taintedAll, pointsOnly);
}
this.setPositionForFrame(this.nSplit > 1 ? this.pd.currentSplitPoint : 0);
}, "~O,~O,~O,~N,~N,~N,~N,~N,~N,~B,~B,~B");
Clazz_defineMethod(c$, "escapeKeyPressed", 
function(isDEL){
if (this.zoomBox1D != null) this.zoomBox1D.xPixel0 = this.zoomBox1D.xPixel1 = 0;
if (this.zoomBox2D != null) this.zoomBox2D.xPixel0 = this.zoomBox2D.xPixel1 = 0;
if (!this.inPlotMove) return;
if (this.pendingMeasurement != null) {
this.pendingMeasurement = null;
return;
}this.pd.thisWidget = null;
this.pendingMeasurement = null;
if (this.selectedSpectrumMeasurements != null && this.selectedMeasurement != null) {
if (isDEL) this.selectedSpectrumMeasurements.clear(this.getScale().minXOnScale, this.getScale().maxXOnScale);
 else this.selectedSpectrumMeasurements.removeObj(this.selectedMeasurement);
this.selectedMeasurement = null;
this.updateDialog(JSV.common.Annotation.AType.Measurements, -1);
}if (this.selectedSpectrumIntegrals != null && this.selectedIntegral != null) {
if (isDEL) this.selectedSpectrumIntegrals.clear(this.getScale().minXOnScale, this.getScale().maxXOnScale);
 else this.selectedSpectrumIntegrals.removeObj(this.selectedIntegral);
this.selectedIntegral = null;
this.updateDialog(JSV.common.Annotation.AType.Integration, -1);
}}, "~B");
c$.findGraphSet = Clazz_defineMethod(c$, "findGraphSet", 
function(graphSets, xPixel, yPixel){
for (var i = graphSets.size(); --i >= 0; ) if (graphSets.get(i).hasPoint(xPixel, yPixel)) return graphSets.get(i);

return null;
}, "JU.Lst,~N,~N");
Clazz_defineMethod(c$, "findMatchingPeakInfo", 
function(pi){
var pi2 = null;
for (var i = 0; i < this.spectra.size(); i++) if ((pi2 = (this.spectra.get(i)).findMatchingPeakInfo(pi)) != null) break;

return pi2;
}, "JSV.common.PeakInfo");
Clazz_defineMethod(c$, "getCurrentSpectrumIndex", 
function(){
return (this.nSpectra == 1 ? 0 : this.iSpectrumSelected);
});
Clazz_defineMethod(c$, "getSelectedIntegral", 
function(){
return this.selectedIntegral;
});
Clazz_defineMethod(c$, "getShowAnnotation", 
function(type, i){
var id = this.getDialog(type, i);
return (id != null && id.getState());
}, "JSV.common.Annotation.AType,~N");
Clazz_defineMethod(c$, "hasFileLoaded", 
function(filePath){
for (var i = this.spectra.size(); --i >= 0; ) if (this.spectra.get(i).getFilePathForwardSlash().equals(filePath)) return true;

return false;
}, "~S");
Clazz_defineMethod(c$, "haveSelectedSpectrum", 
function(){
return this.$haveSelectedSpectrum;
});
Clazz_defineMethod(c$, "mouseClickedEvent", 
function(xPixel, yPixel, clickCount, isControlDown){
this.selectedMeasurement = null;
this.selectedIntegral = null;
var isNextClick = this.nextClickForSetPeak;
this.nextClickForSetPeak = null;
if (this.checkArrowUpDownClick(xPixel, yPixel) || this.checkArrowLeftRightClick(xPixel, yPixel)) return;
this.lastClickX = NaN;
this.lastPixelX = 2147483647;
if (this.isSplitWidget(xPixel, yPixel)) {
this.splitStack(this.nSplit == 1);
return;
}if (this.isCloserWidget(xPixel, yPixel)) {
this.pd.closeSpectrum();
return;
}var pw = this.getPinSelected(xPixel, yPixel);
if (pw != null) {
this.setWidgetValueByUser(pw);
return;
}var is2D = this.is2dClick(xPixel, yPixel);
if (clickCount == 2 && this.iSpectrumClicked == -1 && this.iPreviousSpectrumClicked >= 0) {
this.setSpectrumClicked(this.iPreviousSpectrumClicked);
}if (!is2D && isControlDown) {
this.setSpectrumClicked(this.iPreviousSpectrumClicked);
if (this.pendingMeasurement != null) {
this.processPendingMeasurement(xPixel, yPixel, -3);
} else if (this.iSpectrumClicked >= 0) {
this.processPendingMeasurement(xPixel, yPixel, 3);
}return;
}this.lastXMax = NaN;
if (clickCount == 2) {
if (is2D) {
if (this.sticky2Dcursor) {
this.addAnnotation(this.getAnnotation(this.imageView.toX(xPixel), this.imageView.toSubspectrumIndex(yPixel), this.pd.coordStr, false, true, 5, 5), true);
}this.sticky2Dcursor = true;
this.set2DCrossHairs(xPixel, yPixel);
return;
}if (this.isInTopBar(xPixel, yPixel)) {
this.doZoom(this.toX0(this.xPixel0), 0, this.toX0(this.xPixel1), 0, true, false, false, true, true);
} else if (this.isInRightBar(xPixel, yPixel)) {
this.doZoom(this.getScale().minXOnScale, this.viewList.get(0).getScale().minYOnScale, this.getScale().maxXOnScale, this.viewList.get(0).getScale().maxYOnScale, true, true, false, false, false);
} else if (this.isInTopBar2D(xPixel, yPixel)) {
this.reset2D(true);
} else if (this.isInRightBar2D(xPixel, yPixel)) {
this.reset2D(false);
} else if (this.pendingMeasurement != null) {
this.processPendingMeasurement(xPixel, yPixel, -2);
} else if (this.iSpectrumClicked >= 0) {
this.processPendingMeasurement(xPixel, yPixel, 2);
}return;
}if (is2D) {
if (this.annotations != null) {
var xy =  new JSV.common.Coordinate().set(this.imageView.toX(xPixel), this.imageView.toSubspectrumIndex(yPixel));
var a = this.findAnnotation2D(xy);
if (a != null && this.setAnnotationText(a)) {
return;
}}if (clickCount == 1) this.sticky2Dcursor = false;
this.set2DCrossHairs(xPixel, yPixel);
return;
}if (this.isInPlotRegion(xPixel, yPixel)) {
if (this.selectedSpectrumIntegrals != null && this.checkIntegralNormalizationClick(xPixel, yPixel)) return;
if (this.pendingMeasurement != null) {
this.processPendingMeasurement(xPixel, yPixel, 1);
return;
}this.setCoordClicked(xPixel, this.toX(xPixel), this.toY(yPixel));
this.updateDialog(JSV.common.Annotation.AType.PeakList, -1);
if (isNextClick != null) {
this.nextClickForSetPeak = isNextClick;
this.shiftSpectrum(4, NaN, NaN);
this.nextClickForSetPeak = null;
return;
}} else {
this.setCoordClicked(0, NaN, 0);
}this.pd.notifyPeakPickedListeners(null);
}, "~N,~N,~N,~B");
Clazz_defineMethod(c$, "is2dClick", 
function(xPixel, yPixel){
return (this.imageView != null && xPixel == this.imageView.fixX(xPixel) && yPixel == this.fixY(yPixel));
}, "~N,~N");
Clazz_defineMethod(c$, "updateDialog", 
function(type, iSpec){
var ad = this.getDialog(type, iSpec);
if (ad == null || !this.isVisible(ad)) return;
var xRange = this.toX(this.xPixel1) - this.toX(this.xPixel0);
var yOffset = (this.getSpectrum().isInverted() ? this.yPixel1 - this.pd.mouseY : this.pd.mouseY - this.yPixel0);
(ad).update(this.pd.coordClicked, xRange, yOffset);
}, "JSV.common.Annotation.AType,~N");
Clazz_defineMethod(c$, "isVisible", 
function(ad){
return (JSV.common.GraphSet.isDialog(ad) && ad.isVisible());
}, "JSV.api.AnnotationData");
Clazz_defineMethod(c$, "mousePressedEvent", 
function(xPixel, yPixel, clickCount){
this.checkWidgetEvent(xPixel, yPixel, true);
}, "~N,~N,~N");
Clazz_defineMethod(c$, "mouseReleasedEvent", 
function(xPixel, yPixel){
if (this.pendingMeasurement != null) {
if (Math.abs(this.toPixelX(this.pendingMeasurement.getXVal()) - xPixel) < 2) this.pendingMeasurement = null;
this.processPendingMeasurement(xPixel, yPixel, -2);
this.setToolTipForPixels(xPixel, yPixel);
return;
}if (this.pd.integralShiftMode != 0) {
this.pd.integralShiftMode = 0;
this.zoomBox1D.xPixel1 = this.zoomBox1D.xPixel0;
return;
}if (this.iSpectrumMovedTo >= 0) this.setScale(this.iSpectrumMovedTo);
var thisWidget = this.pd.thisWidget;
if (this.pd.isIntegralDrag) {
if (JSV.common.GraphSet.isGoodEvent(this.zoomBox1D, null, true)) {
this.checkIntegral(this.toX(this.zoomBox1D.xPixel0), this.toX(this.zoomBox1D.xPixel1), true);
}this.zoomBox1D.xPixel1 = this.zoomBox1D.xPixel0 = 0;
this.pendingIntegral = null;
this.pd.isIntegralDrag = false;
} else if (thisWidget === this.zoomBox2D) {
if (!JSV.common.GraphSet.isGoodEvent(this.zoomBox2D, null, true)) return;
this.imageView.setZoom(this.zoomBox2D.xPixel0, this.zoomBox2D.yPixel0, this.zoomBox2D.xPixel1, this.zoomBox2D.yPixel1);
this.zoomBox2D.xPixel1 = this.zoomBox2D.xPixel0;
this.doZoom(this.imageView.toX(this.imageView.xPixel0), this.getScale().minY, this.imageView.toX(this.imageView.xPixel0 + this.imageView.xPixels - 1), this.getScale().maxY, false, false, false, true, true);
} else if (thisWidget === this.zoomBox1D) {
if (!JSV.common.GraphSet.isGoodEvent(this.zoomBox1D, null, true)) return;
var x1 = this.zoomBox1D.xPixel1;
var doY = (this.pd.shiftPressed);
this.doZoom(this.toX(this.zoomBox1D.xPixel0), (doY ? this.toY(this.zoomBox1D.yPixel0) : 0), this.toX(x1), (doY ? this.toY(this.zoomBox1D.yPixel1) : 0), true, doY, true, true, true);
this.zoomBox1D.xPixel1 = this.zoomBox1D.xPixel0;
} else if (thisWidget === this.pin1Dx0 || thisWidget === this.pin1Dx1 || thisWidget === this.cur2Dx0 || thisWidget === this.cur2Dx1) {
this.addCurrentZoom();
}}, "~N,~N");
Clazz_defineMethod(c$, "mouseMovedEvent", 
function(xPixel, yPixel){
if (xPixel == 2147483647) {
this.iSpectrumMovedTo = -1;
this.piMouseOver = null;
return null;
}if (this.nSpectra > 1) {
var iFrame = this.getSplitPoint(yPixel);
this.setPositionForFrame(iFrame);
this.setSpectrumMovedTo(this.nSplit > 1 ? iFrame : this.iSpectrumSelected);
if (this.iSpectrumMovedTo >= 0) this.setScale(this.iSpectrumMovedTo);
} else {
this.iSpectrumMovedTo = this.iSpectrumSelected = 0;
}this.inPlotMove = this.isInPlotRegion(xPixel, yPixel);
this.setXPixelMovedTo(1.7976931348623157E308, 1.7976931348623157E308, (this.inPlotMove ? xPixel : -1), -1);
if (this.inPlotMove) {
this.xValueMovedTo = this.toX(this.xPixelMovedTo);
this.yValueMovedTo = this.getSpectrum().getYValueAt(this.xValueMovedTo);
}if (this.pd.integralShiftMode != 0) {
var ad = this.getDialog(JSV.common.Annotation.AType.Integration, -1);
var xy = (ad.getData()).getXYCoords();
var y = xy[this.pd.integralShiftMode > 0 ? xy.length - 1 : 0].getYVal();
(ad.getData()).shiftY(this.pd.integralShiftMode, this.toPixelYint(y) + yPixel - (this.pd.integralShiftMode > 0 ? this.yPixelPlot1 : this.yPixelPlot0), this.yPixel0, this.yPixels);
} else if (this.pd.isIntegralDrag) {
} else if (this.pendingMeasurement != null) {
this.processPendingMeasurement(xPixel, yPixel, 0);
this.setToolTipForPixels(xPixel, yPixel);
} else {
this.selectedMeasurement = (this.inPlotMove && this.selectedSpectrumMeasurements != null ? this.findMeasurement(this.selectedSpectrumMeasurements, xPixel, yPixel, 0) : null);
this.selectedIntegral = null;
if (this.inPlotMove && this.selectedSpectrumIntegrals != null && this.selectedMeasurement == null) {
this.selectedIntegral = this.findMeasurement(this.selectedSpectrumIntegrals, xPixel, yPixel, 0);
if (this.selectedIntegral == null) this.selectedIntegral = this.findMeasurement(this.selectedSpectrumIntegrals, xPixel, yPixel, -5);
}this.setToolTipForPixels(xPixel, yPixel);
if (this.imageView == null) {
this.piMouseOver = null;
var iSpec = (this.nSplit > 1 ? this.iSpectrumMovedTo : this.iSpectrumClicked);
if (!this.isDrawNoSpectra() && iSpec >= 0) {
var spec = this.spectra.get(iSpec);
if (spec.getPeakList() != null) {
this.coordTemp.setXVal(this.toX(xPixel));
this.coordTemp.setYVal(this.toY(yPixel));
this.piMouseOver = spec.findPeakByCoord(xPixel, this.coordTemp);
}}} else {
if (!this.pd.display1D && this.sticky2Dcursor) {
this.set2DCrossHairs(xPixel, yPixel);
}}}return this.piMouseOver;
}, "~N,~N");
Clazz_defineMethod(c$, "nextView", 
function(){
if (this.currentZoomIndex + 1 < this.viewList.size()) this.setZoomTo(this.currentZoomIndex + 1);
});
Clazz_defineMethod(c$, "previousView", 
function(){
if (this.currentZoomIndex > 0) this.setZoomTo(this.currentZoomIndex - 1);
});
Clazz_defineMethod(c$, "resetView", 
function(){
this.setZoomTo(0);
});
Clazz_defineMethod(c$, "removeAllHighlights", 
function(){
this.removeAllHighlights(null);
});
Clazz_defineMethod(c$, "removeHighlight", 
function(index){
this.highlights.removeItemAt(index);
}, "~N");
Clazz_defineMethod(c$, "removeHighlight", 
function(x1, x2){
for (var i = this.highlights.size(); --i >= 0; ) {
var h = this.highlights.get(i);
if (h.x1 == x1 && h.x2 == x2) this.highlights.removeItemAt(i);
}
}, "~N,~N");
Clazz_defineMethod(c$, "scaleYBy", 
function(factor){
if (this.imageView == null && !this.zoomEnabled) return;
this.viewData.scaleSpectrum(this.imageView == null ? this.iSpectrumSelected : -2, factor);
if (this.imageView != null) {
this.update2dImage(false);
this.resetPinsFromView();
}this.pd.refresh();
}, "~N");
Clazz_defineMethod(c$, "selectSpectrum", 
function(filePath, type, model){
var haveFound = false;
for (var i = this.spectra.size(); --i >= 0; ) if ((filePath == null || this.getSpectrumAt(i).getFilePathForwardSlash().equals(filePath)) && (this.getSpectrumAt(i).matchesPeakTypeModel(type, model))) {
this.setSpectrumSelected(i);
if (this.nSplit > 1) this.splitStack(true);
haveFound = true;
}
if (this.nSpectra > 1 && !haveFound && this.iSpectrumSelected >= 0 && !this.pd.isCurrentGraphSet(this)) this.setSpectrumSelected(-2147483648);
return haveFound;
}, "~S,~S,~S");
Clazz_defineMethod(c$, "selectPeakByFileIndex", 
function(filePath, index, atomKey){
var pi;
for (var i = this.spectra.size(); --i >= 0; ) if ((pi = this.getSpectrumAt(i).selectPeakByFileIndex(filePath, index, atomKey)) != null) return pi;

return null;
}, "~S,~S,~S");
Clazz_defineMethod(c$, "setSelected", 
function(i){
if (i < 0) {
this.bsSelected.clearAll();
this.setSpectrumClicked(-1);
return;
}this.bsSelected.set(i);
this.setSpectrumClicked((this.bsSelected.cardinality() == 1 ? i : -1));
if (this.nSplit > 1 && i >= 0) this.pd.currentSplitPoint = i;
}, "~N");
Clazz_defineMethod(c$, "setSelectedIntegral", 
function(val){
var spec = this.selectedIntegral.getSpectrum();
this.getIntegrationGraph(this.getSpectrumIndex(spec)).setSelectedIntegral(this.selectedIntegral, val);
}, "~N");
Clazz_defineMethod(c$, "setShowAnnotation", 
function(type, tfToggle){
var ad = this.getDialog(type, -1);
if (ad == null) {
if (tfToggle != null && tfToggle !== Boolean.TRUE) return;
if (type === JSV.common.Annotation.AType.PeakList || type === JSV.common.Annotation.AType.Integration || type === JSV.common.Annotation.AType.Measurements) this.pd.showDialog(type);
return;
}if (tfToggle == null) {
if (JSV.common.GraphSet.isDialog(ad)) (ad).setVisible(!(ad).isVisible());
 else this.pd.showDialog(type);
return;
}var isON = tfToggle.booleanValue();
if (isON) ad.setState(isON);
if (isON || JSV.common.GraphSet.isDialog(ad)) this.pd.showDialog(type);
if (!isON && JSV.common.GraphSet.isDialog(ad)) (ad).setVisible(false);
}, "JSV.common.Annotation.AType,Boolean");
Clazz_defineMethod(c$, "checkIntegralParams", 
function(parameters, value){
var spec = this.getSpectrum();
if (!spec.canIntegrate() || this.reversePlot) return false;
var iSpec = this.getFixedSelectedSpectrumIndex();
var ad = this.getDialog(JSV.common.Annotation.AType.Integration, -1);
if (value == null) return true;
switch (JSV.common.IntegralData.IntMode.getMode(value.toUpperCase())) {
case JSV.common.IntegralData.IntMode.NA:
return false;
case JSV.common.IntegralData.IntMode.CLEAR:
this.integrate(iSpec, null);
this.integrate(iSpec, parameters);
break;
case JSV.common.IntegralData.IntMode.ON:
if (ad == null) this.integrate(iSpec, parameters);
 else ad.setState(true);
break;
case JSV.common.IntegralData.IntMode.OFF:
if (ad != null) ad.setState(false);
break;
case JSV.common.IntegralData.IntMode.TOGGLE:
if (ad == null) this.integrate(iSpec, parameters);
 else ad.setState(!ad.getState());
break;
case JSV.common.IntegralData.IntMode.AUTO:
if (ad == null) {
this.checkIntegralParams(parameters, "ON");
ad = this.getDialog(JSV.common.Annotation.AType.Integration, -1);
}if (ad != null) (ad.getData()).autoIntegrate();
break;
case JSV.common.IntegralData.IntMode.LIST:
this.pd.showDialog(JSV.common.Annotation.AType.Integration);
break;
case JSV.common.IntegralData.IntMode.MARK:
if (ad == null) {
this.checkIntegralParams(parameters, "ON");
ad = this.getDialog(JSV.common.Annotation.AType.Integration, -1);
}if (ad != null) (ad.getData()).addMarks(value.substring(4).trim());
break;
case JSV.common.IntegralData.IntMode.MIN:
if (ad != null) {
try {
var val = Double.parseDouble(JSV.common.ScriptToken.getTokens(value).get(1));
(ad.getData()).setMinimumIntegral(val);
} catch (e) {
if (Clazz_exceptionOf(e, Exception)){
} else {
throw e;
}
}
}break;
case JSV.common.IntegralData.IntMode.UPDATE:
if (ad != null) (ad.getData()).update(parameters);
}
this.updateDialog(JSV.common.Annotation.AType.Integration, -1);
return true;
}, "JSV.common.Parameters,~S");
Clazz_defineMethod(c$, "setSpectrum", 
function(iSpec, fromSplit){
if (fromSplit && this.nSplit > 1) {
if (this.nSplit > 1) this.setSpectrumClicked(iSpec);
} else {
this.setSpectrumClicked(iSpec);
this.stackSelected = false;
this.showAllStacked = false;
}if (iSpec >= 0) this.dialogsToFront(this.getSpectrum());
}, "~N,~B");
Clazz_defineMethod(c$, "setSpectrumJDX", 
function(spec){
var pt = this.getFixedSelectedSpectrumIndex();
this.spectra.removeItemAt(pt);
this.spectra.add(pt, spec);
this.pendingMeasurement = null;
this.clearViews();
this.viewData.newSpectrum(this.spectra);
}, "JSV.common.Spectrum");
Clazz_defineMethod(c$, "setZoom", 
function(x1, y1, x2, y2){
this.setZoomTo(0);
if (x1 == 0 && x2 == 0 && y1 == 0 && y2 == 0) {
this.newPins();
this.imageView = null;
x1 = this.getScale().minXOnScale;
x2 = this.getScale().maxXOnScale;
} else {
this.doZoom(x1, y1, x2, y2, true, (y1 != y2), false, true, true);
}}, "~N,~N,~N,~N");
Clazz_defineMethod(c$, "shiftSpectrum", 
function(mode, xOld, xNew){
var spec = this.getSpectrum();
if (!spec.isNMR() || !spec.is1D()) return false;
var ok = null;
var dx = 0;
if (xNew == 1.7976931348623157E308) {
dx = -spec.addSpecShift(0);
} else {
switch (mode) {
case 3:
dx = xNew;
break;
case 1:
case 2:
this.nextClickMode = mode;
if (Double.isNaN(xOld)) {
ok = this.pd.getInput("Click on " + (mode == 1 ? "or beside a peak to set its chemical shift" : "the spectrum set the chemical shift at that point") + (xNew == -2147483648 ? "" : " to " + xNew) + ".", "Set Reference " + (mode == 1 ? "for Peak" : "at Point"), "OK");
this.nextClickForSetPeak = ("OK".equals(ok) ? Double.$valueOf(xNew) : null);
return false;
}this.nextClickForSetPeak = null;
case 4:
if (this.nextClickForSetPeak != null) {
xNew = this.nextClickForSetPeak.doubleValue();
this.nextClickForSetPeak = null;
}if (Double.isNaN(xOld)) xOld = this.lastClickX;
if (this.nextClickMode == 1) xOld = this.getNearestPeak(spec, xOld, this.toY(this.pd.mouseY));
if (Double.isNaN(xNew)) try {
var s = this.pd.getInput("New chemical shift (set blank to reset)", "Set Reference", JU.DF.formatDecimalDbl(xOld, this.getScale().precision[0])).trim();
if (s.length == 0) xNew = xOld - spec.addSpecShift(0);
 else xNew = Double.parseDouble(s);
} catch (e) {
if (Clazz_exceptionOf(e, Exception)){
return false;
} else {
throw e;
}
}
dx = xNew - xOld;
break;
}
}if (dx == 0) return false;
spec.addSpecShift(dx);
if (this.annotations != null) for (var i = this.annotations.size(); --i >= 0; ) if (this.annotations.get(i).spec === spec) this.annotations.get(i).addSpecShift(dx);

if (this.dialogs != null) for (var e, $e = this.dialogs.entrySet().iterator (); $e.hasNext()&& ((e = $e.next ()) || true);) if (e.getValue().getSpectrum() === spec) e.getValue().setSpecShift(dx);

this.getScale().addSpecShift(dx);
if (!Double.isNaN(this.lastClickX)) this.lastClickX += dx;
this.updateDialogs();
this.doZoom(0, this.getScale().minYOnScale, 0, this.getScale().maxYOnScale, true, true, false, true, false);
this.pd.setTaintedAll();
this.pd.repaint();
return true;
}, "~N,~N,~N");
Clazz_defineMethod(c$, "toPeak", 
function(istep){
istep *= (this.drawXAxisLeftToRight ? 1 : -1);
if (Double.isNaN(this.lastClickX)) this.lastClickX = this.lastPixelX = 0;
var spec = this.getSpectrum();
var coord = this.setCoordClicked(this.lastPixelX, this.lastClickX, 0);
var iPeak = spec.setNextPeak(coord, istep);
if (iPeak < 0) return;
var peak = spec.getPeakList().get(iPeak);
spec.setSelectedPeak(peak);
this.setCoordClicked(peak.getXPixel(), peak.getX(), 0);
this.pd.notifyPeakPickedListeners( new JSV.common.PeakPickEvent(this.jsvp, this.pd.coordClicked, peak));
}, "~N");
Clazz_defineMethod(c$, "scaleSelectedBy", 
function(f){
for (var i = this.bsSelected.nextSetBit(0); i >= 0; i = this.bsSelected.nextSetBit(i + 1)) this.viewData.scaleSpectrum(i, f);

}, "~N");
Clazz_overrideMethod(c$, "toString", 
function(){
return "gs: " + this.nSpectra + " " + this.spectra + " " + this.spectra.get(0).getFilePath();
});
Clazz_defineMethod(c$, "setXPointer", 
function(spec, x){
if (spec != null) this.setSpectrumClicked(this.getSpectrumIndex(spec));
this.xValueMovedTo = this.lastClickX = x;
this.lastPixelX = this.toPixelX(x);
this.setXPixelMovedTo(x, 1.7976931348623157E308, 0, 0);
this.yValueMovedTo = NaN;
}, "JSV.common.Spectrum,~N");
Clazz_defineMethod(c$, "setXPointer2", 
function(spec, x){
if (spec != null) this.setSpectrumClicked(this.getSpectrumIndex(spec));
this.setXPixelMovedTo(1.7976931348623157E308, x, 0, 0);
}, "JSV.common.Spectrum,~N");
Clazz_defineMethod(c$, "hasCurrentMeasurement", 
function(type){
return ((type === JSV.common.Annotation.AType.Integration ? this.selectedSpectrumIntegrals : this.selectedSpectrumMeasurements) != null);
}, "JSV.common.Annotation.AType");
Clazz_defineMethod(c$, "getDialog", 
function(type, iSpec){
if (iSpec == -1) iSpec = this.getCurrentSpectrumIndex();
return (this.dialogs == null || iSpec < 0 ? null : this.dialogs.get(type + "_" + iSpec));
}, "JSV.common.Annotation.AType,~N");
Clazz_defineMethod(c$, "removeDialog", 
function(iSpec, type){
if (this.dialogs != null && iSpec >= 0) this.dialogs.remove(type + "_" + iSpec);
}, "~N,JSV.common.Annotation.AType");
Clazz_defineMethod(c$, "addDialog", 
function(iSpec, type, dialog){
if (this.dialogs == null) this.dialogs =  new java.util.Hashtable();
var key = type + "_" + iSpec;
dialog.setGraphSetKey(key);
this.dialogs.put(key, dialog);
return dialog;
}, "~N,JSV.common.Annotation.AType,JSV.api.AnnotationData");
Clazz_defineMethod(c$, "removeDialog", 
function(dialog){
var key = dialog.getGraphSetKey();
this.dialogs.remove(key);
var data = dialog.getData();
if (data != null) this.dialogs.put(key, data);
}, "JSV.dialog.JSVDialog");
Clazz_defineMethod(c$, "getPeakListing", 
function(iSpec, p, forceNew){
if (iSpec < 0) iSpec = this.getCurrentSpectrumIndex();
if (iSpec < 0) return null;
var dialog = this.getDialog(JSV.common.Annotation.AType.PeakList, -1);
if (dialog == null) {
if (!forceNew) return null;
this.addDialog(iSpec, JSV.common.Annotation.AType.PeakList, dialog =  new JSV.common.PeakData(JSV.common.Annotation.AType.PeakList, this.getSpectrum()));
}(dialog.getData()).setPeakList(p, -2147483648, this.viewData.getScale());
if (JSV.common.GraphSet.isDialog(dialog)) (dialog).setFields();
return dialog.getData();
}, "~N,JSV.common.Parameters,~B");
Clazz_defineMethod(c$, "setPeakListing", 
function(tfToggle){
var dialog = this.getDialog(JSV.common.Annotation.AType.PeakList, -1);
var ad = (JSV.common.GraphSet.isDialog(dialog) ? dialog : null);
var isON = (tfToggle == null ? ad == null || !ad.isVisible() : tfToggle.booleanValue());
if (isON) {
this.pd.showDialog(JSV.common.Annotation.AType.PeakList);
} else if (JSV.common.GraphSet.isDialog(dialog)) {
(dialog).setVisible(false);
}}, "Boolean");
Clazz_defineMethod(c$, "haveIntegralDisplayed", 
function(i){
var ad = this.getDialog(JSV.common.Annotation.AType.Integration, i);
return (ad != null && ad.getState());
}, "~N");
Clazz_defineMethod(c$, "getIntegrationGraph", 
function(i){
var ad = this.getDialog(JSV.common.Annotation.AType.Integration, i);
return (ad == null ? null : ad.getData());
}, "~N");
Clazz_defineMethod(c$, "setIntegrationRatios", 
function(value){
var iSpec = this.getFixedSelectedSpectrumIndex();
if (this.aIntegrationRatios == null) this.aIntegrationRatios =  new Array(this.nSpectra);
this.aIntegrationRatios[iSpec] = JSV.common.IntegralData.getIntegrationRatiosFromString(this.getSpectrum(), value);
}, "~S");
Clazz_defineMethod(c$, "getIntegrationRatios", 
function(i){
return (this.aIntegrationRatios == null ? null : this.aIntegrationRatios[i]);
}, "~N");
Clazz_defineMethod(c$, "integrate", 
function(iSpec, parameters){
var spec = this.getSpectrumAt(iSpec);
if (parameters == null || !spec.canIntegrate()) {
this.removeDialog(iSpec, JSV.common.Annotation.AType.Integration);
return false;
}this.addDialog(iSpec, JSV.common.Annotation.AType.Integration,  new JSV.common.IntegralData(spec, parameters));
return true;
}, "~N,JSV.common.Parameters");
Clazz_defineMethod(c$, "getIntegration", 
function(iSpec, p, forceNew){
if (iSpec < 0) iSpec = this.getCurrentSpectrumIndex();
if (iSpec < 0) return null;
var dialog = this.getDialog(JSV.common.Annotation.AType.Integration, -1);
if (dialog == null) {
if (!forceNew) return null;
dialog = this.addDialog(iSpec, JSV.common.Annotation.AType.Integration,  new JSV.common.IntegralData(this.getSpectrum(), p));
}return dialog.getData();
}, "~N,JSV.common.Parameters,~B");
Clazz_defineMethod(c$, "getMeasurementInfo", 
function(type, iSpec){
var md;
switch (type) {
case JSV.common.Annotation.AType.PeakList:
md = this.getPeakListing(iSpec, null, false);
break;
case JSV.common.Annotation.AType.Integration:
md = this.getIntegration(iSpec, null, false);
break;
default:
return null;
}
if (md == null) return null;
var info =  new java.util.Hashtable();
md.getInfo(info);
return info;
}, "JSV.common.Annotation.AType,~N");
Clazz_defineMethod(c$, "getInfo", 
function(key, iSpec){
var spectraInfo =  new java.util.Hashtable();
if ("".equals(key)) {
spectraInfo.put("KEYS", "viewInfo spectra");
} else if ("viewInfo".equalsIgnoreCase(key)) return this.getScale().getInfo(spectraInfo);
var specInfo =  new JU.Lst();
spectraInfo.put("spectra", specInfo);
for (var i = 0; i < this.nSpectra; i++) {
if (iSpec >= 0 && i != iSpec) continue;
var spec = this.spectra.get(i);
var info = spec.getInfo(key);
if (iSpec >= 0 && key != null && (info.size() == 2 || key.equalsIgnoreCase("id"))) {
if (info.size() == 2) info.remove("id");
return info;
}JSV.common.Parameters.putInfo(key, info, "type", spec.getDataType());
JSV.common.Parameters.putInfo(key, info, "titleLabel", spec.getTitleLabel());
JSV.common.Parameters.putInfo(key, info, "filePath", spec.getFilePath().$replace('\\', '/'));
JSV.common.Parameters.putInfo(key, info, "PeakList", (JSV.common.Parameters.isMatch(key, "PeakList") ? this.getMeasurementInfo(JSV.common.Annotation.AType.PeakList, i) : null));
JSV.common.Parameters.putInfo(key, info, "Integration", (JSV.common.Parameters.isMatch(key, "Integration") ? this.getMeasurementInfo(JSV.common.Annotation.AType.Integration, i) : null));
if (iSpec >= 0) return info;
specInfo.addLast(info);
}
return spectraInfo;
}, "~S,~N");
Clazz_defineMethod(c$, "getTitle", 
function(forPrinting){
return (this.nSpectra == 1 || this.iSpectrumSelected >= 0 && (!forPrinting || this.nSplit == 1) ? this.getSpectrum().getTitle() : null);
}, "~B");
Clazz_defineMethod(c$, "getCurrentView", 
function(){
this.setScale(this.getFixedSelectedSpectrumIndex());
return this.viewData.getScale();
});
Clazz_defineMethod(c$, "set2DXY", 
function(x, y, isLocked){
var p;
if (this.gs2dLinkedX != null) {
p = this.toPixelX(x);
if (p != this.fixX(p)) {
p = -2147483648;
x = 1.7976931348623157E308;
}this.cur1D2x1.setX(x, p);
}if (this.gs2dLinkedY != null) {
p = this.toPixelX(y);
if (p != this.fixX(p)) {
p = -2147483648;
y = 1.7976931348623157E308;
}this.cur1D2x2.setX(y, p);
}this.cur1D2Locked = isLocked;
}, "~N,~N,~B");
Clazz_defineMethod(c$, "dialogsToFront", 
function(spec){
if (this.dialogs == null) return;
if (spec == null) spec = this.getSpectrum();
for (var e, $e = this.dialogs.entrySet().iterator (); $e.hasNext()&& ((e = $e.next ()) || true);) {
var ad = e.getValue();
if (this.isVisible(ad)) {
if (spec == null) (ad).setVisible(true);
 else (ad).setFocus(ad.getSpectrum() === spec);
}}
}, "JSV.common.Spectrum");
Clazz_defineMethod(c$, "setPlotColors", 
function(oColors){
var colors = oColors;
if (colors.length > this.nSpectra) {
var tmpPlotColors =  new Array(this.nSpectra);
System.arraycopy(colors, 0, tmpPlotColors, 0, this.nSpectra);
colors = tmpPlotColors;
} else if (this.nSpectra > colors.length) {
var tmpPlotColors =  new Array(this.nSpectra);
var numAdditionColors = this.nSpectra - colors.length;
System.arraycopy(colors, 0, tmpPlotColors, 0, colors.length);
for (var i = 0, j = colors.length; i < numAdditionColors; i++, j++) tmpPlotColors[j] = this.generateRandomColor();

colors = tmpPlotColors;
}this.plotColors = colors;
}, "~O");
Clazz_defineMethod(c$, "disposeImage", 
function(){
{
if (this.image2D != null)
this.image2D.parentNode.removeChild(this.image2D);
}this.image2D = null;
this.jsvp = null;
this.pd = null;
this.highlights = null;
this.plotColors = null;
});
Clazz_defineMethod(c$, "generateRandomColor", 
function(){
while (true) {
var red = Clazz_doubleToInt(Math.random() * 255);
var green = Clazz_doubleToInt(Math.random() * 255);
var blue = Clazz_doubleToInt(Math.random() * 255);
var randomColor = this.g2d.getColor3(red, green, blue);
if (randomColor.getRGB() != 0) return randomColor;
}
});
Clazz_defineMethod(c$, "setPlotColor0", 
function(oColor){
this.plotColors[0] = oColor;
}, "~O");
Clazz_defineMethod(c$, "getPlotColor", 
function(index){
if (index >= this.plotColors.length) return null;
return this.plotColors[index];
}, "~N");
Clazz_defineMethod(c$, "setColorFromToken", 
function(og, whatColor){
if (whatColor != null) this.g2d.setGraphicsColor(og, whatColor === JSV.common.ScriptToken.PLOTCOLOR ? this.plotColors[0] : this.pd.getColor(whatColor));
}, "~O,JSV.common.ScriptToken");
Clazz_defineMethod(c$, "setPlotColor", 
function(og, i){
var c;
switch (i) {
case -3:
c = JSV.common.GraphSet.veryLightGrey;
break;
case -2:
c = this.pd.BLACK;
break;
case -1:
c = this.pd.getColor(JSV.common.ScriptToken.INTEGRALPLOTCOLOR);
break;
default:
c = this.plotColors[i];
break;
}
this.g2d.setGraphicsColor(og, c);
}, "~O,~N");
Clazz_defineMethod(c$, "draw2DImage", 
function(){
if (this.imageView != null) this.g2d.drawGrayScaleImage(this.gMain, this.image2D, this.imageView.xPixel0, this.imageView.yPixel0, this.imageView.xPixel0 + this.imageView.xPixels - 1, this.imageView.yPixel0 + this.imageView.yPixels - 1, this.imageView.xView1, this.imageView.yView1, this.imageView.xView2, this.imageView.yView2);
});
Clazz_defineMethod(c$, "get2DImage", 
function(spec0){
this.imageView =  new JSV.common.ImageView();
this.imageView.set(this.viewList.get(0).getScale());
if (!this.update2dImage(true)) return false;
this.imageView.resetZoom();
this.sticky2Dcursor = true;
return true;
}, "JSV.common.Spectrum");
Clazz_defineMethod(c$, "update2dImage", 
function(isCreation){
this.imageView.set(this.viewData.getScale());
var spec = this.getSpectrumAt(0);
var buffer = this.imageView.get2dBuffer(spec, !isCreation);
if (buffer == null) {
this.image2D = null;
this.imageView = null;
return false;
}if (isCreation) {
buffer = this.imageView.adjustView(spec, this.viewData);
this.imageView.resetView();
}this.image2D = this.g2d.newGrayScaleImage(this.gMain, this.image2D, this.imageView.imageWidth, this.imageView.imageHeight, buffer);
this.setImageWindow();
return true;
}, "~B");
Clazz_defineMethod(c$, "getAnnotation", 
function(x, y, text, isPixels, is2d, offsetX, offsetY){
return  new JSV.common.ColoredAnnotation().setCA(x, y, this.getSpectrum(), text, this.pd.BLACK, isPixels, is2d, offsetX, offsetY);
}, "~N,~N,~S,~B,~B,~N,~N");
Clazz_defineMethod(c$, "getAnnotation", 
function(args, lastAnnotation){
return JSV.common.Annotation.getColoredAnnotation(this.g2d, this.getSpectrum(), args, lastAnnotation);
}, "JU.Lst,JSV.common.Annotation");
Clazz_defineMethod(c$, "fillBox", 
function(g, x0, y0, x1, y1, whatColor){
this.setColorFromToken(g, whatColor);
this.g2d.fillRect(g, Math.min(x0, x1), Math.min(y0, y1), Math.abs(x0 - x1), Math.abs(y0 - y1));
}, "~O,~N,~N,~N,~N,JSV.common.ScriptToken");
Clazz_defineMethod(c$, "drawBox", 
function(g, x0, y0, x1, y1, whatColor){
this.setColorFromToken(g, whatColor);
this.g2d.drawRect(g, Math.min(x0, x1), Math.min(y0, y1), Math.abs(x0 - x1) - 1, Math.abs(y0 - y1) - 1);
}, "~O,~N,~N,~N,~N,JSV.common.ScriptToken");
Clazz_defineMethod(c$, "drawHandle", 
function(g, x, y, size, outlineOnly){
if (outlineOnly) this.g2d.drawRect(g, x - size, y - size, size * 2, size * 2);
 else this.g2d.fillRect(g, x - size, y - size, size * 2 + 1, size * 2 + 1);
}, "~O,~N,~N,~N,~B");
Clazz_defineMethod(c$, "setCurrentBoxColor", 
function(g){
this.g2d.setGraphicsColor(g, this.pd.BLACK);
}, "~O");
Clazz_defineMethod(c$, "fillArrow", 
function(g, type, x, y, doFill){
var f = 1;
switch (type) {
case 1:
case 3:
f = -1;
break;
}
var axPoints =  Clazz_newIntArray(-1, [x - 5, x - 5, x + 5, x + 5, x + 8, x, x - 8]);
var ayPoints =  Clazz_newIntArray(-1, [y + 5 * f, y - f, y - f, y + 5 * f, y + 5 * f, y + 10 * f, y + 5 * f]);
switch (type) {
case 1:
case 2:
if (doFill) this.g2d.fillPolygon(g, ayPoints, axPoints, 7);
 else this.g2d.drawPolygon(g, ayPoints, axPoints, 7);
break;
case 3:
case 4:
if (doFill) this.g2d.fillPolygon(g, axPoints, ayPoints, 7);
 else this.g2d.drawPolygon(g, axPoints, ayPoints, 7);
}
}, "~O,~N,~N,~N,~B");
Clazz_defineMethod(c$, "fillCircle", 
function(g, x, y, doFill){
if (doFill) this.g2d.fillCircle(g, x - 4, y - 4, 8);
 else this.g2d.drawCircle(g, x - 4, y - 4, 8);
}, "~O,~N,~N,~B");
Clazz_defineMethod(c$, "setAnnotationColor", 
function(g, note, whatColor){
if (whatColor != null) {
this.setColorFromToken(g, whatColor);
return;
}var color = null;
if (Clazz_instanceOf(note,"JSV.common.ColoredAnnotation")) color = (note).getColor();
if (color == null) color = this.pd.BLACK;
this.g2d.setGraphicsColor(g, color);
}, "~O,JSV.common.Annotation,JSV.common.ScriptToken");
Clazz_defineMethod(c$, "setSolutionColor", 
function(vi, isNone, asFitted){
for (var i = 0; i < this.nSpectra; i++) {
var spec = this.spectra.get(i);
var color = (isNone || !spec.canShowSolutionColor() ? -1 : vi.getColour(spec, asFitted));
spec.setFillColor(color == -1 ? null : this.pd.vwr.parameters.getColor1(color));
}
}, "JSV.api.VisibleInterface,~B,~B");
Clazz_defineMethod(c$, "setIRMode", 
function(mode, type){
for (var i = 0; i < this.nSpectra; i++) {
var spec = this.spectra.get(i);
if (!spec.dataType.equals(type)) continue;
var spec2 = JSV.common.Spectrum.taConvert(spec, mode);
if (spec2 !== spec) this.pd.setSpecForIRMode(spec2);
}
}, "JSV.common.Spectrum.IRMode,~S");
Clazz_defineMethod(c$, "getSpectrumCount", 
function(){
return 0;
});
Clazz_defineMethod(c$, "invertYAxis", 
function(){
this.viewList.get(0).init(null, 0, 0, this.getSpectrum().invertYAxis().isContinuous());
this.resetViewCompletely();
});
c$.isDialog = Clazz_defineMethod(c$, "isDialog", 
function(ad){
return (ad != null && ad.isDialog());
}, "JSV.api.AnnotationData");
c$.$GraphSet$Highlight$ = function(){
/*if4*/;(function(){
var c$ = Clazz_decorateAsClass(function(){
Clazz_prepareCallback(this, arguments);
this.x1 = 0;
this.x2 = 0;
this.color = null;
this.spectrum = null;
Clazz_instantialize(this, arguments);}, JSV.common.GraphSet, "Highlight", null);
Clazz_makeConstructor(c$, 
function(x1, x2, spec, color){
this.x1 = x1;
this.x2 = x2;
this.color = color;
this.spectrum = spec;
}, "~N,~N,JSV.common.Spectrum,javajs.api.GenericColor");
Clazz_overrideMethod(c$, "toString", 
function(){
return "highlight " + this.x1 + " " + this.x2 + " " + this.spectrum;
});
Clazz_overrideMethod(c$, "equals", 
function(obj){
if (!(Clazz_instanceOf(obj,"JSV.common.GraphSet.Highlight"))) return false;
var hl = obj;
return ((hl.x1 == this.x1) && (hl.x2 == this.x2));
}, "~O");
Clazz_overrideMethod(c$, "hashCode", 
function(){
return Clazz_doubleToInt(this.x1 * 1000 + this.x2 * 1000000);
});
/*eoif4*/})();
};
c$.RT2 = Math.sqrt(2.0);
c$.veryLightGrey = null;
});
;//5.0.1-v7 Mon Aug 17 10:07:10 MDT 2026
Clazz_declarePackage("JSV.common");
Clazz_load(["JSV.common.XYScaleConverter"], "JSV.common.ImageView", ["JSV.common.Coordinate", "$.ScaleData"], function(){
var c$ = Clazz_decorateAsClass(function(){
this.buf2d = null;
this.grayFactorLast = 0;
this.averageGray = 0;
this.xPixel0 = 0;
this.yPixel0 = 0;
this.xPixel1 = 0;
this.yPixel1 = 0;
this.imageWidth = 0;
this.imageHeight = 0;
this.xPixels = 0;
this.yPixels = 0;
this.xPixelZoom1 = 0;
this.yPixelZoom1 = 0;
this.xPixelZoom2 = 0;
this.yPixelZoom2 = 0;
this.xView1 = 0;
this.yView1 = 0;
this.xView2 = 0;
this.yView2 = 0;
this.minX = NaN;
this.maxX = 0;
this.minY = 0;
this.maxY = 0;
this.minZ = 0;
this.maxZ = 0;
this.scaleData = null;
Clazz_instantialize(this, arguments);}, JSV.common, "ImageView", null, JSV.common.XYScaleConverter);
Clazz_defineMethod(c$, "set", 
function(view){
if (Double.isNaN(this.minX)) {
this.minX = view.minX;
this.maxX = view.maxX;
}this.minZ = view.minY;
this.maxZ = view.maxY;
this.scaleData =  new JSV.common.ScaleData();
}, "JSV.common.ScaleData");
Clazz_defineMethod(c$, "setZoom", 
function(xPixel1, yPixel1, xPixel2, yPixel2){
this.xPixelZoom1 = Math.min(xPixel1, xPixel2);
this.yPixelZoom1 = Math.min(yPixel1, yPixel2);
this.xPixelZoom2 = Math.max(xPixel1, xPixel2);
this.yPixelZoom2 = Math.max(yPixel1, yPixel2);
this.setView();
}, "~N,~N,~N,~N");
Clazz_defineMethod(c$, "setXY0", 
function(spec, xPixel, yPixel){
this.xPixel0 = xPixel;
this.yPixel0 = yPixel;
this.xPixel1 = this.xPixel0 + this.xPixels - 1;
this.yPixel1 = this.yPixel0 + this.yPixels - 1;
this.setMinMaxY(spec);
}, "JSV.common.Spectrum,~N,~N");
Clazz_defineMethod(c$, "setPixelWidthHeight", 
function(xPixels, yPixels){
this.xPixels = xPixels;
this.yPixels = yPixels;
}, "~N,~N");
Clazz_defineMethod(c$, "resetView", 
function(){
this.xView1 = 0;
this.yView1 = 0;
this.xView2 = this.imageWidth - 1;
this.yView2 = this.imageHeight - 1;
});
Clazz_defineMethod(c$, "setView", 
function(){
if (this.xPixelZoom1 == 0) this.resetZoom();
var x1 = this.toImageX(this.xPixelZoom1);
var y1 = this.toImageY(this.yPixelZoom1);
var x2 = this.toImageX(this.xPixelZoom2);
var y2 = this.toImageY(this.yPixelZoom2);
this.xView1 = Math.min(x1, x2);
this.yView1 = Math.min(y1, y2);
this.xView2 = Math.max(x1, x2);
this.yView2 = Math.max(y1, y2);
this.setScaleData();
this.resetZoom();
});
Clazz_defineMethod(c$, "resetZoom", 
function(){
this.xPixelZoom1 = this.xPixel0;
this.yPixelZoom1 = this.yPixel0;
this.xPixelZoom2 = this.xPixel1;
this.yPixelZoom2 = this.yPixel1;
});
Clazz_defineMethod(c$, "toImageX", 
function(xPixel){
return this.xView1 + Clazz_doubleToInt(Math.floor((xPixel - this.xPixel0) / (this.xPixels - 1.0) * (this.xView2 - this.xView1)));
}, "~N");
Clazz_defineMethod(c$, "toImageY", 
function(yPixel){
return this.yView1 + Clazz_doubleToInt(Math.floor((yPixel - this.yPixel0) / (this.yPixels - 1.0) * (this.yView2 - this.yView1)));
}, "~N");
Clazz_defineMethod(c$, "toImageX0", 
function(xPixel){
return JSV.common.Coordinate.intoRange(Clazz_doubleToInt((1.0 * xPixel - this.xPixel0) / (this.xPixels - 1) * (this.imageWidth - 1)), 0, this.imageWidth - 1);
}, "~N");
Clazz_defineMethod(c$, "toImageY0", 
function(yPixel){
return JSV.common.Coordinate.intoRange(Clazz_doubleToInt((1.0 * yPixel - this.yPixel0) / (this.yPixels - 1) * (this.imageHeight - 1)), 0, this.imageHeight - 1);
}, "~N");
Clazz_defineMethod(c$, "isXWithinRange", 
function(xPixel){
return (xPixel >= this.xPixel0 - 5 && xPixel < this.xPixel0 + this.xPixels + 5);
}, "~N");
Clazz_defineMethod(c$, "toSubspectrumIndex", 
function(yPixel){
return JSV.common.Coordinate.intoRange(this.imageHeight - 1 - this.toImageY(yPixel), 0, this.imageHeight - 1);
}, "~N");
Clazz_defineMethod(c$, "toX0", 
function(xPixel){
return this.maxX + (this.minX - this.maxX) * (this.fixX(xPixel) - this.xPixel0) / (this.xPixels - 1);
}, "~N");
Clazz_defineMethod(c$, "toPixelX0", 
function(x){
return this.xPixel1 - Clazz_doubleToInt((x - this.minX) / (this.maxX - this.minX) * (this.xPixels - 1));
}, "~N");
Clazz_defineMethod(c$, "toPixelY0", 
function(ysub){
return this.yPixel1 - Clazz_doubleToInt(ysub / (this.imageHeight - 1) * (this.yPixels - 1));
}, "~N");
Clazz_defineMethod(c$, "subIndexToPixelY", 
function(subIndex){
var f = 1.0 * (this.imageHeight - 1 - subIndex - this.yView1) / (this.yView2 - this.yView1);
var y = this.yPixel0 + Clazz_doubleToInt(f * (this.yPixels - 1));
return y;
}, "~N");
Clazz_defineMethod(c$, "fixSubIndex", 
function(subIndex){
return JSV.common.Coordinate.intoRange(subIndex, this.imageHeight - 1 - this.yView2, this.imageHeight - 1 - this.yView1);
}, "~N");
Clazz_defineMethod(c$, "setView0", 
function(xp1, yp1, xp2, yp2){
var x1 = this.toImageX0(xp1);
var y1 = this.toImageY0(yp1);
var x2 = this.toImageX0(xp2);
var y2 = this.toImageY0(yp2);
this.xView1 = Math.min(x1, x2);
this.yView1 = Math.min(y1, y2);
this.xView2 = Math.max(x1, x2);
this.yView2 = Math.max(y1, y2);
this.resetZoom();
}, "~N,~N,~N,~N");
Clazz_defineMethod(c$, "get2dBuffer", 
function(spec, forceNew){
var subSpectra = spec.getSubSpectra();
if (subSpectra == null || !subSpectra.get(0).isContinuous()) return null;
var xyCoords = spec.getXYCoords();
var nSpec = subSpectra.size();
this.imageWidth = xyCoords.length;
this.imageHeight = nSpec;
var grayFactor = 255 / (this.maxZ - this.minZ);
if (!forceNew && this.buf2d != null && grayFactor == this.grayFactorLast) return this.buf2d;
this.grayFactorLast = grayFactor;
var pt = this.imageWidth * this.imageHeight;
var buf = (this.buf2d == null || this.buf2d.length != pt ?  Clazz_newIntArray (pt, 0) : this.buf2d);
var totalGray = 0;
for (var i = 0; i < nSpec; i++) {
var points = subSpectra.get(i).xyCoords;
if (points.length != xyCoords.length) return null;
for (var j = 0; j < xyCoords.length; j++) {
var y = points[j].getYVal();
var gray = 255 - JSV.common.Coordinate.intoRange(Clazz_doubleToInt((y - this.minZ) * grayFactor), 0, 255);
buf[--pt] = gray;
totalGray += gray;
}
}
this.averageGray = (1 - totalGray / (this.imageWidth * this.imageHeight) / 255);
System.out.println("Average gray = " + this.averageGray);
return (this.buf2d = buf);
}, "JSV.common.Spectrum,~B");
Clazz_defineMethod(c$, "adjustView", 
function(spec, view){
var i = 0;
var isLow = false;
while (((isLow = (this.averageGray < 0.05)) || this.averageGray > 0.3) && i++ < 10) {
view.scaleSpectrum(-2, isLow ? 2 : 0.5);
this.set(view.getScale());
this.get2dBuffer(spec, false);
}
return this.buf2d;
}, "JSV.common.Spectrum,JSV.common.ViewData");
Clazz_defineMethod(c$, "getBuffer", 
function(){
return this.buf2d;
});
Clazz_defineMethod(c$, "setMinMaxY", 
function(spec){
var subSpectra = spec.getSubSpectra();
var spec0 = subSpectra.get(0);
this.maxY = spec0.getY2D();
this.minY = subSpectra.get(subSpectra.size() - 1).getY2D();
if (spec0.y2DUnits.equalsIgnoreCase("Hz")) {
this.maxY /= spec0.freq2dY;
this.minY /= spec0.freq2dY;
}this.setScaleData();
}, "JSV.common.Spectrum");
Clazz_defineMethod(c$, "setScaleData", 
function(){
this.scaleData.minY = this.minY;
this.scaleData.maxY = this.maxY;
this.scaleData.setYScale(this.toY(this.yPixel0), this.toY(this.yPixel1), false, false);
});
Clazz_overrideMethod(c$, "fixX", 
function(xPixel){
return (xPixel < this.xPixel0 ? this.xPixel0 : xPixel > this.xPixel1 ? this.xPixel1 : xPixel);
}, "~N");
Clazz_overrideMethod(c$, "fixY", 
function(yPixel){
return JSV.common.Coordinate.intoRange(yPixel, this.yPixel0, this.yPixel1);
}, "~N");
Clazz_overrideMethod(c$, "getScale", 
function(){
return this.scaleData;
});
Clazz_overrideMethod(c$, "toX", 
function(xPixel){
return this.maxX + (this.minX - this.maxX) * this.toImageX(this.fixX(xPixel)) / (this.imageWidth - 1);
}, "~N");
Clazz_overrideMethod(c$, "toY", 
function(yPixel){
var isub = this.toSubspectrumIndex(yPixel);
return this.maxY + (this.minY - this.maxY) * isub / (this.imageHeight - 1);
}, "~N");
Clazz_overrideMethod(c$, "toPixelX", 
function(x){
var x0 = this.toX(this.xPixel0);
var x1 = this.toX(this.xPixel1);
return this.xPixel0 + Clazz_doubleToInt((x - x0) / (x1 - x0) * (this.xPixels - 1));
}, "~N");
Clazz_overrideMethod(c$, "toPixelY", 
function(y){
var f = (y - this.scaleData.minYOnScale) / (this.scaleData.maxYOnScale - this.scaleData.minYOnScale);
return Clazz_doubleToInt(this.yPixel0 + f * this.yPixels);
}, "~N");
Clazz_overrideMethod(c$, "getXPixels", 
function(){
return this.xPixels;
});
Clazz_overrideMethod(c$, "getYPixels", 
function(){
return this.yPixels;
});
Clazz_overrideMethod(c$, "getXPixel0", 
function(){
return this.xPixel0;
});
});
;//5.0.1-v7 Mon Aug 17 10:07:10 MDT 2026
Clazz_declarePackage("JSV.common");
Clazz_load(["JSV.common.Measurement"], "JSV.common.Integral", null, function(){
var c$ = Clazz_declareType(JSV.common, "Integral", JSV.common.Measurement);
Clazz_defineMethod(c$, "setInt", 
function(x1, y1, spec, value, x2, y2){
this.setA(x1, y1, spec, "", false, false, 0, 6);
this.setPt2(x2, y2);
this.setValue(value);
return this;
}, "~N,~N,JSV.common.Spectrum,~N,~N,~N");
});
;//5.0.1-v7 Mon Aug 17 10:07:10 MDT 2026
Clazz_declarePackage("JSV.common");
(function(){
var c$ = Clazz_declareType(JSV.common, "IntegralComparator", null, java.util.Comparator);
Clazz_overrideMethod(c$, "compare", 
function(m1, m2){
return (m1.getXVal() < m2.getXVal() ? -1 : m1.getXVal() > m2.getXVal() ? 1 : 0);
}, "JSV.common.Measurement,JSV.common.Measurement");
})();
;//5.0.1-v7 Mon Aug 17 10:07:10 MDT 2026
Clazz_declarePackage("JSV.common");
Clazz_load(["java.lang.Enum", "JSV.common.MeasurementData", "$.IntegralComparator"], "JSV.common.IntegralData", ["java.util.Collections", "$.StringTokenizer", "JU.AU", "$.BS", "$.DF", "$.Lst", "$.PT", "JSV.common.Annotation", "$.Coordinate", "$.Integral", "$.ScriptToken"], function(){
var c$ = Clazz_decorateAsClass(function(){
this.percentMinY = 0;
this.percentOffset = 0;
this.intRange = 0;
this.normalizationFactor = 1;
this.percentRange = 0;
this.offset = 0;
this.integralTotal = 0;
this.haveRegions = false;
this.xyCoords = null;
Clazz_instantialize(this, arguments);}, JSV.common, "IntegralData", JSV.common.MeasurementData);
Clazz_makeConstructor(c$, 
function(integralMinY, integralOffset, integralRange, spec){
Clazz_superConstructor(this, JSV.common.IntegralData, [JSV.common.Annotation.AType.Integration, spec]);
this.percentMinY = integralMinY;
this.percentOffset = integralOffset;
this.percentRange = integralRange;
this.calculateIntegral();
}, "~N,~N,~N,JSV.common.Spectrum");
Clazz_makeConstructor(c$, 
function(spec, p){
Clazz_superConstructor(this, JSV.common.IntegralData, [JSV.common.Annotation.AType.Integration, spec]);
if (p == null) {
this.autoIntegrate();
return;
}this.percentOffset = p.integralOffset;
this.percentRange = p.integralRange;
this.calculateIntegral();
}, "JSV.common.Spectrum,JSV.common.Parameters");
Clazz_defineMethod(c$, "getPercentMinimumY", 
function(){
return this.percentMinY;
});
Clazz_defineMethod(c$, "getPercentOffset", 
function(){
return this.percentOffset;
});
Clazz_defineMethod(c$, "getIntegralFactor", 
function(){
return this.intRange;
});
Clazz_defineMethod(c$, "update", 
function(parameters){
this.update(parameters.integralMinY, parameters.integralOffset, parameters.integralRange);
}, "JSV.common.Parameters");
Clazz_defineMethod(c$, "update", 
function(integralMinY, integralOffset, integralRange){
var percentRange0 = this.percentRange;
if (integralRange <= 0 || integralRange == this.percentRange && integralOffset == this.percentOffset) return;
this.percentOffset = integralOffset;
this.percentRange = integralRange;
this.checkRange();
var intRangeNew = integralRange / 100 / this.integralTotal;
var offsetNew = integralOffset / 100;
for (var i = 0; i < this.xyCoords.length; i++) {
var y = this.xyCoords[i].getYVal();
y = (y - this.offset) / this.intRange;
this.xyCoords[i].setYVal(y * intRangeNew + offsetNew);
}
if (this.normalizationFactor != 1) this.normalizationFactor *= percentRange0 / integralRange;
if (this.haveRegions) {
for (var i = this.size(); --i >= 0; ) {
var ir = this.get(i);
var y1 = this.getYValueAt(ir.getXVal());
var y2 = this.getYValueAt(ir.getXVal2());
ir.setYVal(y1);
ir.setYVal2(y2);
ir.setValue(Math.abs(y2 - y1) * 100 * this.normalizationFactor);
}
}this.intRange = intRangeNew;
this.offset = offsetNew;
}, "~N,~N,~N");
Clazz_defineMethod(c$, "getYValueAt", 
function(x){
return JSV.common.Coordinate.getYValueAt(this.xyCoords, x);
}, "~N");
Clazz_defineMethod(c$, "addIntegralRegion", 
function(x1, x2){
if (Double.isNaN(x1)) {
this.haveRegions = false;
this.clear();
return null;
}if (Double.isNaN(x2)) {
return this.splitIntegral(x1);
}if (x1 == x2) return null;
if (x1 < x2) {
this.clear(x1, x2);
return null;
}var y1 = this.getYValueAt(x1);
var y2 = this.getYValueAt(x2);
this.haveRegions = true;
var $in =  new JSV.common.Integral().setInt(x1, y1, this.spec, Math.abs(y2 - y1) * 100 * this.normalizationFactor, x2, y2);
this.clear(x1, x2);
this.addLast($in);
java.util.Collections.sort(this, JSV.common.IntegralData.c);
return $in;
}, "~N,~N");
Clazz_defineMethod(c$, "splitIntegral", 
function(x){
var i = this.find(x);
if (i < 0) return null;
var integral = this.removeItemAt(i);
var x0 = integral.getXVal();
var x2 = integral.getXVal2();
this.addIntegralRegion(x0, x);
return this.addIntegralRegion(x, x2);
}, "~N");
Clazz_overrideMethod(c$, "setSpecShift", 
function(dx){
JSV.common.Coordinate.shiftX(this.xyCoords, dx);
for (var i = this.size(); --i >= 1; ) {
this.get(i).addSpecShift(dx);
}
}, "~N");
Clazz_defineMethod(c$, "addMarks", 
function(ppms){
ppms = JU.PT.rep(" " + ppms, ",", " ");
ppms = JU.PT.rep(ppms, " -", " #");
ppms = JU.PT.rep(ppms, "--", "-#");
ppms = ppms.$replace('-', '^');
ppms = ppms.$replace('#', '-');
var tokens = JSV.common.ScriptToken.getTokens(ppms);
for (var i = 0; i < tokens.size(); i++) {
try {
var s = tokens.get(i);
var norm = 0;
var pt = s.indexOf('^');
if (pt < 0) continue;
var pt2 = s.indexOf(':');
if (pt2 > pt) {
norm = Double.$valueOf(s.substring(pt2 + 1).trim()).doubleValue();
s = s.substring(0, pt2).trim();
}var x2 = Double.$valueOf(s.substring(0, pt).trim()).doubleValue();
var x1 = Double.$valueOf(s.substring(pt + 1).trim()).doubleValue();
if (x1 == 0 && x2 == 0) this.clear();
if (x1 == x2) continue;
var m = this.addIntegralRegion(Math.max(x1, x2), Math.min(x1, x2));
if (m != null && norm > 0) this.setSelectedIntegral(m, norm);
} catch (e) {
if (Clazz_exceptionOf(e, Exception)){
continue;
} else {
throw e;
}
}
}
}, "~S");
Clazz_defineMethod(c$, "calculateIntegral", 
function(){
var specXyCoords = this.spec.getXYCoords();
this.xyCoords =  new Array(specXyCoords.length);
this.integralTotal = 0;
this.checkRange();
var minY = 1E100;
for (var i = 0; i < specXyCoords.length; i++) {
var y = specXyCoords[i].getYVal();
if (y < minY && y >= 0) minY = y;
}
var minI = 1E100;
var maxI = -1.0E100;
for (var i = 0; i < specXyCoords.length; i++) {
var y = specXyCoords[i].getYVal();
this.integralTotal += (y - minY);
if (this.integralTotal < minI) minI = this.integralTotal;
if (this.integralTotal > maxI) maxI = this.integralTotal;
}
this.integralTotal = maxI - minI;
this.intRange = (this.percentRange / 100) / this.integralTotal;
this.offset = (this.percentOffset / 100);
var integral = 0;
for (var i = specXyCoords.length; --i >= 0; ) {
var y = specXyCoords[i].getYVal();
integral += (y - minY);
this.xyCoords[i] =  new JSV.common.Coordinate().set(specXyCoords[i].getXVal(), integral * this.intRange + this.offset);
}
return this.xyCoords;
});
Clazz_defineMethod(c$, "checkRange", 
function(){
this.percentOffset = Math.max(5, this.percentOffset);
this.percentRange = Math.max(10, this.percentRange);
});
c$.getIntegrationRatiosFromString = Clazz_defineMethod(c$, "getIntegrationRatiosFromString", 
function(spec, key_values){
var ratios =  new JU.Lst();
var allParamTokens =  new java.util.StringTokenizer(key_values, ",");
while (allParamTokens.hasMoreTokens()) {
var token = allParamTokens.nextToken();
var eachParam =  new java.util.StringTokenizer(token, ":");
var ratio =  new JSV.common.Annotation().setA(Double.parseDouble(eachParam.nextToken()), 0.0, spec, eachParam.nextToken(), true, false, 0, 0);
ratios.addLast(ratio);
}
return ratios;
}, "JSV.common.Spectrum,~S");
Clazz_defineMethod(c$, "getXYCoords", 
function(){
return this.xyCoords;
});
Clazz_defineMethod(c$, "getPercentYValueAt", 
function(x){
return this.getYValueAt(x) * 100;
}, "~N");
Clazz_defineMethod(c$, "dispose", 
function(){
this.spec = null;
this.xyCoords = null;
});
Clazz_defineMethod(c$, "setSelectedIntegral", 
function(integral, val){
var val0 = integral.getValue();
var factor = (val <= 0 ? 1 / this.normalizationFactor : val / val0);
this.factorAllIntegrals(factor, val <= 0);
}, "JSV.common.Measurement,~N");
Clazz_defineMethod(c$, "factorAllIntegrals", 
function(factor, isReset){
for (var i = 0; i < this.size(); i++) {
var m = this.get(i);
m.setValue(factor * m.getValue());
}
this.normalizationFactor = (isReset ? 1 : this.normalizationFactor * factor);
}, "~N,~B");
Clazz_defineMethod(c$, "remove", 
function(i){
return this.removeItemAt(i);
}, "~N");
Clazz_defineMethod(c$, "getBitSet", 
function(){
var bs = JU.BS.newN(this.xyCoords.length);
if (this.size() == 0) {
bs.setBits(0, this.xyCoords.length);
return bs;
}for (var i = this.size(); --i >= 0; ) {
var m = this.get(i);
var x1 = JSV.common.Coordinate.getNearestIndexForX(this.xyCoords, m.getXVal());
var x2 = JSV.common.Coordinate.getNearestIndexForX(this.xyCoords, m.getXVal2());
bs.setBits(Math.min(x1, x2), Math.max(x1, x2));
}
return bs;
});
Clazz_overrideMethod(c$, "getMeasurementListArray", 
function(units){
var data =  new Array(this.size());
for (var pt = 0, i = this.size(); --i >= 0; ) data[pt++] =  Clazz_newArray(-1, ["" + pt, JU.DF.formatDecimalDbl(this.get(i).getXVal(), 2), JU.DF.formatDecimalDbl(this.get(i).getXVal2(), 2), this.get(i).text]);

return data;
}, "~S");
Clazz_overrideMethod(c$, "getMeasurementListArrayReal", 
function(units){
var data = JU.AU.newDouble2(this.size());
for (var pt = 0, i = this.size(); --i >= 0; pt++) data[pt] =  Clazz_newDoubleArray(-1, [this.get(i).getXVal(), this.get(i).getXVal2(), this.get(i).getValue()]);

return data;
}, "~S");
Clazz_overrideMethod(c$, "getDataHeader", 
function(){
return JSV.common.IntegralData.$HEADER;
});
Clazz_defineMethod(c$, "shiftY", 
function(yOld, yNew, yPixel0, yPixels){
var pt = Clazz_doubleToInt(100.0 * (yPixel0 + yPixels - yNew) / yPixels);
if (yOld < 0) pt -= this.percentOffset;
if (yOld < 0) {
this.update(0, this.percentOffset, pt);
} else {
this.update(0, pt, this.percentRange);
}}, "~N,~N,~N,~N");
Clazz_defineMethod(c$, "autoIntegrate", 
function(){
if (this.xyCoords == null) this.calculateIntegral();
if (this.xyCoords.length == 0) return;
this.clear();
var iStart = -1;
var cutoff = 0.0001;
var nCount = 0;
var nMin = 20;
var y0 = this.xyCoords[this.xyCoords.length - 1].getYVal();
for (var i = this.xyCoords.length - 1; --i >= 0; ) {
var y = this.xyCoords[i].getYVal();
nCount++;
if ((y - y0) < cutoff && iStart < 0) {
if (y < y0) {
y0 = y;
nCount = 0;
}continue;
}if (iStart < 0) {
iStart = i + Math.min(nCount, nMin);
y0 = y;
nCount = 0;
continue;
}if ((y - y0) < cutoff) {
if (nCount == 1) y0 = y;
if (nCount >= nMin) {
this.addIntegralRegion(this.xyCoords[iStart].getXVal(), this.xyCoords[i].getXVal());
iStart = -1;
y0 = y;
nCount = 0;
}} else {
nCount = 0;
y0 = y;
}}
var nH = this.spec.getHydrogenCount();
if (nH > 0) this.factorAllIntegrals(nH / this.percentRange, false);
});
Clazz_defineMethod(c$, "getInfo", 
function(info){
info.put("offset", Double.$valueOf(this.myParams.integralOffset));
info.put("range", Double.$valueOf(this.myParams.integralRange));
info.put("normalizationFactor", Double.$valueOf(this.normalizationFactor));
info.put("integralTotal", Double.$valueOf(this.integralTotal));
Clazz_superCall(this, JSV.common.IntegralData, "getInfo", [info]);
}, "java.util.Map");
Clazz_defineMethod(c$, "setMinimumIntegral", 
function(val){
for (var i = this.size(); --i >= 0; ) if (this.get(i).getValue() < val) this.removeItemAt(i);

}, "~N");
/*if2*/;(function(){
var c$ = Clazz_declareType(JSV.common.IntegralData, "IntMode", Enum);
c$.getMode = Clazz_defineMethod(c$, "getMode", 
function(value){
for (var mode, $mode = 0, $$mode = JSV.common.IntegralData.IntMode.values(); $mode < $$mode.length && ((mode = $$mode[$mode]) || true); $mode++) if (value.startsWith(mode.name())) return mode;

return JSV.common.IntegralData.IntMode.NA;
}, "~S");
Clazz_defineEnumConstant(c$, "OFF", 0, []);
Clazz_defineEnumConstant(c$, "ON", 1, []);
Clazz_defineEnumConstant(c$, "TOGGLE", 2, []);
Clazz_defineEnumConstant(c$, "AUTO", 3, []);
Clazz_defineEnumConstant(c$, "LIST", 4, []);
Clazz_defineEnumConstant(c$, "MARK", 5, []);
Clazz_defineEnumConstant(c$, "MIN", 6, []);
Clazz_defineEnumConstant(c$, "UPDATE", 7, []);
Clazz_defineEnumConstant(c$, "CLEAR", 8, []);
Clazz_defineEnumConstant(c$, "NA", 9, []);
/*eoif2*/})();
c$.c =  new JSV.common.IntegralComparator();
c$.$HEADER =  Clazz_newArray(-1, ["peak", "start/ppm", "end/ppm", "value"]);
});
;//5.0.1-v7 Mon Aug 17 10:07:10 MDT 2026
Clazz_declarePackage("JSV.common");
Clazz_load(["java.lang.Enum", "JSV.source.JDXDataObject", "JU.Lst"], "JSV.common.Spectrum", ["java.util.Hashtable", "JU.PT", "JSV.common.Coordinate", "$.Parameters", "$.PeakInfo", "JSV.source.JDXSourceStreamTokenizer", "JU.Logger"], function(){
var c$ = Clazz_decorateAsClass(function(){
this.id = "";
this.fillColor = null;
this.subSpectra = null;
this.peakList = null;
this.peakXLabel = null;
this.peakYLabel = null;
this.selectedPeak = null;
this.highlightedPeak = null;
this.convertedSpectrum = null;
this.specShift = 0;
this.userYFactor = 1;
this.currentSubSpectrumIndex = 0;
this.$isForcedSubset = false;
this.exportXAxisLeftToRight = false;
this.titleLabel = null;
Clazz_instantialize(this, arguments);}, JSV.common, "Spectrum", JSV.source.JDXDataObject);
Clazz_prepareFields (c$, function(){
this.peakList =  new JU.Lst();
});
Clazz_makeConstructor(c$, 
function(){
Clazz_superConstructor (this, JSV.common.Spectrum, []);
this.headerTable =  new JU.Lst();
this.xyCoords =  new Array(0);
this.parent = this;
});
Clazz_defineMethod(c$, "dispose", 
function(){
});
Clazz_defineMethod(c$, "isForcedSubset", 
function(){
return this.$isForcedSubset;
});
Clazz_defineMethod(c$, "setId", 
function(id){
this.id = id;
}, "~S");
Clazz_defineMethod(c$, "copy", 
function(){
var newSpectrum =  new JSV.common.Spectrum();
this.copyTo(newSpectrum);
newSpectrum.setPeakList(this.peakList, this.peakXLabel, null);
newSpectrum.fillColor = this.fillColor;
return newSpectrum;
});
Clazz_defineMethod(c$, "getXYCoords", 
function(){
return this.getCurrentSubSpectrum().xyCoords;
});
Clazz_defineMethod(c$, "getPeakList", 
function(){
return this.peakList;
});
Clazz_defineMethod(c$, "setPeakList", 
function(list, peakXLabel, peakYLabel){
this.peakList = list;
this.peakXLabel = peakXLabel;
this.peakYLabel = peakYLabel;
for (var i = list.size(); --i >= 0; ) this.peakList.get(i).spectrum = this;

if (JU.Logger.debugging) JU.Logger.info("Spectrum " + this.getTitle() + " peaks: " + list.size());
return list.size();
}, "JU.Lst,~S,~S");
Clazz_defineMethod(c$, "selectPeakByFileIndex", 
function(filePath, index, atomKey){
if (this.peakList != null && this.peakList.size() > 0 && (atomKey == null || this.sourceID.equals(index))) for (var i = 0; i < this.peakList.size(); i++) if (this.peakList.get(i).checkFileIndex(filePath, index, atomKey)) {
System.out.println("JSV.Spectrum selecting peak by FileIndex " + this + " " + this.peakList.get(i));
return (this.selectedPeak = this.peakList.get(i));
}
return null;
}, "~S,~S,~S");
Clazz_defineMethod(c$, "selectPeakByFilePathTypeModel", 
function(filePath, type, model){
if (this.peakList != null && this.peakList.size() > 0) for (var i = 0; i < this.peakList.size(); i++) if (this.peakList.get(i).checkFileTypeModel(filePath, type, model)) {
System.out.println("JSV.Spectrum selecting peak byFilePathTypeModel " + this + " " + this.peakList.get(i));
return (this.selectedPeak = this.peakList.get(i));
}
return null;
}, "~S,~S,~S");
Clazz_defineMethod(c$, "matchesPeakTypeModel", 
function(type, model){
if (type.equals("ID")) return (this.sourceID.equalsIgnoreCase(model));
if (this.peakList != null && this.peakList.size() > 0) for (var i = 0; i < this.peakList.size(); i++) if (this.peakList.get(i).checkTypeModel(type, model)) return true;

return false;
}, "~S,~S");
Clazz_defineMethod(c$, "setSelectedPeak", 
function(peak){
this.selectedPeak = peak;
}, "JSV.common.PeakInfo");
Clazz_defineMethod(c$, "setHighlightedPeak", 
function(peak){
this.highlightedPeak = peak;
}, "JSV.common.PeakInfo");
Clazz_defineMethod(c$, "getSelectedPeak", 
function(){
return this.selectedPeak;
});
Clazz_defineMethod(c$, "getModelPeakInfoForAutoSelectOnLoad", 
function(){
if (this.peakList != null) for (var i = 0; i < this.peakList.size(); i++) if (this.peakList.get(i).autoSelectOnLoad()) return this.peakList.get(i);

return null;
});
Clazz_defineMethod(c$, "getAssociatedPeakInfo", 
function(xPixel, coord){
this.selectedPeak = this.findPeakByCoord(xPixel, coord);
return (this.selectedPeak == null ? this.getBasePeakInfo() : this.selectedPeak);
}, "~N,JSV.common.Coordinate");
Clazz_defineMethod(c$, "findPeakByCoord", 
function(xPixel, coord){
if (coord != null && this.peakList != null && this.peakList.size() > 0) {
var xVal = coord.getXVal();
var iBest = -1;
var dBest = 1e100;
for (var i = 0; i < this.peakList.size(); i++) {
var d = this.peakList.get(i).checkRange(xPixel, xVal);
if (d < dBest) {
dBest = d;
iBest = i;
}}
if (iBest >= 0) return this.peakList.get(iBest);
}return null;
}, "~N,JSV.common.Coordinate");
Clazz_defineMethod(c$, "getPeakTitle", 
function(){
var s = null;
if (this.highlightedPeak != null) s = this.highlightedPeak.getTitle();
if ((s == null || s.length == 0) && this.selectedPeak != null) s = this.selectedPeak.getTitle();
if (s == null || s.length == 0) s = this.getTitleLabel();
return s;
});
Clazz_defineMethod(c$, "getTitleLabel", 
function(){
if (this.titleLabel != null) return this.titleLabel;
var type = (this.peakList == null || this.peakList.size() == 0 ? this.getQualifiedDataType() : this.peakList.get(0).getType());
if (type != null && type.startsWith("NMR")) {
if (this.nucleusY != null && !this.nucleusY.equals("?")) {
type = "2D" + type;
} else {
type = JSV.source.JDXDataObject.getNominalSpecFreq(this.nucleusX, this.getObservedFreq()) + " MHz " + this.nucleusX + " " + type;
}}return this.titleLabel = (type != null && type.length > 0 ? type + " " : "") + this.getTitle();
});
Clazz_defineMethod(c$, "setNextPeak", 
function(coord, istep){
if (this.peakList == null || this.peakList.size() == 0) return -1;
var x0 = coord.getXVal() + istep * 0.000001;
var ipt1 = -1;
var ipt2 = -1;
var dmin1 = 1.7976931348623157E308 * istep;
var dmin2 = 0;
for (var i = this.peakList.size(); --i >= 0; ) {
var x = this.peakList.get(i).getX();
if (istep > 0) {
if (x > x0 && x < dmin1) {
ipt1 = i;
dmin1 = x;
} else if (x < x0 && x - x0 < dmin2) {
ipt2 = i;
dmin2 = x - x0;
}} else {
if (x < x0 && x > dmin1) {
ipt1 = i;
dmin1 = x;
} else if (x > x0 && x - x0 > dmin2) {
ipt2 = i;
dmin2 = x - x0;
}}}
if (ipt1 < 0) {
if (ipt2 < 0) return -1;
ipt1 = ipt2;
}return ipt1;
}, "JSV.common.Coordinate,~N");
Clazz_defineMethod(c$, "getPercentYValueAt", 
function(x){
if (!this.isContinuous()) return NaN;
return this.getYValueAt(x);
}, "~N");
Clazz_defineMethod(c$, "getYValueAt", 
function(x){
return JSV.common.Coordinate.getYValueAt(this.xyCoords, x);
}, "~N");
Clazz_defineMethod(c$, "setUserYFactor", 
function(userYFactor){
this.userYFactor = userYFactor;
}, "~N");
Clazz_defineMethod(c$, "getUserYFactor", 
function(){
return this.userYFactor;
});
Clazz_defineMethod(c$, "getConvertedSpectrum", 
function(){
return this.convertedSpectrum;
});
Clazz_defineMethod(c$, "setConvertedSpectrum", 
function(spectrum){
this.convertedSpectrum = spectrum;
}, "JSV.common.Spectrum");
c$.taConvert = Clazz_defineMethod(c$, "taConvert", 
function(spectrum, mode){
if (!spectrum.isContinuous()) return spectrum;
switch (mode) {
case JSV.common.Spectrum.IRMode.NO_CONVERT:
return spectrum;
case JSV.common.Spectrum.IRMode.TO_ABS:
if (!spectrum.isTransmittance()) return spectrum;
break;
case JSV.common.Spectrum.IRMode.TO_TRANS:
if (!spectrum.isAbsorbance()) return spectrum;
break;
case JSV.common.Spectrum.IRMode.TOGGLE:
break;
}
var spec = spectrum.getConvertedSpectrum();
return (spec != null ? spec : spectrum.isAbsorbance() ? JSV.common.Spectrum.toT(spectrum) : JSV.common.Spectrum.toA(spectrum));
}, "JSV.common.Spectrum,JSV.common.Spectrum.IRMode");
c$.toT = Clazz_defineMethod(c$, "toT", 
function(spectrum){
if (!spectrum.isAbsorbance()) return null;
var xyCoords = spectrum.getXYCoords();
var newXYCoords =  new Array(xyCoords.length);
if (!JSV.common.Coordinate.isYInRange(xyCoords, 0, 4.0)) xyCoords = JSV.common.Coordinate.normalise(xyCoords, 0, 4.0);
for (var i = 0; i < xyCoords.length; i++) newXYCoords[i] =  new JSV.common.Coordinate().set(xyCoords[i].getXVal(), JSV.common.Spectrum.toTransmittance(xyCoords[i].getYVal()));

return JSV.common.Spectrum.newSpectrum(spectrum, newXYCoords, "TRANSMITTANCE");
}, "JSV.common.Spectrum");
c$.toA = Clazz_defineMethod(c$, "toA", 
function(spectrum){
if (!spectrum.isTransmittance()) return null;
var xyCoords = spectrum.getXYCoords();
var newXYCoords =  new Array(xyCoords.length);
var isPercent = JSV.common.Coordinate.isYInRange(xyCoords, -2, 2);
for (var i = 0; i < xyCoords.length; i++) newXYCoords[i] =  new JSV.common.Coordinate().set(xyCoords[i].getXVal(), JSV.common.Spectrum.toAbsorbance(xyCoords[i].getYVal(), isPercent));

return JSV.common.Spectrum.newSpectrum(spectrum, newXYCoords, "ABSORBANCE");
}, "JSV.common.Spectrum");
c$.newSpectrum = Clazz_defineMethod(c$, "newSpectrum", 
function(spectrum, newXYCoords, units){
var specNew = spectrum.copy();
specNew.setOrigin("JSpecView Converted");
specNew.setOwner("JSpecView Generated");
specNew.setXYCoords(newXYCoords);
specNew.setYUnits(units);
spectrum.setConvertedSpectrum(specNew);
specNew.setConvertedSpectrum(spectrum);
return specNew;
}, "JSV.common.Spectrum,~A,~S");
c$.toAbsorbance = Clazz_defineMethod(c$, "toAbsorbance", 
function(x, isPercent){
return (Math.min(4.0, isPercent ? 2 - JSV.common.Spectrum.log10(x) : -JSV.common.Spectrum.log10(x)));
}, "~N,~B");
c$.toTransmittance = Clazz_defineMethod(c$, "toTransmittance", 
function(x){
return (x <= 0 ? 1 : Math.pow(10, -x));
}, "~N");
c$.log10 = Clazz_defineMethod(c$, "log10", 
function(value){
return Math.log(value) / Math.log(10);
}, "~N");
c$.process = Clazz_defineMethod(c$, "process", 
function(specs, irMode){
if (irMode === JSV.common.Spectrum.IRMode.TO_ABS || irMode === JSV.common.Spectrum.IRMode.TO_TRANS) for (var i = 0; i < specs.size(); i++) specs.set(i, JSV.common.Spectrum.taConvert(specs.get(i), irMode));

return true;
}, "JU.Lst,JSV.common.Spectrum.IRMode");
Clazz_defineMethod(c$, "getSubSpectra", 
function(){
return this.subSpectra;
});
Clazz_defineMethod(c$, "getCurrentSubSpectrum", 
function(){
return (this.subSpectra == null ? this : this.subSpectra.get(this.currentSubSpectrumIndex));
});
Clazz_defineMethod(c$, "advanceSubSpectrum", 
function(dir){
return this.setCurrentSubSpectrum(this.currentSubSpectrumIndex + dir);
}, "~N");
Clazz_defineMethod(c$, "setCurrentSubSpectrum", 
function(n){
return (this.currentSubSpectrumIndex = JSV.common.Coordinate.intoRange(n, 0, this.subSpectra.size() - 1));
}, "~N");
Clazz_defineMethod(c$, "addSubSpectrum", 
function(spectrum, forceSub){
if (!forceSub && (this.is1D() || this.blockID != spectrum.blockID) || !JSV.common.Spectrum.allowSubSpec(this, spectrum)) return false;
this.$isForcedSubset = forceSub;
if (this.subSpectra == null) {
this.subSpectra =  new JU.Lst();
this.addSubSpectrum(this, true);
}this.subSpectra.addLast(spectrum);
spectrum.parent = this;
return true;
}, "JSV.common.Spectrum,~B");
Clazz_defineMethod(c$, "getSubIndex", 
function(){
return (this.subSpectra == null ? -1 : this.currentSubSpectrumIndex);
});
Clazz_defineMethod(c$, "setExportXAxisDirection", 
function(leftToRight){
this.exportXAxisLeftToRight = leftToRight;
}, "~B");
Clazz_defineMethod(c$, "isExportXAxisLeftToRight", 
function(){
return this.exportXAxisLeftToRight;
});
Clazz_defineMethod(c$, "getInfo", 
function(key){
var info =  new java.util.Hashtable();
if ("id".equalsIgnoreCase(key)) {
info.put(key, this.id);
return info;
}var keys = null;
if ("".equals(key)) {
keys = "id specShift header";
}info.put("id", this.id);
JSV.common.Parameters.putInfo(key, info, "specShift", Double.$valueOf(this.specShift));
var justHeader = ("header".equals(key));
if (!justHeader && key != null && keys == null) {
for (var i = this.headerTable.size(); --i >= 0; ) {
var entry = this.headerTable.get(i);
if (entry[0].equalsIgnoreCase(key) || entry[2].equalsIgnoreCase(key)) {
info.put(key, entry[1]);
return info;
}}
}var head =  new java.util.Hashtable();
var list = this.getHeaderRowDataAsArray();
for (var i = 0; i < list.length; i++) {
var label = JSV.source.JDXSourceStreamTokenizer.cleanLabel(list[i][0]);
if (keys != null) {
keys += " " + label;
continue;
}if (key != null && !justHeader && !label.equals(key)) continue;
var val = JSV.common.Spectrum.fixInfoValue(list[i][1]);
if (key == null) {
var data =  new java.util.Hashtable();
data.put("value", val);
data.put("index", Integer.$valueOf(i + 1));
info.put(label, data);
} else {
info.put(label, val);
}}
if (head.size() > 0) info.put("header", head);
if (!justHeader) {
if (keys != null) {
keys += "  titleLabel type isHZToPPM subSpectrumCount";
} else {
JSV.common.Parameters.putInfo(key, info, "titleLabel", this.getTitleLabel());
JSV.common.Parameters.putInfo(key, info, "type", this.getDataType());
JSV.common.Parameters.putInfo(key, info, "isHZToPPM", Boolean.$valueOf(this.isHZtoPPM()));
JSV.common.Parameters.putInfo(key, info, "subSpectrumCount", Integer.$valueOf(this.subSpectra == null ? 0 : this.subSpectra.size()));
}}if (keys != null) info.put("KEYS", keys);
return info;
}, "~S");
c$.fixInfoValue = Clazz_defineMethod(c$, "fixInfoValue", 
function(info){
try {
return (Integer.$valueOf(info));
} catch (e) {
if (Clazz_exceptionOf(e, Exception)){
} else {
throw e;
}
}
try {
return (Double.$valueOf(info));
} catch (e) {
if (Clazz_exceptionOf(e, Exception)){
} else {
throw e;
}
}
return info;
}, "~S");
Clazz_defineMethod(c$, "findMatchingPeakInfo", 
function(pi){
for (var i = 0; i < this.peakList.size(); i++) if (this.peakList.get(i).checkTypeMatch(pi)) return this.peakList.get(i);

return null;
}, "JSV.common.PeakInfo");
Clazz_defineMethod(c$, "getBasePeakInfo", 
function(){
return (this.peakList.size() == 0 ?  new JSV.common.PeakInfo() :  new JSV.common.PeakInfo(" baseModel=\"\" " + this.peakList.get(0)));
});
Clazz_defineMethod(c$, "getAxisLabel", 
function(isX){
var label = (isX ? this.peakXLabel : this.peakYLabel);
if (label == null) label = (isX ? this.xLabel : this.yLabel);
if (label == null) label = (isX ? this.xUnits : this.yUnits);
return (label == null ? "" : label.equalsIgnoreCase("WAVENUMBERS") ? "1/cm" : label.equalsIgnoreCase("nanometers") ? "nm" : label);
}, "~B");
Clazz_defineMethod(c$, "findXForPeakNearest", 
function(x){
return JSV.common.Coordinate.findXForPeakNearest(this.xyCoords, x, this.isInverted());
}, "~N");
Clazz_defineMethod(c$, "addSpecShift", 
function(dx){
if (dx != 0) {
this.specShift += dx;
JSV.common.Coordinate.shiftX(this.xyCoords, dx);
if (this.subSpectra != null) for (var i = this.subSpectra.size(); --i >= 0; ) {
var spec = this.subSpectra.get(i);
if (spec !== this && spec !== this.parent) spec.addSpecShift(dx);
}
}return this.specShift;
}, "~N");
c$.allowSubSpec = Clazz_defineMethod(c$, "allowSubSpec", 
function(s1, s2){
return (s1.is1D() == s2.is1D() && s1.xUnits.equalsIgnoreCase(s2.xUnits) && s1.isHNMR() == s2.isHNMR());
}, "JSV.common.Spectrum,JSV.common.Spectrum");
c$.areXScalesCompatible = Clazz_defineMethod(c$, "areXScalesCompatible", 
function(s1, s2, isSubspecCheck, isLinkCheck){
var isNMR1 = s1.isNMR();
if (isNMR1 != s2.isNMR() || s1.isContinuous() != s2.isContinuous() || !isLinkCheck && !JSV.common.Spectrum.areUnitsCompatible(s1.xUnits, s2.xUnits)) return false;
if (isSubspecCheck) {
if (s1.is1D() != s2.is1D()) return false;
} else if (isLinkCheck) {
if (!isNMR1) return true;
} else if (!s1.is1D() || !s2.is1D()) {
return false;
}return (!isNMR1 || s2.is1D() && s1.parent.nucleusX.equals(s2.parent.nucleusX));
}, "JSV.common.Spectrum,JSV.common.Spectrum,~B,~B");
c$.areUnitsCompatible = Clazz_defineMethod(c$, "areUnitsCompatible", 
function(u1, u2){
if (u1.equalsIgnoreCase(u2)) return true;
u1 = u1.toUpperCase();
u2 = u2.toUpperCase();
return (u1.equals("HZ") && u2.equals("PPM") || u1.equals("PPM") && u2.equals("HZ"));
}, "~S,~S");
c$.areLinkableX = Clazz_defineMethod(c$, "areLinkableX", 
function(s1, s2){
return (s1.isNMR() && s2.isNMR() && s1.nucleusX.equals(s2.nucleusX));
}, "JSV.common.Spectrum,JSV.common.Spectrum");
c$.areLinkableY = Clazz_defineMethod(c$, "areLinkableY", 
function(s1, s2){
return (s1.isNMR() && s2.isNMR() && s1.nucleusX.equals(s2.nucleusY));
}, "JSV.common.Spectrum,JSV.common.Spectrum");
Clazz_defineMethod(c$, "getPeakWidth", 
function(){
var w = this.getLastX() - this.getFirstX();
return (w / 100);
});
Clazz_defineMethod(c$, "setSimulated", 
function(filePath){
this.isSimulation = true;
var s = this.sourceID;
if (s.length == 0) s = JU.PT.rep(filePath, "http://SIMULATION/", "");
if (s.indexOf("MOL=") >= 0) s = "";
this.title = "SIMULATED " + JU.PT.rep(s, "$", "");
}, "~S");
Clazz_defineMethod(c$, "setFillColor", 
function(color){
this.fillColor = color;
if (this.convertedSpectrum != null) this.convertedSpectrum.fillColor = color;
}, "javajs.api.GenericColor");
Clazz_overrideMethod(c$, "toString", 
function(){
return this.getTitleLabel() + (this.xyCoords == null ? "" : " xyCoords.length=" + this.xyCoords.length);
});
/*if2*/;(function(){
var c$ = Clazz_declareType(JSV.common.Spectrum, "IRMode", Enum);
c$.getMode = Clazz_defineMethod(c$, "getMode", 
function(value){
switch ((value == null ? 'I' : value.toUpperCase().charAt(0)).charCodeAt(0)) {
case 65:
return JSV.common.Spectrum.IRMode.TO_ABS;
case 84:
return (value.equalsIgnoreCase("TOGGLE") ? JSV.common.Spectrum.IRMode.TOGGLE : JSV.common.Spectrum.IRMode.TO_TRANS);
case 78:
return JSV.common.Spectrum.IRMode.NO_CONVERT;
default:
return JSV.common.Spectrum.IRMode.TOGGLE;
}
}, "~S");
Clazz_defineEnumConstant(c$, "NO_CONVERT", 0, []);
Clazz_defineEnumConstant(c$, "TO_TRANS", 1, []);
Clazz_defineEnumConstant(c$, "TO_ABS", 2, []);
Clazz_defineEnumConstant(c$, "TOGGLE", 3, []);
/*eoif2*/})();
});
;//5.0.1-v7 Mon Aug 17 10:07:10 MDT 2026
Clazz_declarePackage("JSV.common");
(function(){
var c$ = Clazz_declareType(JSV.common, "JSVersion", null);
{
var tmpVersion = null;
var tmpDate = null;
{
tmpVersion = Jmol.___JmolVersion; tmpDate = Jmol.___JmolDate;
}if (tmpDate != null) {
tmpDate = tmpDate.substring(7, 23);
}JSV.common.JSVersion.VERSION_SHORT = (tmpVersion != null ? tmpVersion : "(Unknown_version)");
var mv = (tmpVersion != null ? tmpVersion : "(Unknown_version)");
JSV.common.JSVersion.date = (tmpDate != null ? tmpDate : "");
JSV.common.JSVersion.VERSION = JSV.common.JSVersion.VERSION_SHORT + (JSV.common.JSVersion.date == null ? "" : " " + JSV.common.JSVersion.date);
var v = -1;
if (tmpVersion != null) try {
var s = JSV.common.JSVersion.VERSION_SHORT;
var major = "";
var i = s.indexOf(".");
if (i < 0) {
v = 100000 * Integer.parseInt(s);
s = null;
}if (s != null) {
v = 100000 * Integer.parseInt(major = s.substring(0, i));
s = s.substring(i + 1);
i = s.indexOf(".");
if (i < 0) {
v += 1000 * Integer.parseInt(s);
s = null;
}if (s != null) {
var m = s.substring(0, i);
major += "." + m;
mv = major;
v += 1000 * Integer.parseInt(m);
s = s.substring(i + 1);
i = s.indexOf("_");
if (i >= 0) s = s.substring(0, i);
i = s.indexOf(" ");
if (i >= 0) s = s.substring(0, i);
v += Integer.parseInt(s);
}}} catch (e) {
if (Clazz_exceptionOf(e,"NumberFormatException")){
} else {
throw e;
}
}
JSV.common.JSVersion.majorVersion = mv;
JSV.common.JSVersion.versionInt = v;
}})();
;//5.0.1-v7 Mon Aug 17 10:07:10 MDT 2026
Clazz_declarePackage("JSV.common");
Clazz_load(["java.util.Hashtable"], "JSV.common.JSVFileManager", ["java.io.BufferedInputStream", "$.BufferedReader", "$.File", "$.InputStreamReader", "$.StringReader", "java.net.URL", "JU.AU", "$.BS", "$.Encoding", "$.JSJSONParser", "$.P3", "$.PT", "$.SB", "JSV.common.JSVersion", "$.JSViewer", "JSV.exception.JSVException", "JU.Logger"], function(){
var c$ = Clazz_declareType(JSV.common, "JSVFileManager", null);
Clazz_defineMethod(c$, "isApplet", 
function(){
return (JSV.common.JSVFileManager.appletDocumentBase != null);
});
c$.getFileAsString = Clazz_defineMethod(c$, "getFileAsString", 
function(name){
if (name == null) return null;
var br;
var sb =  new JU.SB();
try {
br = JSV.common.JSVFileManager.getBufferedReaderFromName(name);
var line;
while ((line = br.readLine()) != null) {
sb.append(line);
sb.appendC('\n');
}
br.close();
} catch (e) {
if (Clazz_exceptionOf(e, Exception)){
return null;
} else {
throw e;
}
}
return sb.toString();
}, "~S");
c$.getBufferedReaderForInputStream = Clazz_defineMethod(c$, "getBufferedReaderForInputStream", 
function($in){
try {
return  new java.io.BufferedReader( new java.io.InputStreamReader($in, "UTF-8"));
} catch (e) {
if (Clazz_exceptionOf(e, Exception)){
return null;
} else {
throw e;
}
}
}, "java.io.InputStream");
c$.getBufferedReaderForStringOrBytes = Clazz_defineMethod(c$, "getBufferedReaderForStringOrBytes", 
function(stringOrBytes){
return (stringOrBytes == null ? null :  new java.io.BufferedReader( new java.io.StringReader((typeof(stringOrBytes)=='string') ? stringOrBytes :  String.instantialize(stringOrBytes))));
}, "~O");
c$.getBufferedReaderFromName = Clazz_defineMethod(c$, "getBufferedReaderFromName", 
function(name){
if (name == null) throw  new JSV.exception.JSVException("Cannot find " + name);
JU.Logger.info("JSVFileManager getBufferedReaderFromName " + name);
var path = JSV.common.JSVFileManager.getFullPathName(name);
if (!path.equals(name)) JU.Logger.info("JSVFileManager getBufferedReaderFromName " + path);
return JSV.common.JSVFileManager.getUnzippedBufferedReaderFromName(path);
}, "~S");
c$.getFullPathName = Clazz_defineMethod(c$, "getFullPathName", 
function(name){
try {
if (JSV.common.JSVFileManager.appletDocumentBase == null) {
if (JSV.common.JSVFileManager.isURL(name)) {
var url =  new java.net.URL(Clazz_castNullAs("java.net.URL"), name, null);
return url.toString();
}return JSV.common.JSVFileManager.newFile(name).getFullPath();
}if (name.indexOf(":\\") == 1 || name.indexOf(":/") == 1) name = "file:///" + name;
 else if (name.startsWith("cache://")) return name;
var url =  new java.net.URL(JSV.common.JSVFileManager.appletDocumentBase, name, null);
return url.toString();
} catch (e) {
if (Clazz_exceptionOf(e, Exception)){
throw  new JSV.exception.JSVException("Cannot create path for " + name);
} else {
throw e;
}
}
}, "~S");
c$.isURL = Clazz_defineMethod(c$, "isURL", 
function(name){
for (var i = JSV.common.JSVFileManager.urlPrefixes.length; --i >= 0; ) if (name.startsWith(JSV.common.JSVFileManager.urlPrefixes[i])) return true;

return false;
}, "~S");
c$.urlTypeIndex = Clazz_defineMethod(c$, "urlTypeIndex", 
function(name){
for (var i = 0; i < JSV.common.JSVFileManager.urlPrefixes.length; ++i) {
if (name.startsWith(JSV.common.JSVFileManager.urlPrefixes[i])) {
return i;
}}
return -1;
}, "~S");
c$.isLocal = Clazz_defineMethod(c$, "isLocal", 
function(fileName){
if (fileName == null) return false;
var itype = JSV.common.JSVFileManager.urlTypeIndex(fileName);
return (itype < 0 || itype == 4);
}, "~S");
c$.getUnzippedBufferedReaderFromName = Clazz_defineMethod(c$, "getUnzippedBufferedReaderFromName", 
function(name){
var subFileList = null;
if (name.indexOf("|") >= 0) {
subFileList = JU.PT.split(name, "|");
if (subFileList != null && subFileList.length > 0) name = subFileList[0];
}if (name.startsWith("http://SIMULATION/")) return JSV.common.JSVFileManager.getSimulationReader(name);
try {
var ret = JSV.common.JSVFileManager.getInputStream(name, true, null);
if (Clazz_instanceOf(ret,"JU.SB") || (typeof(ret)=='string')) return  new java.io.BufferedReader( new java.io.StringReader(ret.toString()));
if (JSV.common.JSVFileManager.isAB(ret)) return  new java.io.BufferedReader( new java.io.StringReader( String.instantialize(ret)));
var bis =  new java.io.BufferedInputStream(ret);
var $in = bis;
if (JSV.common.JSVFileManager.isGzip(bis)) $in = (JSV.common.JSViewer.getInterface("JSV.common.JSVZipUtil")).newGZIPInputStream($in);
return  new java.io.BufferedReader( new java.io.InputStreamReader($in, "UTF-8"));
} catch (e) {
if (Clazz_exceptionOf(e, Exception)){
throw e;
} else {
throw e;
}
}
}, "~S");
c$.getAbbrSimulationFileName = Clazz_defineMethod(c$, "getAbbrSimulationFileName", 
function(name){
var type = JSV.common.JSVFileManager.getSimulationType(name);
var filename = JSV.common.JSVFileManager.getAbbreviatedSimulationName(name, type, true);
return filename;
}, "~S");
c$.getAbbreviatedSimulationName = Clazz_defineMethod(c$, "getAbbreviatedSimulationName", 
function(name, type, addProtocol){
return (name.indexOf("MOL=") >= 0 ? (addProtocol ? "http://SIMULATION/" : "") + "MOL=" + JSV.common.JSVFileManager.getSimulationHash(name, type) : name);
}, "~S,~S,~B");
c$.getSimulationHash = Clazz_defineMethod(c$, "getSimulationHash", 
function(name, type){
var code = type + Math.abs(name.substring(name.indexOf("V2000") + 1).hashCode());
if (JU.Logger.debugging) System.out.println("JSVFileManager hash for " + name + " = " + code);
return code;
}, "~S,~S");
c$.getSimulationFileData = Clazz_defineMethod(c$, "getSimulationFileData", 
function(name, type){
return JSV.common.JSVFileManager.cacheGet(name.startsWith("MOL=") ? name.substring(4) : JSV.common.JSVFileManager.getAbbreviatedSimulationName(name, type, false));
}, "~S,~S");
c$.cachePut = Clazz_defineMethod(c$, "cachePut", 
function(name, data){
if (JU.Logger.debugging) JU.Logger.debug("JSVFileManager cachePut " + data + " for " + name);
if (data != null) {
JSV.common.JSVFileManager.htCorrelationCache.put(name, data);
if (JSV.common.JSVFileManager.cacheDir != null && name.indexOf(":") < 0) {
try {
 new java.io.File(JSV.common.JSVFileManager.cacheDir).mkdirs();
var f =  new java.io.File(JSV.common.JSVFileManager.cacheDir, name);
var fos =  new java.io.FileOutputStream(f);
fos.write(data.getBytes());
fos.close();
} catch (e) {
if (Clazz_exceptionOf(e,"java.io.IOException")){
e.printStackTrace();
} else {
throw e;
}
}
}}}, "~S,~S");
c$.cacheGet = Clazz_defineMethod(c$, "cacheGet", 
function(key){
var data = JSV.common.JSVFileManager.htCorrelationCache.get(key);
if (JU.Logger.debugging) JU.Logger.info("JSVFileManager cacheGet " + data + " for " + key);
return data;
}, "~S");
c$.getSimulationReader = Clazz_defineMethod(c$, "getSimulationReader", 
function(name){
var data = JSV.common.JSVFileManager.cacheGet(name);
if (data == null) JSV.common.JSVFileManager.cachePut(name, data = JSV.common.JSVFileManager.getNMRSimulationJCampDX(name.substring("http://SIMULATION/".length)));
return JSV.common.JSVFileManager.getBufferedReaderForStringOrBytes(data);
}, "~S");
c$.isAB = Clazz_defineMethod(c$, "isAB", 
function(x){
return JU.AU.isAB(x);
}, "~O");
c$.isZipFile = Clazz_defineMethod(c$, "isZipFile", 
function(is){
try {
var abMagic =  Clazz_newByteArray (4, 0);
is.mark(5);
var countRead = is.read(abMagic, 0, 4);
is.reset();
return (countRead == 4 && abMagic[0] == 0x50 && abMagic[1] == 0x4B && abMagic[2] == 0x03 && abMagic[3] == 0x04);
} catch (e) {
if (Clazz_exceptionOf(e, Exception)){
throw  new JSV.exception.JSVException(e.toString());
} else {
throw e;
}
}
}, "java.io.InputStream");
c$.isGzip = Clazz_defineMethod(c$, "isGzip", 
function(is){
try {
var abMagic =  Clazz_newByteArray (4, 0);
is.mark(5);
var countRead = is.read(abMagic, 0, 4);
is.reset();
return (countRead == 4 && abMagic[0] == 0x1F && abMagic[1] == 0x8B);
} catch (e) {
if (Clazz_exceptionOf(e, Exception)){
throw  new JSV.exception.JSVException(e.toString());
} else {
throw e;
}
}
}, "java.io.InputStream");
c$.getStreamAsBytes = Clazz_defineMethod(c$, "getStreamAsBytes", 
function(bis, out){
try {
var buf =  Clazz_newByteArray (1024, 0);
var bytes = (out == null ?  Clazz_newByteArray (4096, 0) : null);
var len = 0;
var totalLen = 0;
while ((len = bis.read(buf, 0, 1024)) > 0) {
totalLen += len;
if (out == null) {
if (totalLen >= bytes.length) bytes = JU.AU.ensureLengthByte(bytes, totalLen * 2);
System.arraycopy(buf, 0, bytes, totalLen - len, len);
} else {
out.write(buf, 0, len);
}}
bis.close();
if (out == null) {
return JU.AU.arrayCopyByte(bytes, totalLen);
}return totalLen + " bytes";
} catch (e) {
if (Clazz_exceptionOf(e, Exception)){
throw  new JSV.exception.JSVException(e.toString());
} else {
throw e;
}
}
}, "java.io.BufferedInputStream,JU.OC");
c$.postByteArray = Clazz_defineMethod(c$, "postByteArray", 
function(fileName, bytes){
var ret = null;
try {
ret = JSV.common.JSVFileManager.getInputStream(fileName, false, bytes);
} catch (e) {
if (Clazz_exceptionOf(e, Exception)){
ret = e.toString();
} else {
throw e;
}
}
if ((typeof(ret)=='string')) return ret;
try {
ret = JSV.common.JSVFileManager.getStreamAsBytes(ret, null);
} catch (e) {
if (Clazz_exceptionOf(e,"JSV.exception.JSVException")){
try {
(ret).close();
} catch (e1) {
if (Clazz_exceptionOf(e1, Exception)){
} else {
throw e1;
}
}
} else {
throw e;
}
}
return (ret == null ? "" : JSV.common.JSVFileManager.fixUTF(ret));
}, "~S,~A");
c$.getUTFEncoding = Clazz_defineMethod(c$, "getUTFEncoding", 
function(bytes){
if (bytes.length >= 3 && bytes[0] == 0xEF && bytes[1] == 0xBB && bytes[2] == 0xBF) return JU.Encoding.UTF8;
if (bytes.length >= 4 && bytes[0] == 0 && bytes[1] == 0 && bytes[2] == 0xFE && bytes[3] == 0xFF) return JU.Encoding.UTF_32BE;
if (bytes.length >= 4 && bytes[0] == 0xFF && bytes[1] == 0xFE && bytes[2] == 0 && bytes[3] == 0) return JU.Encoding.UTF_32LE;
if (bytes.length >= 2 && bytes[0] == 0xFF && bytes[1] == 0xFE) return JU.Encoding.UTF_16LE;
if (bytes.length >= 2 && bytes[0] == 0xFE && bytes[1] == 0xFF) return JU.Encoding.UTF_16BE;
return JU.Encoding.NONE;
}, "~A");
c$.fixUTF = Clazz_defineMethod(c$, "fixUTF", 
function(bytes){
var encoding = JSV.common.JSVFileManager.getUTFEncoding(bytes);
if (encoding !== JU.Encoding.NONE) try {
var s =  String.instantialize(bytes, encoding.name().$replace('_', '-'));
switch (encoding) {
case JU.Encoding.UTF8:
case JU.Encoding.UTF_16BE:
case JU.Encoding.UTF_16LE:
s = s.substring(1);
break;
default:
break;
}
return s;
} catch (e) {
if (Clazz_exceptionOf(e,"java.io.IOException")){
JU.Logger.error("fixUTF error " + e);
} else {
throw e;
}
}
return  String.instantialize(bytes);
}, "~A");
c$.getInputStream = Clazz_defineMethod(c$, "getInputStream", 
function(name, showMsg, postBytes){
var isURL = JSV.common.JSVFileManager.isURL(name);
var isApplet = (JSV.common.JSVFileManager.appletDocumentBase != null);
var $in = null;
var post = null;
var iurl;
if (isURL && (iurl = name.indexOf("?POST?")) >= 0) {
post = name.substring(iurl + 6);
name = name.substring(0, iurl);
}if (isApplet || isURL) {
var url;
try {
url =  new java.net.URL(JSV.common.JSVFileManager.appletDocumentBase, name, null);
} catch (e) {
if (Clazz_exceptionOf(e, Exception)){
throw  new JSV.exception.JSVException("Cannot read " + name);
} else {
throw e;
}
}
JU.Logger.info("JSVFileManager opening URL " + url + (post == null ? "" : " with POST of " + post.length + " bytes"));
$in = JSV.common.JSVFileManager.viewer.apiPlatform.getURLContents(url, postBytes, post, false);
} else {
if (showMsg) JU.Logger.info("JSVFileManager opening file " + name);
$in = JSV.common.JSVFileManager.viewer.apiPlatform.getBufferedFileInputStream(name);
}if ((typeof($in)=='string')) throw  new JSV.exception.JSVException("\n" + $in);
return $in;
}, "~S,~B,~A");
c$.getNMRSimulationJCampDX = Clazz_defineMethod(c$, "getNMRSimulationJCampDX", 
function(name){
var pt = 0;
var molFile = null;
var type = JSV.common.JSVFileManager.getSimulationType(name);
if (name.startsWith(type)) name = name.substring(type.length + 1);
var isInline = name.startsWith("MOL=");
if (isInline) {
name = name.substring(4);
pt = name.indexOf("/n__Jmol");
if (pt > 0) name = name.substring(0, pt) + JU.PT.rep(name.substring(pt), "/n", "\n");
molFile = name = JU.PT.rep(name, "\\n", "\n");
}var key = "" + JSV.common.JSVFileManager.getSimulationHash(name, type);
if (JU.Logger.debugging) JU.Logger.info("JSVFileManager type=" + type + " key=" + key + " name=" + name);
var jcamp = JSV.common.JSVFileManager.cacheGet(key);
if (jcamp != null) return jcamp;
var src = (isInline ? null : JU.PT.rep(JSV.common.JSVFileManager.nciResolver, "%FILE", JU.PT.escapeUrl(name)));
if (!isInline && (molFile = JSV.common.JSVFileManager.getFileAsString(src)) == null || molFile.indexOf("<html") >= 0) {
JU.Logger.error("no MOL data returned by NCI");
return null;
}var is13C = type.equals("C13");
var url;
url = (is13C ? JSV.common.JSVFileManager.nmrdbServerC13 : JSV.common.JSVFileManager.nmrdbServerH1);
url = url.$replace("$MOLFILE", molFile);
JSV.common.JSVFileManager.cachePut("url", url);
var json = JSV.common.JSVFileManager.getFileAsString(url);
if ((json == null ? (json = "Error: Error fetching simulation") : json).indexOf("Error:") >= 0) {
return json;
}var map = ( new JU.JSJSONParser()).parseMap(json, true);
JSV.common.JSVFileManager.cachePut("json", json);
return JSV.common.JSVFileManager.processJSON(key, src, url, name, type, molFile, map, is13C, isInline);
}, "~S");
c$.processJSON = Clazz_defineMethod(c$, "processJSON", 
function(key, src, url, name, type, molFile, json, is13C, isInline){
var map = json.get("data");
var jsonMolFile = map.get("molfile");
if (jsonMolFile == null) {
System.out.println("JSVFileManager: no MOL file returned from EPFL");
jsonMolFile = molFile;
}var atomMap = JSV.common.JSVFileManager.getAtomMap(jsonMolFile, molFile);
JSV.common.JSVFileManager.cachePut("mol", molFile);
var bytes = (isInline || !JSV.common.JSViewer.isJS ? null : molFile.getBytes());
{
if (bytes) Jmol.Cache.put("http://SIMULATION/" + type +
"/" + name + "#molfile", bytes);
}var xml = "<Signals src=" + JU.PT.esc(url.substring(0, url.indexOf('?'))) + ">\n";
var jcamp;
type = (is13C ? "13C" : "1HNMR");
jcamp = map.get("jcamp");
jcamp = JSV.common.JSVFileManager.hackNewNmriumSimulationJCAMP(jcamp);
var signals = map.get("signals");
var bf1 = JSV.common.JSVFileManager.getval(jcamp, "##$BF1");
var freq = (bf1 == null ? (is13C ? 100 : 400) : Float.parseFloat(bf1));
var sb =  new JU.SB();
for (var i = signals.size(); --i >= 0; ) {
var signal = signals.get(i);
sb.append("<Signal ");
JSV.common.JSVFileManager.setAttr(sb, "type", type, null);
var index = (signal.get("atoms")).get(0);
if (atomMap == null) {
JSV.common.JSVFileManager.setAttr(sb, "atoms", index, null);
} else {
sb.append("atoms=\"").appendI(atomMap[index.intValue()]).append("\" ");
}JSV.common.JSVFileManager.setAttr(sb, "multiplicity", "multiplicity", signal);
var delta = signal.get("delta");
var minmax = JSV.common.JSVFileManager.getSignalMinMax(signal, delta.floatValue(), freq, is13C);
JSV.common.JSVFileManager.setAttr(sb, "xMin", "" + minmax[0], null);
JSV.common.JSVFileManager.setAttr(sb, "xMax", "" + minmax[1], null);
JSV.common.JSVFileManager.setAttr(sb, "integral", "nbAtoms", signal);
sb.append("></Signal>\n");
}
sb.append("</Signals>");
xml += sb.toString();
if (JU.Logger.debugging) JU.Logger.info(xml);
JSV.common.JSVFileManager.cachePut("xml", xml);
jcamp = "##TITLE=" + (isInline ? "JMOL SIMULATION/" + type : name) + "\n" + jcamp.substring(jcamp.indexOf("\n##") + 1);
var pt = molFile.indexOf("\n");
pt = molFile.indexOf("\n", pt + 1);
if (pt > 0 && pt == molFile.indexOf("\n \n")) molFile = molFile.substring(0, pt + 1) + "Created " + JSV.common.JSVFileManager.viewer.apiPlatform.getDateFormat("8824") + " by JSpecView " + JSV.common.JSVersion.VERSION + molFile.substring(pt + 1);
pt = 0;
pt = jcamp.indexOf("##.");
var id = JSV.common.JSVFileManager.getAbbreviatedSimulationName(name, type, false);
var pt1 = id.indexOf("id='");
if (isInline && pt1 > 0) id = id.substring(pt1 + 4, (id + "'").indexOf("'", pt1 + 4));
JSV.common.JSVFileManager.cachePut(type + "-json.jcamp", jcamp);
jcamp = jcamp.substring(0, pt) + "##$MODELS=\n<Models>\n" + "<ModelData id=" + JU.PT.esc(id) + " type=\"MOL\" src=" + JU.PT.esc(src) + ">\n" + molFile + "</ModelData>\n</Models>\n" + "##$SIGNALS=\n" + xml + "\n" + jcamp.substring(pt);
JSV.common.JSVFileManager.cachePut("jcamp", jcamp);
JSV.common.JSVFileManager.cachePut(key, jcamp);
return jcamp;
}, "~S,~S,~S,~S,~S,~S,java.util.Map,~B,~B");
c$.getSignalMinMax = Clazz_defineMethod(c$, "getSignalMinMax", 
function(signal, delta, freq, is13C){
var minmax =  Clazz_newFloatArray (2, 0);
if (is13C) {
minmax[0] = delta - 0.5;
minmax[1] = delta + 0.5;
} else {
var js = signal.get("js");
var d = 1;
for (var i = js.size(); --i >= 0; ) {
var j = js.get(i);
var c = (j.get("coupling")).floatValue();
switch (j.get("multiplicity")) {
case "d":
d += c / 2;
break;
default:
case "t":
d += c;
break;
}
}
minmax[0] = delta - d / freq;
minmax[1] = delta + d / freq;
}return minmax;
}, "java.util.Map,~N,~N,~B");
c$.hackNewNmriumSimulationJCAMP = Clazz_defineMethod(c$, "hackNewNmriumSimulationJCAMP", 
function(jcamp){
var shift = JSV.common.JSVFileManager.getline(jcamp, "##.SHIFT REFERENCE=INTERNAL");
var offset = JSV.common.JSVFileManager.getval(jcamp, "##$OFFSET");
if (shift != null && offset != null) {
shift = shift.substring(0, shift.lastIndexOf(", ") + 2) + offset;
jcamp = JSV.common.JSVFileManager.setline(jcamp, "##$OFFSET", null);
jcamp = JSV.common.JSVFileManager.setline(jcamp, "##.SHIFT REFERENCE=INTERNAL", shift);
}return jcamp;
}, "~S");
c$.getline = Clazz_defineMethod(c$, "getline", 
function(jcamp, record){
var pt = jcamp.indexOf(record);
if (pt < 0) return null;
return jcamp.substring(pt, jcamp.indexOf("\n", pt));
}, "~S,~S");
c$.getval = Clazz_defineMethod(c$, "getval", 
function(jcamp, record){
var pt = jcamp.indexOf(record);
if (pt < 0) return null;
var val = jcamp.substring(jcamp.indexOf("=", pt) + 1, jcamp.indexOf("\n", pt));
pt = val.indexOf("$$");
if (pt >= 0) val = val.substring(pt);
return val.trim();
}, "~S,~S");
c$.setline = Clazz_defineMethod(c$, "setline", 
function(jcamp, record, replacement){
var pt = jcamp.indexOf(record);
if (pt < 0) return jcamp;
if (replacement == null) return jcamp.substring(0, pt) + jcamp.substring(jcamp.indexOf("\n", pt) + 1);
return jcamp.substring(0, pt) + replacement + jcamp.substring(jcamp.indexOf("\n", pt));
}, "~S,~S,~S");
c$.getAtomMap = Clazz_defineMethod(c$, "getAtomMap", 
function(jsonMolFile, jmolMolFile){
var acJson = JSV.common.JSVFileManager.getCoord(jsonMolFile);
var acJmol = JSV.common.JSVFileManager.getCoord(jmolMolFile);
var n = acJson.length;
if (n != acJmol.length) return null;
var map =  Clazz_newIntArray (n, 0);
var bs =  new JU.BS();
bs.setBits(0, n);
var haveMap = false;
for (var i = 0; i < n; i++) {
var a = acJson[i];
for (var j = bs.nextSetBit(0); j >= 0; j = bs.nextSetBit(j + 1)) {
if (a.distanceSquared(acJmol[j]) < 0.1) {
bs.clear(j);
map[i] = j;
if (i != j) haveMap = true;
break;
}}
}
return (haveMap ? map : null);
}, "~S,~S");
c$.getCoord = Clazz_defineMethod(c$, "getCoord", 
function(mol){
var lines = JU.PT.split(mol, "\n");
var data =  Clazz_newFloatArray (3, 0);
var n = Integer.parseInt(lines[3].substring(0, 3).trim());
var pts =  new Array(n);
for (var i = 0; i < n; i++) {
var line = lines[4 + i];
JU.PT.parseFloatArrayInfested(JU.PT.getTokens(line.substring(0, 31)), data);
pts[i] = JU.P3.new3(data[0], data[1], data[2]);
}
return pts;
}, "~S");
c$.setAttr = Clazz_defineMethod(c$, "setAttr", 
function(sb, mykey, lucsKeyOrVal, map){
sb.append(mykey + "=\"").appendO((map == null ? lucsKeyOrVal : map.get(lucsKeyOrVal))).append("\" ");
}, "JU.SB,~S,~O,java.util.Map");
c$.getResource = Clazz_defineMethod(c$, "getResource", 
function(object, fileName, error){
var url = null;
try {
if ((url = object.getClass().getResource(fileName)) == null) error[0] = "Couldn't find file: " + fileName;
} catch (e) {
if (Clazz_exceptionOf(e, Exception)){
error[0] = "Exception " + e + " in getResource " + fileName;
} else {
throw e;
}
}
return url;
}, "~O,~S,~A");
c$.getResourceString = Clazz_defineMethod(c$, "getResourceString", 
function(object, name, error){
var url = JSV.common.JSVFileManager.getResource(object, name, error);
if (url == null) {
error[0] = "Error loading resource " + name;
return null;
}if ((typeof(url)=='string')) {
return JSV.common.JSVFileManager.getFileAsString(url);
}var sb =  new JU.SB();
try {
var br =  new java.io.BufferedReader( new java.io.InputStreamReader((url).getContent(), "UTF-8"));
var line;
while ((line = br.readLine()) != null) sb.append(line).append("\n");

br.close();
} catch (e) {
if (Clazz_exceptionOf(e, Exception)){
error[0] = e.toString();
} else {
throw e;
}
}
return sb.toString();
}, "~O,~S,~A");
c$.getJmolFilePath = Clazz_defineMethod(c$, "getJmolFilePath", 
function(filePath){
try {
filePath = JSV.common.JSVFileManager.getFullPathName(filePath);
} catch (e) {
if (Clazz_exceptionOf(e,"JSV.exception.JSVException")){
return null;
} else {
throw e;
}
}
return (JSV.common.JSVFileManager.appletDocumentBase == null ? filePath.$replace('\\', '/') : filePath);
}, "~S");
c$.getTagName = Clazz_defineMethod(c$, "getTagName", 
function(fileName){
if (fileName == null) return "String" + (++JSV.common.JSVFileManager.stringCount);
if (JSV.common.JSVFileManager.isURL(fileName)) {
try {
if (fileName.startsWith("http://SIMULATION/")) return JSV.common.JSVFileManager.getAbbrSimulationFileName(fileName);
var name = ( new java.net.URL(Clazz_castNullAs("java.net.URL"), fileName, null)).getFile();
return name.substring(name.lastIndexOf('/') + 1);
} catch (e) {
if (Clazz_exceptionOf(e,"java.io.IOException")){
return null;
} else {
throw e;
}
}
}return JSV.common.JSVFileManager.newFile(fileName).getName();
}, "~S");
c$.newFile = Clazz_defineMethod(c$, "newFile", 
function(fileName){
return JSV.common.JSVFileManager.viewer.apiPlatform.newFile(fileName);
}, "~S");
c$.setDocumentBase = Clazz_defineMethod(c$, "setDocumentBase", 
function(v, documentBase){
JSV.common.JSVFileManager.viewer = v;
JSV.common.JSVFileManager.appletDocumentBase = documentBase;
}, "JSV.common.JSViewer,java.net.URL");
c$.getSimulationType = Clazz_defineMethod(c$, "getSimulationType", 
function(filePath){
return (filePath.indexOf("C13/") >= 0 ? "C13" : "H1");
}, "~S");
c$.appletDocumentBase = null;
c$.viewer = null;
c$.jsDocumentBase = "";
c$.urlPrefixes =  Clazz_newArray(-1, ["http:", "https:", "ftp:", "http://SIMULATION/", "file:"]);
c$.htCorrelationCache =  new java.util.Hashtable();
c$.cacheDir = null;
c$.nciResolver = "https://cactus.nci.nih.gov/chemical/structure/%FILE/file?format=sdf&get3d=True";
c$.nmrdbServerH1 = "https://nmr-prediction.service.zakodium.com/v1/predict/proton?POST?{\"molfile\":\"$MOLFILE\",\"includeJDX\":true}";
c$.nmrdbServerC13 = "https://nmr-prediction.service.zakodium.com/v1/predict/carbon?POST?{\"molfile\":\"$MOLFILE\",\"includeJDX\":true}";
c$.stringCount = 0;
});
;//5.0.1-v7 Mon Aug 17 10:07:10 MDT 2026
Clazz_declarePackage("JSV.common");
Clazz_load(["javajs.api.BytePoster", "J.api.PlatformViewer", "JSV.common.Spectrum"], "JSV.common.JSViewer", ["java.io.File", "java.net.URL", "java.util.Arrays", "$.Hashtable", "JU.CU", "$.Lst", "$.OC", "$.PT", "$.SB", "JSV.common.Annotation", "$.ExportType", "$.JSVFileManager", "$.PanelData", "$.PanelNode", "$.Parameters", "$.PeakInfo", "$.PrintLayout", "$.RepaintManager", "$.ScriptToken", "$.ScriptTokenizer", "$.SyncManager", "JSV.source.JDXReader", "$.JDXSource", "JSV.tree.SimpleTree", "JU.Logger"], function(){
var c$ = Clazz_decorateAsClass(function(){
this.parentFrame = null;
this.si = null;
this.g2d = null;
this.spectraTree = null;
this.currentSource = null;
this.panelNodes = null;
this.parameters = null;
this.repaintManager = null;
this.selectedPanel = null;
this.mainPanel = null;
this.properties = null;
this.scriptQueue = null;
this.fileHelper = null;
this.jsvpPopupMenu = null;
this.dialogManager = null;
this.viewDialog = null;
this.overlayLegendDialog = null;
this.irMode = null;
this.isEmbedded = false;
this.loadImaginary = false;
this.interfaceOverlaid = false;
this.autoIntegrate = false;
this.autoShowLegend = false;
this.obscureTitleFromUser = null;
this.allowMenu = true;
this.initialStartIndex = -1;
this.initialEndIndex = -1;
this.isSingleThreaded = false;
this.isApplet = false;
this.isSigned = false;
this.recentScript = "";
this.appletName = null;
this.fullName = null;
this.syncID = null;
this.html5Applet = null;
this.display = null;
this.maximumSize = 2147483647;
this.screenHeight = 0;
this.screenWidth = 0;
this.fileCount = 0;
this.nViews = 0;
this.scriptLevelCount = 0;
this.integrationRatios = null;
this.apiPlatform = null;
this.hasDisplay = false;
this.peakInfoModelSentToJmol = null;
this.popupAllowMenu = true;
this.popupZoomEnabled = true;
this.defaultLoadScript = null;
this.nmrMaxY = NaN;
this.recentStackPercent = 5;
this.lastPrintLayout = null;
this.recentOpenURL = "http://";
this.recentURL = null;
this.recentSimulation = "tylenol";
Clazz_instantialize(this, arguments);}, JSV.common, "JSViewer", null, [J.api.PlatformViewer, javajs.api.BytePoster]);
Clazz_prepareFields (c$, function(){
this.irMode = JSV.common.Spectrum.IRMode.NO_CONVERT;
});
Clazz_makeConstructor(c$, 
function(si, isApplet, isJSApplet, hasDisplay){
this.si = si;
this.isApplet = isApplet;
this.hasDisplay = hasDisplay;
JSV.common.JSViewer.isJS = isApplet && isJSApplet;
var jmol = null;
{
self.Jmol && (jmol = Jmol);
}JSV.common.JSViewer.jsmolObject = jmol;
this.isSigned = si.isSigned();
this.apiPlatform = this.getPlatformInterface("Platform");
this.apiPlatform.setViewer(this, this.display);
this.g2d = this.getPlatformInterface("G2D");
this.spectraTree =  new JSV.tree.SimpleTree(this);
this.parameters = this.getPlatformInterface("Parameters");
this.parameters.setName("applet");
this.fileHelper = (this.getPlatformInterface("FileHelper")).set(this);
this.isSingleThreaded = this.apiPlatform.isSingleThreaded();
this.panelNodes =  new JU.Lst();
this.repaintManager =  new JSV.common.RepaintManager(this);
if (!isApplet) this.setPopupMenu(true, true);
}, "JSV.api.ScriptInterface,~B,~B,~B");
Clazz_defineMethod(c$, "setParentFrame", 
function(parentFrame){
this.parentFrame = parentFrame;
}, "javax.swing.JFrame");
Clazz_defineMethod(c$, "setProperty", 
function(key, value){
if (this.properties != null) this.properties.setProperty(key, value);
}, "~S,~S");
Clazz_defineMethod(c$, "setNode", 
function(node){
if (node.jsvp !== this.selectedPanel) this.si.siSetSelectedPanel(node.jsvp);
this.si.siSendPanelChange();
this.si.siNodeSet(node);
}, "JSV.common.PanelNode");
Clazz_defineMethod(c$, "setPopupMenu", 
function(allowMenu, zoomEnabled){
this.popupAllowMenu = allowMenu;
this.popupZoomEnabled = zoomEnabled;
}, "~B,~B");
Clazz_defineMethod(c$, "showMenu", 
function(x, y){
if (!this.popupAllowMenu) return;
if (this.jsvpPopupMenu == null) {
try {
this.jsvpPopupMenu = this.getPlatformInterface("Popup");
this.jsvpPopupMenu.jpiInitialize(this, this.isApplet ? "appletMenu" : "appMenu");
this.jsvpPopupMenu.setEnabled(this.popupAllowMenu, this.popupZoomEnabled);
} catch (e) {
if (Clazz_exceptionOf(e, Exception)){
JU.Logger.error(e + " initializing popup menu");
return;
} else {
throw e;
}
}
}this.jsvpPopupMenu.jpiShow(x, y);
}, "~N,~N");
Clazz_defineMethod(c$, "runScriptNow", 
function(script){
System.out.println(this.checkScript(script));
var pt = script.indexOf("JSpecView:");
if (pt >= 0) script = script.substring(pt + 10);
this.scriptLevelCount++;
if (script == null) script = "";
script = script.trim();
if (script.startsWith("!")) script = script.substring(1).trim();
 else if (script.startsWith(">")) {
JU.Logger.error(script);
return true;
}if (script.indexOf("<PeakData") >= 0) {
this.syncScript(script);
return true;
}JU.Logger.info("RUNSCRIPT " + script);
var isOK = true;
var nErrorsLeft = 10;
var commandTokens =  new JSV.common.ScriptTokenizer(script, true);
var msg = null;
while (commandTokens != null && commandTokens.hasMoreTokens() && nErrorsLeft > 0 && isOK) {
var token = commandTokens.nextToken();
var eachParam =  new JSV.common.ScriptTokenizer(token, false);
var key = JSV.common.ScriptToken.getKey(eachParam);
if (key == null) continue;
var st = JSV.common.ScriptToken.getScriptToken(key);
var value = JSV.common.ScriptToken.getValue(st, eachParam, token);
try {
switch (st) {
case JSV.common.ScriptToken.UNKNOWN:
JU.Logger.info("Unrecognized parameter: " + key);
--nErrorsLeft;
break;
default:
if (this.selectedPanel == null) break;
this.parameters.set(this.pd(), st, value);
this.si.siUpdateBoolean(st, JSV.common.Parameters.isTrue(value));
break;
case JSV.common.ScriptToken.PEAKCALLBACKFUNCTIONNAME:
case JSV.common.ScriptToken.SYNCCALLBACKFUNCTIONNAME:
case JSV.common.ScriptToken.COORDCALLBACKFUNCTIONNAME:
case JSV.common.ScriptToken.LOADFILECALLBACKFUNCTIONNAME:
this.si.siExecSetCallback(st, value);
break;
case JSV.common.ScriptToken.DEFAULTLOADSCRIPT:
value = JU.PT.rep(value, "''", "\"");
this.defaultLoadScript = (value.length > 0 ? value : null);
break;
case JSV.common.ScriptToken.DEFAULTNMRNORMALIZATION:
this.nmrMaxY = JU.PT.parseFloat(value);
break;
case JSV.common.ScriptToken.AUTOINTEGRATE:
this.autoIntegrate = JSV.common.Parameters.isTrue(value);
break;
case JSV.common.ScriptToken.CLOSE:
this.execClose(value);
break;
case JSV.common.ScriptToken.DEBUG:
JU.Logger.setLogLevel(value.toLowerCase().equals("high") ? 6 : JSV.common.Parameters.isTrue(value) ? 5 : 4);
break;
case JSV.common.ScriptToken.GETPROPERTY:
var info = (this.selectedPanel == null ? null : this.getPropertyAsJavaObject(value));
if (info != null) this.selectedPanel.showMessage(JU.PT.toJSON(null, info), value);
break;
case JSV.common.ScriptToken.HELP:
this.execHelp(value);
break;
case JSV.common.ScriptToken.HIDDEN:
this.si.siExecHidden(JSV.common.Parameters.isTrue(value));
break;
case JSV.common.ScriptToken.INTEGRATIONRATIOS:
this.integrationRatios = value;
this.execIntegrate(null);
break;
case JSV.common.ScriptToken.INTERFACE:
this.interfaceOverlaid = this.checkOvelayInterface(value);
break;
case JSV.common.ScriptToken.INTEGRALOFFSET:
case JSV.common.ScriptToken.INTEGRALRANGE:
this.execSetIntegralParameter(st, Double.parseDouble(value));
break;
case JSV.common.ScriptToken.INVERTY:
this.execZoom("invertY");
break;
case JSV.common.ScriptToken.JMOL:
this.syncToJmol(value);
break;
case JSV.common.ScriptToken.JSV:
this.syncScript(JU.PT.trimQuotes(value));
break;
case JSV.common.ScriptToken.LOAD:
if (value.length == 0) {
if (this.defaultLoadScript != null) this.runScriptNow(this.defaultLoadScript);
break;
}this.execLoad(value, (this.defaultLoadScript == null ? "" : this.defaultLoadScript + ";") + commandTokens.getRemainingScript());
msg = (this.selectedPanel == null ? null : this.si.siLoaded(value));
commandTokens = null;
break;
case JSV.common.ScriptToken.LOADIMAGINARY:
this.loadImaginary = JSV.common.Parameters.isTrue(value);
break;
case JSV.common.ScriptToken.PEAK:
this.execPeak(value);
break;
case JSV.common.ScriptToken.PEAKLIST:
this.execPeakList(value);
break;
case JSV.common.ScriptToken.SCALEBY:
this.scaleSelectedBy(this.panelNodes, value);
break;
case JSV.common.ScriptToken.SCRIPT:
if (value.equals("") || value.toLowerCase().startsWith("inline")) {
this.execScriptInline(value);
} else {
var s = JSV.common.JSVFileManager.getFileAsString(value);
if (s != null && this.scriptLevelCount < 100) this.runScriptNow(s);
}break;
case JSV.common.ScriptToken.SELECT:
this.execSelect(value);
break;
case JSV.common.ScriptToken.SPECTRUM:
case JSV.common.ScriptToken.SPECTRUMNUMBER:
if (!this.setSpectrum(value)) isOK = false;
break;
case JSV.common.ScriptToken.STACKOFFSETY:
this.execOverlayOffsetY(JU.PT.parseInt("" + JU.PT.parseFloat(value)));
break;
case JSV.common.ScriptToken.TEST:
this.si.siExecTest(value);
break;
case JSV.common.ScriptToken.OVERLAY:
case JSV.common.ScriptToken.VIEW:
this.execView(value, true);
break;
case JSV.common.ScriptToken.HIGHLIGHT:
isOK = this.highlight(token);
break;
case JSV.common.ScriptToken.FINDX:
case JSV.common.ScriptToken.GETSOLUTIONCOLOR:
case JSV.common.ScriptToken.INTEGRATION:
case JSV.common.ScriptToken.INTEGRATE:
case JSV.common.ScriptToken.IRMODE:
case JSV.common.ScriptToken.LABEL:
case JSV.common.ScriptToken.LINK:
case JSV.common.ScriptToken.OVERLAYSTACKED:
case JSV.common.ScriptToken.PRINT:
case JSV.common.ScriptToken.SETPEAK:
case JSV.common.ScriptToken.SETX:
case JSV.common.ScriptToken.SHIFTX:
case JSV.common.ScriptToken.SHOWERRORS:
case JSV.common.ScriptToken.SHOWMEASUREMENTS:
case JSV.common.ScriptToken.SHOWMENU:
case JSV.common.ScriptToken.SHOWPEAKLIST:
case JSV.common.ScriptToken.SHOWINTEGRATION:
case JSV.common.ScriptToken.SHOWPROPERTIES:
case JSV.common.ScriptToken.SHOWSOURCE:
case JSV.common.ScriptToken.YSCALE:
case JSV.common.ScriptToken.WRITE:
case JSV.common.ScriptToken.ZOOM:
if (this.isClosed()) {
isOK = false;
break;
}switch (st) {
default:
break;
case JSV.common.ScriptToken.FINDX:
this.pd().findX(null, Double.parseDouble(value));
break;
case JSV.common.ScriptToken.GETSOLUTIONCOLOR:
this.show("solutioncolor" + value.toLowerCase());
break;
case JSV.common.ScriptToken.INTEGRATION:
case JSV.common.ScriptToken.INTEGRATE:
this.execIntegrate(value);
break;
case JSV.common.ScriptToken.IRMODE:
this.execIRMode(value);
break;
case JSV.common.ScriptToken.LABEL:
this.pd().addAnnotation(JSV.common.ScriptToken.getTokens(value));
break;
case JSV.common.ScriptToken.LINK:
this.pd().linkSpectra(JSV.common.PanelData.LinkMode.getMode(value));
break;
case JSV.common.ScriptToken.OVERLAYSTACKED:
this.pd().splitStack(!JSV.common.Parameters.isTrue(value));
break;
case JSV.common.ScriptToken.PRINT:
msg = this.execWrite(null);
break;
case JSV.common.ScriptToken.SETPEAK:
case JSV.common.ScriptToken.SETX:
case JSV.common.ScriptToken.SHIFTX:
this.execShiftSpectrum(st, token);
break;
case JSV.common.ScriptToken.SHOWERRORS:
this.show("errors");
break;
case JSV.common.ScriptToken.SHOWINTEGRATION:
this.pd().showAnnotation(JSV.common.Annotation.AType.Integration, JSV.common.Parameters.getTFToggle(value));
break;
case JSV.common.ScriptToken.SHOWMEASUREMENTS:
this.pd().showAnnotation(JSV.common.Annotation.AType.Measurements, JSV.common.Parameters.getTFToggle(value));
break;
case JSV.common.ScriptToken.SHOWMENU:
this.showMenu(-2147483648, 0);
break;
case JSV.common.ScriptToken.SHOWPEAKLIST:
this.pd().showAnnotation(JSV.common.Annotation.AType.PeakList, JSV.common.Parameters.getTFToggle(value));
break;
case JSV.common.ScriptToken.SHOWPROPERTIES:
this.show("properties");
break;
case JSV.common.ScriptToken.SHOWSOURCE:
this.show("source");
break;
case JSV.common.ScriptToken.YSCALE:
this.setYScale(value);
break;
case JSV.common.ScriptToken.WINDOW:
this.si.siNewWindow(JSV.common.Parameters.isTrue(value), false);
break;
case JSV.common.ScriptToken.WRITE:
msg = this.execWrite(value);
break;
case JSV.common.ScriptToken.ZOOM:
isOK = this.execZoom(value);
break;
}
break;
}
} catch (e) {
if (Clazz_exceptionOf(e, Exception)){
msg = e.toString();
JU.Logger.error(e.toString());
isOK = false;
--nErrorsLeft;
} else {
throw e;
}
}
}
this.scriptLevelCount--;
this.si.siExecScriptComplete(msg, true);
return isOK;
}, "~S");
Clazz_defineMethod(c$, "execShiftSpectrum", 
function(st, script){
var tokens = JSV.common.ScriptToken.getTokens(script);
var xOld = NaN;
var xNew = NaN;
switch (tokens.size()) {
case 2:
var value = tokens.get(1);
if (value.equals("")) value = "?";
xNew = value.equalsIgnoreCase("NONE") ? 1.7976931348623157E308 : value.equalsIgnoreCase("?") ? NaN : Double.parseDouble(value);
break;
case 3:
xOld = Double.parseDouble(tokens.get(1));
xNew = Double.parseDouble(tokens.get(2));
break;
default:
Double.parseDouble("");
}
var mode = 0;
switch (st) {
case JSV.common.ScriptToken.SETPEAK:
mode = 1;
break;
case JSV.common.ScriptToken.SETX:
mode = 2;
break;
case JSV.common.ScriptToken.SHIFTX:
mode = 3;
if (Double.isNaN(xNew)) Double.parseDouble("");
break;
default:
return;
}
this.pd().shiftSpectrum(mode, xOld, xNew);
}, "JSV.common.ScriptToken,~S");
Clazz_defineMethod(c$, "execClose", 
function(value){
var fromScript = (!value.startsWith("!"));
if (!fromScript) value = value.substring(1);
this.close(JU.PT.trimQuotes(value));
if (!fromScript || this.panelNodes.size() == 0) this.si.siValidateAndRepaint(true);
}, "~S");
Clazz_defineMethod(c$, "checkOvelayInterface", 
function(value){
return (value.equalsIgnoreCase("single") || value.equalsIgnoreCase("overlay"));
}, "~S");
Clazz_defineMethod(c$, "execPeak", 
function(value){
try {
var tokens = JSV.common.ScriptToken.getTokens(JU.PT.rep(value, "#", "INDEX="));
value = " type=\"" + tokens.get(0).toUpperCase() + "\" _match=\"" + JU.PT.trimQuotes(tokens.get(1).toUpperCase()) + "\"";
if (tokens.size() > 2 && tokens.get(2).equalsIgnoreCase("all")) value += " title=\"ALL\"";
this.processPeakPickEvent( new JSV.common.PeakInfo(value), false);
} catch (e) {
if (Clazz_exceptionOf(e, Exception)){
} else {
throw e;
}
}
}, "~S");
Clazz_defineMethod(c$, "execPeakList", 
function(value){
var p = this.parameters;
var b = JSV.common.Parameters.getTFToggle(value);
if (value.indexOf("=") < 0) {
if (!this.isClosed()) this.pd().getPeakListing(null, b);
} else {
var tokens = JSV.common.ScriptToken.getTokens(value);
var threshold = p.peakListThreshold;
var interp = p.peakListInterpolation;
try {
for (var i = tokens.size(); --i >= 0; ) {
var token = tokens.get(i);
var pt = token.indexOf("=");
if (pt <= 0) continue;
var key = token.substring(0, pt);
value = token.substring(pt + 1);
if (key.startsWith("thr")) {
threshold = Double.$valueOf(value).doubleValue();
} else if (key.startsWith("int")) {
interp = (value.equalsIgnoreCase("none") ? "NONE" : "parabolic");
}}
p.peakListThreshold = threshold;
p.peakListInterpolation = interp;
if (!this.isClosed()) this.pd().getPeakListing(p, Boolean.TRUE);
} catch (e) {
if (Clazz_exceptionOf(e, Exception)){
} else {
throw e;
}
}
}}, "~S");
Clazz_defineMethod(c$, "highlight", 
function(value){
var tokens = JSV.common.ScriptToken.getTokens(value);
var n = tokens.size();
switch (n) {
case 3:
case 5:
case 6:
case 7:
break;
case 2:
case 4:
if (tokens.get(n - 1).equalsIgnoreCase("OFF")) break;
default:
return false;
}
if (!this.isClosed()) {
var x1 = JU.PT.parseFloat(n > 1 ? tokens.get(1) : "");
var x2 = JU.PT.parseFloat(n > 2 ? tokens.get(2) : "");
var r = this.getRGB(n > 3 ? tokens.get(3) : "100");
var g = this.getRGB(n > 4 ? tokens.get(4) : "100");
var b = this.getRGB(n > 5 ? tokens.get(5) : "100");
var a = this.getRGB(n > 6 ? tokens.get(6) : "100");
if (Float.isNaN(x1) || Float.isNaN(x2)) {
this.pd().removeAllHighlights();
} else {
this.pd().removeHighlight(x1, x2);
if (a < 0) a = 150;
if (r >= 0 && g >= 0 && b >= 0) this.pd().addHighlight(null, x1, x2, null, r, g, b, a);
}this.repaint(true);
}return true;
}, "~S");
Clazz_defineMethod(c$, "getRGB", 
function(s){
var f = JU.PT.parseFloat(s);
return Clazz_floatToInt(Float.isNaN(f) ? -1 : f > 1 ? f : f * 255);
}, "~S");
Clazz_defineMethod(c$, "execZoom", 
function(value){
var x1 = 0;
var x2 = 0;
var y1 = 0;
var y2 = 0;
value = JU.PT.rep(value, " - ", " ").$replace(',', ' ');
var tokens = JSV.common.ScriptToken.getTokens(value);
switch (tokens.size()) {
default:
return false;
case 0:
var v = this.pd().getCurrentGraphSet().getCurrentView();
value = Math.round(v.minXOnScale * 100) / 100 + "," + Math.round(v.maxXOnScale * 100) / 100;
value = this.selectedPanel.getInput("Enter zoom range x1 x2", "Zoom", value);
return (value == null || this.execZoom(value));
case 1:
value = tokens.get(0);
if (value.equalsIgnoreCase("next")) {
this.pd().nextView();
} else if (value.toLowerCase().startsWith("prev")) {
this.pd().previousView();
} else if (value.equalsIgnoreCase("out")) {
this.pd().resetView();
} else if (value.equalsIgnoreCase("clear")) {
this.pd().clearAllView();
} else if (value.equalsIgnoreCase("invertY")) {
this.pd().getCurrentGraphSet().invertYAxis();
}return true;
case 2:
x1 = Double.parseDouble(tokens.get(0));
x2 = Double.parseDouble(tokens.get(1));
break;
case 3:
var xy = tokens.get(0);
if (xy.equalsIgnoreCase("X")) {
x1 = Double.parseDouble(tokens.get(1));
x2 = Double.parseDouble(tokens.get(2));
} else if (xy.equalsIgnoreCase("Y")) {
y1 = Double.parseDouble(tokens.get(1));
y2 = Double.parseDouble(tokens.get(2));
}break;
case 4:
x1 = Double.parseDouble(tokens.get(0));
y1 = Double.parseDouble(tokens.get(1));
x2 = Double.parseDouble(tokens.get(2));
y2 = Double.parseDouble(tokens.get(3));
}
this.pd().setZoom(x1, y1, x2, y2);
return true;
}, "~S");
Clazz_defineMethod(c$, "scaleSelectedBy", 
function(nodes, value){
try {
var f = Double.parseDouble(value);
for (var i = nodes.size(); --i >= 0; ) nodes.get(i).pd().scaleSelectedBy(f);

} catch (e) {
if (Clazz_exceptionOf(e, Exception)){
} else {
throw e;
}
}
}, "JU.Lst,~S");
Clazz_defineMethod(c$, "pd", 
function(){
return (this.selectedPanel == null ? null : this.selectedPanel.getPanelData());
});
Clazz_defineMethod(c$, "isClosed", 
function(){
return (this.pd() == null);
});
Clazz_defineMethod(c$, "execSelect", 
function(value){
if (value.startsWith("ID ")) {
if (!this.isClosed()) try {
this.pd().selectSpectrum(null, "ID", JU.PT.trimQuotes(value.substring(3)), true);
} catch (e) {
if (Clazz_exceptionOf(e, Exception)){
} else {
throw e;
}
}
return;
}var isFirst = value.equalsIgnoreCase("first");
var isLast = value.equalsIgnoreCase("last");
if (isFirst || isLast) {
var pd = this.selectedPanel.getPanelData();
var gsets = pd.graphSets;
if (gsets == null || gsets.size() == 0) return;
var gs = gsets.get(isFirst ? 0 : gsets.size() - 1);
pd.setCurrentGraphSet(gs, -1);
return;
}var nodes = this.panelNodes;
for (var i = nodes.size(); --i >= 0; ) nodes.get(i).pd().selectFromEntireSet(-2147483648);

var speclist =  new JU.Lst();
this.fillSpecList(value, speclist, false);
}, "~S");
Clazz_defineMethod(c$, "execView", 
function(value, fromScript){
if (value.equals("")) {
this.checkOverlay();
return;
}var speclist =  new JU.Lst();
var strlist = this.fillSpecList(value, speclist, true);
if (speclist.size() > 0) this.si.siOpenDataOrFile(null, strlist, speclist, strlist, -1, -1, false, null, null);
if (!fromScript) {
this.si.siValidateAndRepaint(false);
}}, "~S,~B");
Clazz_defineMethod(c$, "execIRMode", 
function(value){
var mode = JSV.common.Spectrum.IRMode.getMode(value);
var type = this.pd().getSpectrum().dataType;
for (var i = this.panelNodes.size(); --i >= 0; ) this.panelNodes.get(i).pd().setIRMode(mode, type);

this.setIRmode(value);
}, "~S");
Clazz_defineMethod(c$, "execIntegrate", 
function(value){
if (this.isClosed()) return;
this.pd().checkIntegral(this.parameters, value);
if (this.integrationRatios != null) this.pd().setIntegrationRatios(this.integrationRatios);
this.integrationRatios = null;
this.repaint(true);
}, "~S");
Clazz_defineMethod(c$, "repaint", 
function(andTaintAll){
this.selectedPanel.doRepaint(andTaintAll);
}, "~B");
Clazz_defineMethod(c$, "execSetIntegralParameter", 
function(st, value){
var p = this.parameters;
switch (st) {
case JSV.common.ScriptToken.INTEGRALRANGE:
p.integralRange = value;
break;
case JSV.common.ScriptToken.INTEGRALOFFSET:
p.integralOffset = value;
break;
}
if (!this.isClosed()) this.pd().checkIntegral(this.parameters, "update");
}, "JSV.common.ScriptToken,~N");
Clazz_defineMethod(c$, "setYScale", 
function(value){
var tokens = JSV.common.ScriptToken.getTokens(value);
var pt = 0;
var isAll = false;
if (tokens.size() > 1 && tokens.get(0).equalsIgnoreCase("ALL")) {
isAll = true;
pt++;
}var y1 = Double.parseDouble(tokens.get(pt++));
var y2 = Double.parseDouble(tokens.get(pt));
if (isAll) {
var spec = this.pd().getSpectrum();
for (var i = this.panelNodes.size(); --i >= 0; ) {
var node = this.panelNodes.get(i);
if (node.source !== this.currentSource) continue;
if (JSV.common.Spectrum.areXScalesCompatible(spec, node.getSpectrum(), false, false)) node.pd().setZoom(0, y1, 0, y2);
}
} else {
this.pd().setZoom(0, y1, 0, y2);
}}, "~S");
Clazz_defineMethod(c$, "newStructToJmol", 
function(data){
JU.Logger.info("sending new structure to Jmol:\n" + data);
this.syncToJmol("struct:" + data);
}, "~S");
Clazz_defineMethod(c$, "sendPanelChange", 
function(){
var pd = this.pd();
var spec = pd.getSpectrum();
var pi = spec.getSelectedPeak();
if (pi == null) pi = spec.getModelPeakInfoForAutoSelectOnLoad();
if (pi == null) pi = spec.getBasePeakInfo();
pd.addPeakHighlight(pi);
JU.Logger.info(Thread.currentThread() + "JSViewer sendFrameChange " + this.selectedPanel);
this.notifyJmol(pi);
});
Clazz_defineMethod(c$, "getPropertyAsJavaObject", 
function(key){
var map =  new java.util.Hashtable();
if ("SOURCEID".equalsIgnoreCase(key)) {
map.put(key, (this.pd() == null ? "" : this.pd().getSpectrum().sourceID));
return map;
}if (key != null && key.startsWith("DATA_")) {
map.put(key, "" + JSV.common.JSVFileManager.cacheGet(key.substring(5)));
return map;
}var isAll = false;
if (key != null && key.toUpperCase().startsWith("ALL ") || "all".equalsIgnoreCase(key)) {
key = key.substring(3).trim();
isAll = true;
}if ("".equals(key)) key = null;
if ("NAMES".equalsIgnoreCase(key) || "KEYS".equalsIgnoreCase(key)) key = "";
var map0 = this.pd().getInfo(true, key);
if (!isAll && map0 != null) return map0;
if (map0 != null) map.put("current", map0);
var info =  new JU.Lst();
for (var i = 0; i < this.panelNodes.size(); i++) {
var jsvp = this.panelNodes.get(i).jsvp;
if (jsvp == null) continue;
info.addLast(this.panelNodes.get(i).getInfo(key));
}
map.put("items", info);
return map;
}, "~S");
Clazz_defineMethod(c$, "getCoordinate", 
function(){
if (!this.isClosed()) {
var coord = this.pd().getClickedCoordinate();
if (coord != null) return coord.getXVal() + " " + coord.getYVal();
}return "";
});
Clazz_defineMethod(c$, "fillSpecList", 
function(value, speclist, isView){
var prefix = "1.";
var list;
var list0 = null;
var isNone = (value.equalsIgnoreCase("NONE"));
if (isNone || value.equalsIgnoreCase("all")) value = "*";
if (value.indexOf("*") < 0) {
var tokens = value.$plit(" ");
var sb =  new JU.SB();
for (var i = 0; i < tokens.length; i++) {
var pt = tokens[i].indexOf('.');
if (pt != tokens[i].lastIndexOf('.')) tokens[i] = tokens[i].substring(0, pt + 1) + tokens[i].substring(pt + 1).$replace('.', '_');
sb.append(tokens[i]).append(" ");
}
value = sb.toString().trim();
}if (value.equals("*")) {
list = JSV.common.ScriptToken.getTokens(JSV.common.PanelNode.getSpectrumListAsString(this.panelNodes));
} else if (value.startsWith("\"") || value.startsWith("'")) {
list = JSV.common.ScriptToken.getTokens(value);
} else {
value = JU.PT.rep(value, "_", " _ ");
value = JU.PT.rep(value, "-", " - ");
list = JSV.common.ScriptToken.getTokens(value);
list0 = JSV.common.ScriptToken.getTokens(JSV.common.PanelNode.getSpectrumListAsString(this.panelNodes));
if (list0.size() == 0) return null;
}var id0 = (this.isClosed() ? prefix : JSV.common.PanelNode.findNode(this.selectedPanel, this.panelNodes).id);
id0 = id0.substring(0, id0.indexOf(".") + 1);
var sb =  new JU.SB();
var n = list.size();
var idLast = null;
for (var i = 0; i < n; i++) {
var id = list.get(i);
var userYFactor = NaN;
var isubspec = -1;
if (i + 1 < n && list.get(i + 1).equals("*")) {
i += 2;
userYFactor = Double.parseDouble(list.get(i));
} else if (i + 1 < n && list.get(i + 1).equals("_")) {
i += 2;
isubspec = Integer.parseInt(list.get(i));
}if (id.equals("-")) {
if (idLast == null) idLast = list0.get(0);
id = (i + 1 == n ? list0.get(list0.size() - 1) : list.get(++i));
if (!id.contains(".")) id = id0 + id;
var pt = 0;
while (pt < list0.size() && !list0.get(pt).equals(idLast)) pt++;

pt++;
while (pt < list0.size() && !idLast.equals(id)) {
var node = JSV.common.PanelNode.findNodeById((idLast = list0.get(pt++)), this.panelNodes);
speclist.addLast(node.pd().getSpectrumAt(0));
sb.append(",").append(idLast);
}
continue;
}var node;
if (id.startsWith("'") && id.endsWith("'")) id = "\"" + JU.PT.trim(id, "'") + "\"";
if (id.startsWith("\"")) {
id = JU.PT.trim(id, "\"");
var pn = this.panelNodes.size();
for (var j = 0; j < pn; j++) {
node = this.panelNodes.get(j);
if (node.fileName != null && node.fileName.startsWith(id) || node.frameTitle != null && node.frameTitle.startsWith(id)) {
this.addSpecToList(node.pd(), userYFactor, -1, speclist, isView);
sb.append(",").append(node.id);
}}
continue;
}if (!id.contains(".")) id = id0 + id;
node = JSV.common.PanelNode.findNodeById(id, this.panelNodes);
if (node == null) continue;
idLast = id;
this.addSpecToList(node.pd(), userYFactor, isubspec, speclist, isView);
sb.append(",").append(id);
if (isubspec > 0) sb.append(".").appendI(isubspec);
}
if (isView && speclist.size() > 0) {
var node = JSV.common.PanelNode.findNodeById(sb.substring(1), this.panelNodes);
if (node != null) {
this.setNode(node);
speclist.clear();
}}return (isNone ? "NONE" : sb.length() > 0 ? sb.toString().substring(1) : null);
}, "~S,JU.Lst,~B");
Clazz_defineMethod(c$, "addSpecToList", 
function(pd, userYFactor, isubspec, list, isView){
if (isView) {
var spec = pd.getSpectrumAt(0);
spec.setUserYFactor(Double.isNaN(userYFactor) ? 1 : userYFactor);
pd.addToList(isubspec - 1, list);
} else {
pd.selectFromEntireSet(isubspec - 1);
}}, "JSV.common.PanelData,~N,~N,JU.Lst,~B");
Clazz_defineMethod(c$, "getSolutionColor", 
function(asFitted){
var spectrum = this.pd().getSpectrum();
var vi = (spectrum.canShowSolutionColor() ? JSV.common.JSViewer.getInterface("JSV.common.Visible") : null);
return (vi == null ? -1 : vi.getColour(spectrum, asFitted));
}, "~B");
Clazz_defineMethod(c$, "openDataOrFile", 
function(data, name, specs, strUrl, firstSpec, lastSpec, isAppend, id){
if ("NONE".equals(name)) {
this.close("View*");
return 0;
}this.si.writeStatus("");
var filePath = null;
var newPath = null;
var fileName = null;
var isView = false;
if (strUrl != null && strUrl.startsWith("cache://")) {
{
data = Jmol.Cache.get(name = strUrl);
}}var file = null;
if (data != null) {
try {
fileName = name;
newPath = filePath = JSV.common.JSVFileManager.getFullPathName(name);
} catch (e) {
if (Clazz_exceptionOf(e,"JSV.exception.JSVException")){
} else {
throw e;
}
}
} else if (specs != null) {
isView = true;
newPath = fileName = filePath = "View" + (++this.nViews);
} else if (strUrl != null) {
try {
file = this.apiPlatform.newFile(strUrl);
var u =  new java.net.URL(JSV.common.JSVFileManager.appletDocumentBase, strUrl, null);
filePath = u.toString();
this.recentURL = filePath;
fileName = JSV.common.JSVFileManager.getTagName(filePath);
} catch (e) {
if (Clazz_exceptionOf(e,"java.net.MalformedURLException")){
fileName = file.getName();
newPath = filePath = file.getFullPath();
this.recentURL = null;
} else {
throw e;
}
}
}var pt = -1;
if ((pt = JSV.common.PanelNode.isOpen(this.panelNodes, filePath)) >= 0 || (pt = JSV.common.PanelNode.isOpen(this.panelNodes, strUrl)) >= 0) {
if (isView) {
--this.nViews;
this.setNode(this.panelNodes.get(pt));
} else {
this.si.writeStatus(filePath + " is already open");
}return -1;
}if (!isAppend && !isView) this.close("all");
this.si.setCursor(3);
try {
this.si.siSetCurrentSource(isView ? JSV.source.JDXSource.createView(specs) : JSV.source.JDXReader.createJDXSource(file, data, filePath, this.obscureTitleFromUser === Boolean.TRUE, this.loadImaginary, firstSpec, lastSpec, this.nmrMaxY));
} catch (e) {
if (Clazz_exceptionOf(e, Exception)){
{
alert(e.toString())
}this.si.setCursor(0);
if (this.isApplet) {
this.selectedPanel.showMessage(e.toString(), "Error Opening File");
}return -3;
} else {
throw e;
}
}
this.si.setCursor(0);
System.gc();
if (newPath == null) {
newPath = this.currentSource.getFilePath();
if (newPath != null) fileName = newPath.substring(newPath.lastIndexOf("/") + 1);
} else {
this.currentSource.setFilePath(newPath);
}if (id == null && !isView) id = newPath;
if (id != null) this.currentSource.setID(id);
this.si.siSetLoaded(fileName, newPath);
var spec = this.currentSource.getJDXSpectrum(0);
if (spec == null) {
return -4;
}specs = this.currentSource.getSpectra();
JSV.common.Spectrum.process(specs, this.irMode);
var autoOverlay = this.interfaceOverlaid || spec.isAutoOverlayFromJmolClick();
var combine = isView || autoOverlay && this.currentSource.isCompoundSource;
if (combine) {
this.combineSpectra((isView ? strUrl : null));
} else {
this.splitSpectra();
}this.pd().setTaintedAll();
if (!isView) this.si.siUpdateRecentMenus(filePath);
return 0;
}, "~O,~S,JU.Lst,~S,~N,~N,~B,~S");
Clazz_defineMethod(c$, "close", 
function(value){
var n0 = 0;
var pt = (value == null ? -2 : value.indexOf(">"));
if (pt > 0) {
n0 = JU.PT.parseInt(value.substring(pt + 1).trim());
value = value.substring(0, pt).trim();
}if ("*".equals(value)) value = "all";
var isAll = (value === "all");
if (value == null || n0 == 0 && value.equalsIgnoreCase("all")) {
this.closeSource(null);
return;
}var isViews = value.equalsIgnoreCase("views");
var list =  new JU.Lst();
var source;
value = value.$replace('\\', '/');
var n = this.panelNodes.size();
var nMax = n - n0;
if (value.endsWith("*")) {
value = value.substring(0, value.length - 1);
for (var i = n; --i >= 0; ) if (this.panelNodes.get(i).fileName.startsWith(value)) list.addLast(this.panelNodes.get(i).source);

} else if (value.equalsIgnoreCase("selected")) {
var lastSource = null;
for (var i = n; --i >= 0; ) {
source = this.panelNodes.get(i).source;
if (this.panelNodes.get(i).isSelected && (lastSource == null || lastSource !== source)) list.addLast(source);
lastSource = source;
}
} else if (isAll || isViews || value.equalsIgnoreCase("simulations")) {
for (var n1 = 0, i = n; --i >= 0 && n1 < nMax; ) if (isAll ? true : isViews ? this.panelNodes.get(i).isView : this.panelNodes.get(i).isSimulation) {
list.addLast(this.panelNodes.get(i).source);
n1++;
}
} else {
source = (value.length == 0 ? this.currentSource : JSV.common.PanelNode.findSourceByNameOrId(value, this.panelNodes));
if (source != null) list.addLast(source);
}for (var i = list.size(); --i >= 0; ) this.closeSource(list.get(i));

if (this.selectedPanel == null && this.panelNodes.size() > 0) this.si.siSetSelectedPanel(JSV.common.PanelNode.getLastFileFirstNode(this.panelNodes));
}, "~S");
Clazz_defineMethod(c$, "execLoad", 
function(value, script){
var applet = this.html5Applet;
var isID = false;
if (isID) {
applet._search(value);
return;
}var tokens = JSV.common.ScriptToken.getTokens(value);
var filename = tokens.get(0);
var id = null;
var pt = 0;
if (filename.equalsIgnoreCase("ID")) {
id = JU.PT.trimQuotes(tokens.get(1));
filename = tokens.get(2);
pt = 2;
}var isAppend = filename.equalsIgnoreCase("APPEND");
if (isAppend) {
pt++;
if (pt > 0) filename = tokens.get(pt);
}var isCheck = filename.equalsIgnoreCase("CHECK");
if (isCheck) pt++;
if (pt > 0) filename = tokens.get(pt);
if (script == null) script = this.defaultLoadScript;
if (filename.equals("?")) {
this.openFileFromDialog(isAppend, false, null, script);
return;
}if (filename.equals("http://?")) {
this.openFileFromDialog(isAppend, true, null, null);
return;
}if (filename.equals("$?") || filename.equals("$H1?")) {
this.openFileFromDialog(isAppend, true, "H1", null);
return;
}if (filename.equals("$C13?")) {
this.openFileFromDialog(isAppend, true, "C13", null);
return;
}var isH1 = filename.equalsIgnoreCase("MOL") || filename.equalsIgnoreCase("H1");
var isC13 = filename.equalsIgnoreCase("C13");
if (isH1 || isC13) filename = "http://SIMULATION/" + (isH1 ? "H1/" : "C13/") + "MOL=" + JU.PT.trimQuotes(tokens.get(++pt));
if (!isCheck && !isAppend) {
if (filename.equals("\"\"") && this.currentSource != null) filename = this.currentSource.getFilePath();
this.close("all");
}filename = JU.PT.trimQuotes(filename);
var isSimulation = filename.startsWith("$");
if (isSimulation) {
if (!filename.startsWith("$H1") && !filename.startsWith("$C13")) filename = "$H1/" + filename.substring(1);
filename = "http://SIMULATION/" + filename.substring(1);
}var firstSpec = (pt + 1 < tokens.size() ? Integer.$valueOf(tokens.get(++pt)).intValue() : -1);
var lastSpec = (pt + 1 < tokens.size() ? Integer.$valueOf(tokens.get(++pt)).intValue() : firstSpec);
this.si.siOpenDataOrFile(null, null, null, filename, firstSpec, lastSpec, isAppend, script, id);
if (isSimulation) {
this.close("views");
this.execView("*", true);
}}, "~S,~S");
Clazz_defineMethod(c$, "combineSpectra", 
function(name){
var source = this.currentSource;
var specs = source.getSpectra();
var haveSimulation = false;
for (var i = specs.size(); --i >= 0; ) if (specs.get(i).isSimulation) {
haveSimulation = true;
break;
}
var jsvp = this.si.siGetNewJSVPanel2(specs);
jsvp.setTitle(source.getTitle());
if (jsvp.getTitle().equals("")) {
jsvp.getPanelData().setViewTitle("");
jsvp.setTitle(name);
}this.si.siSetPropertiesFromPreferences(jsvp, true);
this.spectraTree.createTree(++this.fileCount, source,  Clazz_newArray(-1, [jsvp])).getPanelNode().isView = true;
var node = JSV.common.PanelNode.findNode(this.selectedPanel, this.panelNodes);
node.setFrameTitle(name);
node.isView = true;
if (this.autoShowLegend && this.pd().getNumberOfGraphSets() == 1) node.setLegend(this.getDialog(JSV.common.Annotation.AType.OverlayLegend, null));
this.si.siSetMenuEnables(node, false);
if (haveSimulation) this.pd().splitStack(true);
}, "~S");
Clazz_defineMethod(c$, "closeSource", 
function(source){
var rootNode = this.spectraTree.getRootNode();
var fileName = (source == null ? null : source.getFilePath());
var toDelete =  new JU.Lst();
var enume = rootNode.children();
while (enume.hasMoreElements()) {
var node = enume.nextElement();
if (fileName == null || node.getPanelNode().source.matchesFilePath(fileName)) {
JU.Logger.info("Closing " + node.getPanelNode().source.getFilePath());
for (var e = node.children(); e.hasMoreElements(); ) {
var childNode = e.nextElement();
toDelete.addLast(childNode);
this.panelNodes.removeObj(childNode.getPanelNode());
}
toDelete.addLast(node);
if (fileName != null) break;
}}
this.spectraTree.deleteNodes(toDelete);
if (source == null) {
if (this.currentSource != null) this.currentSource.dispose();
this.currentSource = null;
if (this.selectedPanel != null) this.selectedPanel.dispose();
} else {
}if (this.currentSource === source) {
this.si.siSetSelectedPanel(null);
this.si.siSetCurrentSource(null);
}var max = 0;
for (var i = 0; i < this.panelNodes.size(); i++) {
var f = JU.PT.parseFloat(this.panelNodes.get(i).id);
if (f >= max + 1) max = Clazz_doubleToInt(Math.floor(f));
}
this.fileCount = max;
System.gc();
if (JU.Logger.debugging) JU.Logger.checkMemory();
this.si.siSourceClosed(source);
}, "JSV.source.JDXSource");
Clazz_defineMethod(c$, "setFrameAndTreeNode", 
function(i){
if (this.panelNodes == null || i < 0 || i >= this.panelNodes.size()) return;
this.setNode(this.panelNodes.get(i));
}, "~N");
Clazz_defineMethod(c$, "selectFrameNode", 
function(jsvp){
var node = JSV.common.PanelNode.findNode(jsvp, this.panelNodes);
if (node == null) return null;
this.spectraTree.setPath(this.spectraTree.newTreePath(node.treeNode.getPath()));
return node;
}, "JSV.api.JSVPanel");
Clazz_defineMethod(c$, "setSpectrum", 
function(value){
if (value.indexOf('.') >= 0) {
var node = JSV.common.PanelNode.findNodeById(value, this.panelNodes);
if (node == null) return false;
this.setNode(node);
} else {
var n = JU.PT.parseInt(value);
if (n <= 0) {
this.checkOverlay();
return false;
}this.setFrameAndTreeNode(n - 1);
}return true;
}, "~S");
Clazz_defineMethod(c$, "splitSpectra", 
function(){
var source = this.currentSource;
var specs = source.getSpectra();
var panels =  new Array(specs.size());
var jsvp = null;
for (var i = 0; i < specs.size(); i++) {
var spec = specs.get(i);
jsvp = this.si.siGetNewJSVPanel(spec);
this.si.siSetPropertiesFromPreferences(jsvp, true);
panels[i] = jsvp;
}
this.spectraTree.createTree(++this.fileCount, source, panels);
this.si.siGetNewJSVPanel(null);
var node = JSV.common.PanelNode.findNode(this.selectedPanel, this.panelNodes);
this.si.siSetMenuEnables(node, true);
});
Clazz_defineMethod(c$, "selectedTreeNode", 
function(node){
if (node == null) {
return;
}if (node.isLeaf()) {
this.setNode(node.getPanelNode());
} else {
System.out.println("not a leaf");
}this.si.siSetCurrentSource(node.getPanelNode().source);
}, "JSV.api.JSVTreeNode");
Clazz_defineMethod(c$, "dispose", 
function(){
this.fileHelper = null;
if (this.viewDialog != null) this.viewDialog.dispose();
this.viewDialog = null;
if (this.overlayLegendDialog != null) this.overlayLegendDialog.dispose();
this.overlayLegendDialog = null;
if (this.jsvpPopupMenu != null) {
this.jsvpPopupMenu.jpiDispose();
this.jsvpPopupMenu = null;
}if (this.panelNodes != null) for (var i = this.panelNodes.size(); --i >= 0; ) {
this.panelNodes.get(i).dispose();
this.panelNodes.removeItemAt(i);
}
});
Clazz_defineMethod(c$, "runScript", 
function(script){
if (this.scriptQueue == null) this.si.siProcessCommand(script);
 else this.scriptQueue.addLast(script);
}, "~S");
Clazz_defineMethod(c$, "requestRepaint", 
function(){
if (this.selectedPanel != null) this.repaintManager.refresh();
});
Clazz_defineMethod(c$, "repaintDone", 
function(){
this.repaintManager.repaintDone();
});
Clazz_defineMethod(c$, "checkOverlay", 
function(){
if (this.mainPanel != null) this.markSelectedPanels(this.panelNodes, this.mainPanel.getCurrentPanelIndex());
this.viewDialog = this.getDialog(JSV.common.Annotation.AType.Views, null);
});
Clazz_defineMethod(c$, "markSelectedPanels", 
function(panelNodes, ip){
for (var i = panelNodes.size(); --i >= 0; ) panelNodes.get(i).isSelected = (ip == i);

}, "JU.Lst,~N");
Clazz_defineMethod(c$, "execOverlayOffsetY", 
function(offset){
if (offset == -2147483648) {
if (this.selectedPanel == null) return;
var soffset = this.selectedPanel.getInput("Enter a vertical offset in percent for stacked plots", "Overlay", "" + this.recentStackPercent);
var f = JU.PT.parseFloat(soffset);
if (Float.isNaN(f)) return;
offset = Clazz_floatToInt(f);
}this.recentStackPercent = offset;
this.parameters.viewOffset = offset;
if (this.isClosed()) this.pd().setYStackOffsetPercent(offset);
}, "~N");
Clazz_defineMethod(c$, "execScriptInline", 
function(script){
if (script.length > 0) script = script.substring(6).trim();
if (script.length == 0) script = this.selectedPanel.getInput("Enter a JSpecView script", "Script", this.recentScript);
if (script == null) return;
this.recentScript = script;
this.runScriptNow(script);
}, "~S");
Clazz_defineMethod(c$, "setDisplay", 
function(canvas){
this.apiPlatform.setViewer(this, this.display = canvas);
var wh =  Clazz_newIntArray (2, 0);
this.apiPlatform.getFullScreenDimensions(canvas, wh);
this.setScreenDimension(wh[0], wh[1]);
}, "~O");
Clazz_defineMethod(c$, "setScreenDimension", 
function(width, height){
height = Math.min(height, this.maximumSize);
width = Math.min(width, this.maximumSize);
if (this.screenWidth == width && this.screenHeight == height) return;
this.resizeImage(width, height);
}, "~N,~N");
Clazz_defineMethod(c$, "resizeImage", 
function(width, height){
if (width > 0) {
this.screenWidth = width;
this.screenHeight = height;
} else {
width = (this.screenWidth == 0 ? this.screenWidth = 500 : this.screenWidth);
height = (this.screenHeight == 0 ? this.screenHeight = 500 : this.screenHeight);
}this.g2d.setWindowParameters(width, height);
}, "~N,~N");
Clazz_defineMethod(c$, "updateJS", 
function(){
if (this.selectedPanel != null) this.selectedPanel.paintComponent(this.apiPlatform.getGraphics(null));
});
Clazz_defineMethod(c$, "processMouseEvent", 
function(id, x, y, modifiers, time){
return (this.selectedPanel != null && this.selectedPanel.processMouseEvent(id, x, y, modifiers, time));
}, "~N,~N,~N,~N,~N");
Clazz_defineMethod(c$, "processTwoPointGesture", 
function(touches){
if (!this.isClosed()) this.selectedPanel.processTwoPointGesture(touches);
}, "~A");
Clazz_defineMethod(c$, "processKeyEvent", 
function(event){
if (!this.isClosed()) this.selectedPanel.processKeyEvent(event);
}, "~O");
Clazz_defineMethod(c$, "getApplet", 
function(){
return this.html5Applet;
});
Clazz_defineMethod(c$, "openFileAsyncSpecial", 
function(fileName, flags){
var ans = (this.currentSource == null ? "NO" : this.getDialogManager().getDialogInput(this, "Do you want to append this file? (Answer NO to replace.)", "Drag/Drop Action", 3, null, null, "YES"));
if (ans == null) return;
var pre = (ans.toLowerCase().startsWith("y") ? "append" : "");
var post = (pre === "" ? "" : "; view *");
this.runScript("load " + pre + " \"" + fileName + "\"" + post);
}, "~S,~N");
Clazz_defineMethod(c$, "getHeight", 
function(){
return this.screenHeight;
});
Clazz_defineMethod(c$, "getWidth", 
function(){
return this.screenWidth;
});
Clazz_defineMethod(c$, "getPlatformInterface", 
function(type){
return JSV.common.JSViewer.getInterface("JSV." + (JSV.common.JSViewer.isJS ? "js2d.Js" : "java.Awt") + type);
}, "~S");
Clazz_defineMethod(c$, "getDialogManager", 
function(){
if (this.dialogManager != null) return this.dialogManager;
this.dialogManager = this.getPlatformInterface("DialogManager");
return this.dialogManager.set(this);
});
Clazz_defineMethod(c$, "getDialog", 
function(type, spec){
var root = "JSV.dialog.";
switch (type) {
case JSV.common.Annotation.AType.Integration:
return (JSV.common.JSViewer.getInterface(root + "IntegrationDialog")).setParams("Integration for " + spec, this, spec);
case JSV.common.Annotation.AType.Measurements:
return (JSV.common.JSViewer.getInterface(root + "MeasurementsDialog")).setParams("Measurements for " + spec, this, spec);
case JSV.common.Annotation.AType.PeakList:
return (JSV.common.JSViewer.getInterface(root + "PeakListDialog")).setParams("Peak List for " + spec, this, spec);
case JSV.common.Annotation.AType.OverlayLegend:
return this.overlayLegendDialog = (JSV.common.JSViewer.getInterface(root + "OverlayLegendDialog")).setParams(this.pd().getViewTitle(), this, null);
case JSV.common.Annotation.AType.Views:
return this.viewDialog = (JSV.common.JSViewer.getInterface(root + "ViewsDialog")).setParams("View/Combine/Close Spectra", this, null);
default:
return null;
}
}, "JSV.common.Annotation.AType,JSV.common.Spectrum");
Clazz_defineMethod(c$, "show", 
function(what){
this.getDialogManager();
if (what.equals("properties")) {
this.dialogManager.showProperties(null, this.pd().getSpectrum());
} else if (what.equals("errors")) {
this.dialogManager.showSourceErrors(null, this.currentSource);
} else if (what.equals("source")) {
if (this.currentSource == null) {
if (this.panelNodes.size() > 0) this.dialogManager.showMessageDialog(null, "Please Select a Spectrum", "Select Spectrum", 0);
return;
}this.dialogManager.showSource(this, this.pd().getSpectrum());
} else if (what.startsWith("solutioncolorfill")) {
if (what.indexOf("all") >= 0) {
for (var i = this.panelNodes.size(); --i >= 0; ) this.panelNodes.get(i).pd().setSolutionColor(what);

} else {
this.pd().setSolutionColor(what);
}} else if (what.startsWith("solutioncolor")) {
var msg = this.getSolutionColorStr(what.indexOf("false") < 0);
msg = "background-color:rgb(" + msg + ")'><br />Predicted Solution Colour- RGB(" + msg + ")<br /><br />";
if (JSV.common.JSViewer.isJS) {
this.dialogManager.showMessage(this, "<div style='width:100%;height:100%;" + msg + "</div>", "Predicted Colour");
} else {
this.selectedPanel.showMessage("<html><body style='" + msg + "</body></html>", "Predicted Colour");
}}}, "~S");
Clazz_defineMethod(c$, "getPrintLayout", 
function(isJob){
if (!JSV.common.JSViewer.isJS && this.hasDisplay) try {
var pl = (this.getPlatformInterface("PrintDialog")).set(this.parentFrame, this.lastPrintLayout, isJob).getPrintLayout();
if (pl != null) this.lastPrintLayout = pl;
return pl;
} catch (e) {
if (Clazz_exceptionOf(e, Exception)){
} else {
throw e;
}
}
return  new JSV.common.PrintLayout(this.pd());
}, "~B");
Clazz_defineMethod(c$, "setIRmode", 
function(mode){
if (mode.equals("AtoT")) {
this.irMode = JSV.common.Spectrum.IRMode.TO_TRANS;
} else if (mode.equals("TtoA")) {
this.irMode = JSV.common.Spectrum.IRMode.TO_ABS;
} else {
this.irMode = JSV.common.Spectrum.IRMode.getMode(mode);
}}, "~S");
Clazz_defineMethod(c$, "getOptionFromDialog", 
function(items, title, label){
return this.getDialogManager().getOptionFromDialog(null, items, this.selectedPanel, title, label);
}, "~A,~S,~S");
Clazz_defineMethod(c$, "print", 
function(fileName){
return this.execWrite("PDF \"" + fileName + "\"");
}, "~S");
Clazz_defineMethod(c$, "execWrite", 
function(value){
if (JSV.common.JSViewer.isJS && value == null) value = "PDF";
var msg = (JSV.common.JSViewer.getInterface("JSV.export.Exporter")).write(this, value == null ? null : JSV.common.ScriptToken.getTokens(value), false);
this.si.writeStatus(msg);
return msg;
}, "~S");
Clazz_defineMethod(c$, "$export", 
function(type, n){
if (type == null) type = "XY";
var pd = this.pd();
var nMax = pd.getNumberOfSpectraInCurrentSet();
if (n < -1 || n >= nMax) return "Maximum spectrum index (0-based) is " + (nMax - 1) + ".";
var spec = (n < 0 ? pd.getSpectrum() : pd.getSpectrumAt(n));
try {
return (JSV.common.JSViewer.getInterface("JSV.export.Exporter")).exportTheSpectrum(this, JSV.common.ExportType.getType(type), null, spec, 0, spec.getXYCoords().length - 1, null, type.equalsIgnoreCase("PDF"));
} catch (e) {
if (Clazz_exceptionOf(e, Exception)){
JU.Logger.error(e.toString());
return null;
} else {
throw e;
}
}
}, "~S,~N");
Clazz_overrideMethod(c$, "postByteArray", 
function(fileName, bytes){
return JSV.common.JSVFileManager.postByteArray(fileName, bytes);
}, "~S,~A");
Clazz_defineMethod(c$, "getOutputChannel", 
function(fileName, isBinary){
var os = null;
{
while (fileName.startsWith("/")) fileName =
fileName.substring(1);
}return  new JU.OC().setParams(this, fileName, !isBinary, os);
}, "~S,~B");
c$.getInterface = Clazz_defineMethod(c$, "getInterface", 
function(name){
try {
var x = Clazz._4Name(name);
return (x == null ? null : x.newInstance());
} catch (e) {
if (Clazz_exceptionOf(e, Exception)){
JU.Logger.error("Interface.java Error creating instance for " + name + ": \n" + e);
return null;
} else {
throw e;
}
}
}, "~S");
Clazz_defineMethod(c$, "showMessage", 
function(msg){
if (this.selectedPanel != null && msg != null) this.selectedPanel.showMessage(msg, null);
}, "~S");
Clazz_defineMethod(c$, "openFileFromDialog", 
function(isAppend, isURL, simulationType, script){
var url = null;
if (simulationType != null) {
url = this.fileHelper.getUrlFromDialog("Enter the name or identifier of a compound", this.recentSimulation);
if (url == null) return false;
this.recentSimulation = url;
if (url.equals("<this structure>")) {
if (this.isEmbedded) {
this.syncToJmol("sync . \"" + simulationType + "Simulate:\";");
return true;
}return false;
}url = "$" + simulationType + "/" + url;
} else if (isURL) {
url = this.fileHelper.getUrlFromDialog("Enter the URL of a JCAMP-DX File", this.recentURL == null ? this.recentOpenURL : this.recentURL);
if (url == null) return false;
this.recentOpenURL = url;
} else {
var userData =  Clazz_newArray(-1, [Boolean.$valueOf(isAppend), script]);
var file = (this.hasDisplay ? this.fileHelper.showFileOpenDialog(this.mainPanel, userData) : null);
if (file != null) url = file.getFullPath();
}if (url != null) {
this.runScriptNow("load " + (isAppend ? "APPEND " : "") + "\"" + url + "\"" + (script == null ? "" : ";" + script));
return true;
}return false;
}, "~B,~B,~S,~S");
Clazz_defineMethod(c$, "openFile", 
function(fileName, closeFirst){
if (closeFirst && this.panelNodes != null) {
var source = JSV.common.PanelNode.findSourceByNameOrId(( new java.io.File(fileName)).getAbsolutePath(), this.panelNodes);
if (source != null) this.closeSource(source);
}this.si.siOpenDataOrFile(null, null, null, fileName, -1, -1, true, this.defaultLoadScript, null);
}, "~S,~B");
Clazz_defineMethod(c$, "selectPanel", 
function(jsvp, panelNodes){
var iPanel = -1;
if (panelNodes != null) {
for (var i = panelNodes.size(); --i >= 0; ) {
var j = panelNodes.get(i).jsvp;
if (j === jsvp) {
iPanel = i;
} else {
j.setEnabled(false);
j.setFocusable(false);
j.getPanelData().closeAllDialogsExcept(JSV.common.Annotation.AType.NONE);
}}
this.markSelectedPanels(panelNodes, iPanel);
this.selectedPanel = jsvp;
if (jsvp != null) jsvp.getPanelData().clearMouseSet(null);
}return iPanel;
}, "JSV.api.JSVPanel,JU.Lst");
Clazz_defineMethod(c$, "checkAutoIntegrate", 
function(){
if (this.autoIntegrate) this.pd().integrateAll(this.parameters);
});
Clazz_defineMethod(c$, "parseInitScript", 
function(params){
if (params == null) params = "";
var allParamTokens =  new JSV.common.ScriptTokenizer(params, true);
if (JU.Logger.debugging) {
JU.Logger.info("Running in DEBUG mode");
}while (allParamTokens.hasMoreTokens()) {
var token = allParamTokens.nextToken();
var eachParam =  new JSV.common.ScriptTokenizer(token, false);
var key = eachParam.nextToken();
if (key.equalsIgnoreCase("SET")) key = eachParam.nextToken();
key = key.toUpperCase();
var st = JSV.common.ScriptToken.getScriptToken(key);
var value = JSV.common.ScriptToken.getValue(st, eachParam, token);
JU.Logger.info("KEY-> " + key + " VALUE-> " + value + " : " + st);
try {
switch (st) {
default:
this.parameters.set(null, st, value);
break;
case JSV.common.ScriptToken.UNKNOWN:
break;
case JSV.common.ScriptToken.APPLETID:
this.fullName = this.appletName + "__" + (this.appletName = value) + "__";
var applet = null;
{
self.Jmol && (applet = Jmol._applets[value]);
}this.html5Applet = applet;
break;
case JSV.common.ScriptToken.AUTOINTEGRATE:
this.autoIntegrate = JSV.common.Parameters.isTrue(value);
break;
case JSV.common.ScriptToken.COMPOUNDMENUON:
break;
case JSV.common.ScriptToken.APPLETREADYCALLBACKFUNCTIONNAME:
case JSV.common.ScriptToken.COORDCALLBACKFUNCTIONNAME:
case JSV.common.ScriptToken.LOADFILECALLBACKFUNCTIONNAME:
case JSV.common.ScriptToken.PEAKCALLBACKFUNCTIONNAME:
case JSV.common.ScriptToken.SYNCCALLBACKFUNCTIONNAME:
this.si.siExecSetCallback(st, value);
break;
case JSV.common.ScriptToken.ENDINDEX:
this.initialEndIndex = Integer.parseInt(value);
break;
case JSV.common.ScriptToken.INTERFACE:
this.checkOvelayInterface(value);
break;
case JSV.common.ScriptToken.IRMODE:
this.setIRmode(value);
break;
case JSV.common.ScriptToken.MENUON:
this.allowMenu = Boolean.parseBoolean(value);
break;
case JSV.common.ScriptToken.OBSCURE:
if (this.obscureTitleFromUser == null) this.obscureTitleFromUser = Boolean.$valueOf(value);
break;
case JSV.common.ScriptToken.STARTINDEX:
this.initialStartIndex = Integer.parseInt(value);
break;
case JSV.common.ScriptToken.SYNCID:
this.fullName = this.appletName + "__" + (this.syncID = value) + "__";
break;
}
} catch (e) {
if (Clazz_exceptionOf(e, Exception)){
} else {
throw e;
}
}
}
}, "~S");
Clazz_defineMethod(c$, "getSolutionColorStr", 
function(asFit){
var pt = JU.CU.colorPtFromInt(this.getSolutionColor(asFit), null);
return Clazz_floatToInt(pt.x) + "," + Clazz_floatToInt(pt.y) + "," + Clazz_floatToInt(pt.z);
}, "~B");
Clazz_defineMethod(c$, "checkCommandLineForTip", 
function(c, cmd, oneLineOnly){
var isHelp = (c == '\1');
if (!isHelp && c != '\0') {
if (c != '\t' && (c == '\n' || c.charCodeAt(0) < 32 || c.charCodeAt(0) > 126)) return null;
cmd += (Character.isISOControl(c) ? "" : "" + c);
}var tip;
if (cmd.indexOf(";") >= 0) cmd = cmd.substring(cmd.lastIndexOf(";") + 1);
var ret = null;
while (cmd.startsWith(" ")) cmd = cmd.substring(1);

if (cmd.length == 0 && !isHelp) {
tip = "";
} else {
var tokens = JSV.common.ScriptToken.getTokens(cmd);
if (tokens.size() == 0 && !isHelp) return "";
var isExact = (cmd.endsWith(" ") || tokens.size() > 1 && oneLineOnly);
var list = JSV.common.ScriptToken.getScriptTokenList(tokens.size() == 0 ? null : tokens.get(0), isExact);
switch (list.size()) {
case 0:
tip = "?";
break;
case 1:
var st = list.get(0);
tip = st.getTip();
try {
if (tip.indexOf("TRUE") >= 0) tip = " (" + this.parameters.getBoolean(st) + ")";
 else if (st.name().indexOf("COLOR") >= 0) tip = " (" + JU.CU.toRGBHexString(this.parameters.getElementColor(st)) + ")";
 else tip = "";
} catch (e) {
if (Clazz_exceptionOf(e, Exception)){
return null;
} else {
throw e;
}
}
if (c == '\t' || isExact || !oneLineOnly) {
tip = st.name() + " " + st.getTip() + tip + " " + st.getDescription();
if (c == '\t') ret = st.name() + " ";
break;
}tip = st.name() + " " + tip;
break;
default:
tip = JSV.common.ScriptToken.getNameList(list);
}
}if (oneLineOnly) {
this.si.writeStatus(tip);
} else {
ret = tip;
}return ret;
}, "~S,~S,~B");
Clazz_defineMethod(c$, "checkScript", 
function(script){
return this.checkCommandLineForTip('\0', script, false);
}, "~S");
Clazz_defineMethod(c$, "execHelp", 
function(value){
var s = this.checkCommandLineForTip('\1', value, false);
if (s.indexOf(" ") < 0 && s.indexOf(",") > 0) {
var tokens = JU.PT.split(s, ",");
java.util.Arrays.sort(tokens);
s = "";
for (var i = 0; i < tokens.length; i++) {
var st = JSV.common.ScriptToken.getScriptToken(tokens[i]);
s += tokens[i] + " " + st.getTip() + "\n  " + st.getDescription() + "\n\n";
}
this.getDialogManager().showMessage(null, s, "HELP " + value);
} else {
this.selectedPanel.showMessage(s, "Help " + value);
}System.out.println(s);
}, "~S");
Clazz_defineMethod(c$, "setRecentSimulation", 
function(name){
if (name == null) name = "<this structure>";
this.recentSimulation = name;
}, "~S");
Clazz_defineMethod(c$, "setCreatingImage", 
function(isSaving){
this.pd().creatingImage = isSaving;
}, "~B");
Clazz_defineMethod(c$, "checkFileAlreadyLoaded", 
function(fileName){
if (this.isClosed()) return false;
if (this.pd().hasFileLoaded(fileName)) return true;
for (var i = this.panelNodes.size(); --i >= 0; ) if (this.panelNodes.get(i).pd().hasFileLoaded(fileName)) {
this.si.siSetSelectedPanel(this.panelNodes.get(i).jsvp);
return true;
}
return false;
}, "~S");
Clazz_defineMethod(c$, "advanceSpectrumBy", 
function(n){
var i = this.panelNodes.size();
for (; --i >= 0; ) if (this.panelNodes.get(i).jsvp === this.selectedPanel) break;

this.setFrameAndTreeNode(i + n);
this.selectedPanel.getFocusNow(false);
}, "~N");
Clazz_defineMethod(c$, "processPeakPickEvent", 
function(eventObj, isApp){
var pi;
if (Clazz_instanceOf(eventObj,"JSV.common.PeakInfo")) {
pi = eventObj;
var pi2 = this.pd().findMatchingPeakInfo(pi);
if (pi2 == null) {
if (!"ALL".equals(pi.getTitle())) return;
var node = null;
for (var i = 0; i < this.panelNodes.size(); i++) if ((pi2 = this.panelNodes.get(i).pd().findMatchingPeakInfo(pi)) != null) {
node = this.panelNodes.get(i);
break;
}
if (node == null) return;
this.setNode(node);
}pi = pi2;
} else {
var e = (eventObj);
this.si.siSetSelectedPanel(e.getSource());
pi = e.getPeakInfo();
}this.pd().addPeakHighlight(pi);
this.notifyJmol(pi);
if (pi.isClearAll()) this.repaint(false);
 else this.pd().selectSpectrum(pi.getFilePath(), pi.getType(), pi.getModel(), true);
this.si.siCheckCallbacks(pi.getTitle());
}, "~O,~B");
Clazz_defineMethod(c$, "syncScript", 
function(peakScript){
JSV.common.SyncManager.syncFromJmol(this, peakScript);
}, "~S");
Clazz_defineMethod(c$, "syncToJmol", 
function(msg){
this.si.syncToJmol(msg);
}, "~S");
Clazz_defineMethod(c$, "notifyJmol", 
function(pi){
this.repaint(true);
JSV.common.SyncManager.syncToJmol(this, pi);
}, "JSV.common.PeakInfo");
c$.isJS = false;
c$.isSwingJS = false;
c$.jsmolObject = null;
});
;//5.0.1-v7 Mon Aug 17 10:07:10 MDT 2026
Clazz_declarePackage("JSV.common");
Clazz_load(["JSV.common.Annotation", "$.Coordinate"], "JSV.common.Measurement", null, function(){
var c$ = Clazz_decorateAsClass(function(){
this.pt2 = null;
this.value = 0;
Clazz_instantialize(this, arguments);}, JSV.common, "Measurement", JSV.common.Annotation);
Clazz_prepareFields (c$, function(){
this.pt2 =  new JSV.common.Coordinate();
});
Clazz_defineMethod(c$, "setM1", 
function(x, y, spec){
this.setA(x, y, spec, "", false, false, 0, 6);
this.setPt2(this.getXVal(), this.getYVal());
return this;
}, "~N,~N,JSV.common.Spectrum");
Clazz_defineMethod(c$, "copyM", 
function(){
var m =  new JSV.common.Measurement();
m.setA(this.getXVal(), this.getYVal(), this.spec, this.text, false, false, this.offsetX, this.offsetY);
m.setPt2(this.pt2.getXVal(), this.pt2.getYVal());
return m;
});
Clazz_defineMethod(c$, "setPt2", 
function(spec, doSetPt2){
this.spec = spec;
if (doSetPt2) this.setPt2(this.getXVal(), this.getYVal());
return this;
}, "JSV.common.Spectrum,~B");
Clazz_defineMethod(c$, "setPt2", 
function(x, y){
this.pt2.setXVal(x);
this.pt2.setYVal(y);
this.value = Math.abs(x - this.getXVal());
this.text = this.spec.setMeasurementText(this);
}, "~N,~N");
Clazz_defineMethod(c$, "getSpectrum", 
function(){
return this.spec;
});
Clazz_defineMethod(c$, "setValue", 
function(value){
this.value = value;
this.text = this.spec.setMeasurementText(this);
}, "~N");
Clazz_defineMethod(c$, "getValue", 
function(){
return this.value;
});
Clazz_defineMethod(c$, "getXVal2", 
function(){
return this.pt2.getXVal();
});
Clazz_defineMethod(c$, "getYVal2", 
function(){
return this.pt2.getYVal();
});
Clazz_overrideMethod(c$, "addSpecShift", 
function(dx){
this.setXVal(this.getXVal() + dx);
this.pt2.setXVal(this.pt2.getXVal() + dx);
}, "~N");
Clazz_defineMethod(c$, "setYVal2", 
function(y2){
this.pt2.setYVal(y2);
}, "~N");
Clazz_defineMethod(c$, "overlaps", 
function(x1, x2){
return (Math.min(this.getXVal(), this.getXVal2()) < Math.max(x1, x2) && Math.max(this.getXVal(), this.getXVal2()) > Math.min(x1, x2));
}, "~N,~N");
Clazz_overrideMethod(c$, "toString", 
function(){
return "[" + this.getXVal() + "," + this.pt2.getXVal() + "]";
});
});
;//5.0.1-v7 Mon Aug 17 10:07:10 MDT 2026
Clazz_declarePackage("JSV.common");
Clazz_load(["JU.Lst", "JSV.api.AnnotationData"], "JSV.common.MeasurementData", ["JU.AU", "$.DF", "JSV.common.Annotation", "$.Parameters"], function(){
var c$ = Clazz_decorateAsClass(function(){
this.type = null;
this.spec = null;
this.units = null;
this.precision = 0;
this.myParams = null;
this.isON = true;
this.key = null;
Clazz_instantialize(this, arguments);}, JSV.common, "MeasurementData", JU.Lst, JSV.api.AnnotationData);
Clazz_makeConstructor(c$, 
function(type, spec){
Clazz_superConstructor (this, JSV.common.MeasurementData, []);
this.type = type;
this.spec = spec;
this.myParams =  new JSV.common.Parameters().setName("MeasurementData");
}, "JSV.common.Annotation.AType,JSV.common.Spectrum");
Clazz_defineMethod(c$, "getMeasurements", 
function(){
return this;
});
Clazz_overrideMethod(c$, "getAType", 
function(){
return this.type;
});
Clazz_overrideMethod(c$, "getState", 
function(){
return this.isON;
});
Clazz_overrideMethod(c$, "setState", 
function(b){
this.isON = b;
}, "~B");
Clazz_defineMethod(c$, "setMeasurements", 
function(measurements){
}, "JU.Lst");
Clazz_overrideMethod(c$, "getParameters", 
function(){
return this.myParams;
});
Clazz_defineMethod(c$, "getDataHeader", 
function(){
return JSV.common.MeasurementData.HEADER;
});
Clazz_defineMethod(c$, "getMeasurementListArray", 
function(units){
this.units = units;
var ddata = this.getMeasurementListArrayReal(units);
var precisionX = (this.spec.isNMR() ? 4 : 2);
var precisionDX = (this.spec.isHNMR() && units.equals("ppm") ? 4 : 2);
var data =  new Array(this.size());
for (var i = this.size(); --i >= 0; ) data[i] =  Clazz_newArray(-1, ["" + (i + 1), JU.DF.formatDecimalDbl(ddata[i][0], precisionX), JU.DF.formatDecimalDbl(ddata[i][1], precisionX), JU.DF.formatDecimalDbl(ddata[i][2], precisionDX)]);

return data;
}, "~S");
Clazz_defineMethod(c$, "getMeasurementListArrayReal", 
function(units){
var toHz = this.spec.isNMR() && units.equalsIgnoreCase("HZ");
var data = JU.AU.newDouble2(this.size());
for (var pt = 0, i = this.size(); --i >= 0; ) {
var y = this.get(i).getValue();
if (toHz) y *= this.spec.getObservedFreq();
data[pt++] =  Clazz_newDoubleArray(-1, [this.get(i).getXVal(), this.get(i).getXVal2(), y]);
}
return data;
}, "~S");
c$.checkParameters = Clazz_defineMethod(c$, "checkParameters", 
function(md, p){
if (md.size() == 0) return false;
var myParams = md.getParameters();
switch (md.getAType()) {
case JSV.common.Annotation.AType.Integration:
break;
case JSV.common.Annotation.AType.PeakList:
return (p.peakListInterpolation.equals(myParams.peakListInterpolation) && p.peakListThreshold == myParams.peakListThreshold);
case JSV.common.Annotation.AType.Measurements:
break;
case JSV.common.Annotation.AType.NONE:
}
return false;
}, "JSV.common.MeasurementData,JSV.common.ColorParameters");
Clazz_overrideMethod(c$, "getSpectrum", 
function(){
return this.spec;
});
Clazz_overrideMethod(c$, "getData", 
function(){
return this;
});
Clazz_defineMethod(c$, "clear", 
function(x1, x2){
for (var i = this.size(); --i >= 0; ) {
var $in = this.get(i);
if ($in.text.length == 0 || $in.overlaps(x1, x2)) {
this.removeItemAt(i);
}}
}, "~N,~N");
Clazz_defineMethod(c$, "find", 
function(x){
for (var i = this.size(); --i >= 0; ) {
var $in = this.get(i);
if ($in.overlaps(x, x)) {
return i;
}}
return -1;
}, "~N");
Clazz_overrideMethod(c$, "setSpecShift", 
function(dx){
for (var i = this.size(); --i >= 0; ) {
var m = this.get(i);
var x = m.getXVal() + dx;
m.setXVal(x);
m.setValue(x);
m.text = JU.DF.formatDecimalDbl(x, this.precision);
}
}, "~N");
Clazz_overrideMethod(c$, "getGraphSetKey", 
function(){
return this.key;
});
Clazz_overrideMethod(c$, "setGraphSetKey", 
function(key){
this.key = key;
}, "~S");
Clazz_overrideMethod(c$, "isVisible", 
function(){
return true;
});
Clazz_defineMethod(c$, "getInfo", 
function(info){
info.put("header", this.getDataHeader());
info.put("table", this.getMeasurementListArrayReal("ppm"));
if (this.units != null) info.put("units", this.units);
}, "java.util.Map");
Clazz_overrideMethod(c$, "isDialog", 
function(){
return false;
});
c$.HEADER =  Clazz_newArray(-1, ["", "start", "end", "value"]);
});
;//5.0.1-v7 Mon Aug 17 10:07:10 MDT 2026
Clazz_declarePackage("JSV.common");
Clazz_load(["java.lang.Enum", "J.api.EventManager", "java.util.Hashtable", "JU.Lst"], "JSV.common.PanelData", ["JU.CU", "JSV.common.Annotation", "$.Coordinate", "$.GraphSet", "$.JSVFileManager", "$.JSVersion", "$.JSViewer", "$.MeasurementData", "$.Parameters", "$.PeakPickEvent", "$.ScriptToken", "$.Spectrum", "$.SubSpecChangeEvent", "$.ZoomEvent", "JU.Font", "$.Logger"], function(){
var c$ = Clazz_decorateAsClass(function(){
this.g2d = null;
this.g2d0 = null;
this.vwr = null;
this.listeners = null;
this.currentGraphSet = null;
this.options = null;
this.jsvp = null;
this.graphSets = null;
this.currentSplitPoint = 0;
this.thisWidget = null;
this.coordClicked = null;
this.coordsClicked = null;
this.ctrlPressed = false;
this.shiftPressed = false;
this.drawXAxisLeftToRight = false;
this.isIntegralDrag = false;
this.xAxisLeftToRight = true;
this.scalingFactor = 1;
this.integralShiftMode = 0;
this.left = 60;
this.right = 50;
this.coordStr = "";
this.startupPinTip = "Click to set.";
this.title = null;
this.clickCount = 0;
this.nSpectra = 0;
this.thisWidth = 0;
this.thisHeight = 0;
this.startIndex = 0;
this.endIndex = 0;
this.commonFilePath = null;
this.viewTitle = null;
this.displayFontName = null;
this.titleFontName = null;
this.isPrinting = false;
this.creatingImage = false;
this.doReset = true;
this.printingFontName = null;
this.printGraphPosition = "default";
this.titleDrawn = false;
this.display1D = false;
this.isLinked = false;
this.printJobTitle = null;
this.spectra = null;
this.taintedAll = true;
this.testingJavaScript = false;
this.currentFont = null;
this.mouseState = null;
this.gridOn = true;
this.titleOn = true;
this.peakTabsOn = true;
this.mouseX = 0;
this.mouseY = 0;
this.mouseSet = null;
this.mousePeak = null;
this.linking = false;
this.xPixelClicked = 0;
this.coordinatesColor = null;
this.gridColor = null;
this.integralPlotColor = null;
this.peakTabColor = null;
this.peakOverColor = null;
this.plotAreaColor = null;
this.scaleColor = null;
this.titleColor = null;
this.unitsColor = null;
this.highlightColor = null;
this.zoomBoxColor = null;
this.zoomBoxColor2 = null;
this.BLACK = null;
this.bgcolor = null;
this.optionsSaved = null;
this.gMain = null;
this.unitsDrawn = false;
Clazz_instantialize(this, arguments);}, JSV.common, "PanelData", null, J.api.EventManager);
Clazz_prepareFields (c$, function(){
this.listeners =  new JU.Lst();
this.options =  new java.util.Hashtable();
});
Clazz_makeConstructor(c$, 
function(panel, viewer){
this.vwr = viewer;
this.jsvp = panel;
this.g2d = this.g2d0 = viewer.g2d;
this.BLACK = this.g2d.getColor1(0);
this.highlightColor = this.g2d.getColor4(255, 0, 0, 200);
this.zoomBoxColor = this.g2d.getColor4(150, 150, 100, 130);
this.zoomBoxColor2 = this.g2d.getColor4(150, 100, 100, 130);
}, "JSV.api.JSVPanel,JSV.common.JSViewer");
Clazz_defineMethod(c$, "addListener", 
function(listener){
if (!this.listeners.contains(listener)) {
this.listeners.addLast(listener);
}}, "JSV.api.PanelListener");
Clazz_defineMethod(c$, "getCurrentGraphSet", 
function(){
return this.currentGraphSet;
});
Clazz_defineMethod(c$, "dispose", 
function(){
this.jsvp = null;
for (var i = 0; i < this.graphSets.size(); i++) this.graphSets.get(i).dispose();

this.graphSets = null;
this.currentFont = null;
this.currentGraphSet = null;
this.coordClicked = null;
this.coordsClicked = null;
this.thisWidget = null;
this.options = null;
this.listeners = null;
});
Clazz_defineMethod(c$, "setViewTitle", 
function(title){
this.viewTitle = title;
}, "~S");
Clazz_defineMethod(c$, "getViewTitle", 
function(){
return (this.viewTitle == null ? this.getTitle() : this.viewTitle);
});
Clazz_defineMethod(c$, "getInfo", 
function(selectedOnly, key){
var info =  new java.util.Hashtable();
var sets = null;
if (selectedOnly) return this.currentGraphSet.getInfo(key, this.getCurrentSpectrumIndex());
var entries = this.options.entrySet();
if ("".equals(key)) {
var val = "type title nSets ";
for (var entry, $entry = entries.iterator (); $entry.hasNext()&& ((entry = $entry.next ()) || true);) val += entry.getKey().name() + " ";

info.put("KEYS", val);
} else {
for (var entry, $entry = entries.iterator (); $entry.hasNext()&& ((entry = $entry.next ()) || true);) JSV.common.Parameters.putInfo(key, info, entry.getKey().name(), entry.getValue());

JSV.common.Parameters.putInfo(key, info, "type", this.getSpectrumAt(0).getDataType());
JSV.common.Parameters.putInfo(key, info, "title", this.title);
JSV.common.Parameters.putInfo(key, info, "nSets", Integer.$valueOf(this.graphSets.size()));
}sets =  new JU.Lst();
for (var i = this.graphSets.size(); --i >= 0; ) sets.addLast(this.graphSets.get(i).getInfo(key, -1));

info.put("sets", sets);
return info;
}, "~B,~S");
Clazz_defineMethod(c$, "setBooleans", 
function(parameters, st){
if (st == null) {
var booleans = parameters.getBooleans();
for (var entry, $entry = booleans.entrySet().iterator (); $entry.hasNext()&& ((entry = $entry.next ()) || true);) this.setBooleans(parameters, entry.getKey());

return;
}this.setBoolean(st, parameters.getBoolean(st));
}, "JSV.common.Parameters,JSV.common.ScriptToken");
Clazz_defineMethod(c$, "setBoolean", 
function(st, isTrue){
this.setTaintedAll();
if (st === JSV.common.ScriptToken.REVERSEPLOT) {
this.currentGraphSet.setReversePlot(isTrue);
return;
}this.options.put(st, Boolean.$valueOf(isTrue));
switch (st) {
case JSV.common.ScriptToken.DISPLAY1D:
case JSV.common.ScriptToken.DISPLAY2D:
this.doReset = true;
break;
}
}, "JSV.common.ScriptToken,~B");
Clazz_defineMethod(c$, "getBoolean", 
function(st){
if (st === JSV.common.ScriptToken.REVERSEPLOT) return this.currentGraphSet.reversePlot;
if (this.options == null) return false;
var b = this.options.get(st);
return (b != null && (Clazz_instanceOf(b, Boolean)) && (b) === Boolean.TRUE);
}, "JSV.common.ScriptToken");
Clazz_defineMethod(c$, "setFontName", 
function(st, fontName){
switch (st) {
case JSV.common.ScriptToken.DISPLAYFONTNAME:
this.displayFontName = fontName;
break;
case JSV.common.ScriptToken.TITLEFONTNAME:
this.titleFontName = fontName;
break;
}
if (fontName != null) this.options.put(st, fontName);
}, "JSV.common.ScriptToken,~S");
Clazz_defineMethod(c$, "getDisplay1D", 
function(){
return this.display1D;
});
Clazz_defineMethod(c$, "setTaintedAll", 
function(){
this.taintedAll = true;
});
Clazz_defineMethod(c$, "initOne", 
function(spectrum){
this.spectra =  new JU.Lst();
this.spectra.addLast(spectrum);
this.initMany(this.spectra, 0, 0);
}, "JSV.common.Spectrum");
Clazz_defineMethod(c$, "initMany", 
function(spectra, startIndex, endIndex){
this.startIndex = startIndex;
this.endIndex = endIndex;
this.nSpectra = spectra.size();
this.spectra = spectra;
this.commonFilePath = spectra.get(0).getFilePath();
for (var i = 0; i < this.nSpectra; i++) if (!this.commonFilePath.equalsIgnoreCase(spectra.get(i).getFilePath())) {
this.commonFilePath = null;
break;
}
this.setGraphSets(JSV.common.PanelData.LinkMode.NONE);
}, "JU.Lst,~N,~N");
Clazz_defineMethod(c$, "setGraphSets", 
function(linkMode){
this.graphSets = JSV.common.GraphSet.createGraphSetsAndSetLinkMode(this, this.jsvp, this.spectra, this.startIndex, this.endIndex, linkMode);
this.currentGraphSet = this.graphSets.get(0);
this.setTitle(this.getSpectrum().getTitleLabel());
}, "JSV.common.PanelData.LinkMode");
Clazz_defineMethod(c$, "findMatchingPeakInfo", 
function(pi){
var pi2 = null;
for (var i = 0; i < this.graphSets.size(); i++) if ((pi2 = this.graphSets.get(i).findMatchingPeakInfo(pi)) != null) break;

return pi2;
}, "JSV.common.PeakInfo");
Clazz_defineMethod(c$, "integrateAll", 
function(parameters){
for (var i = this.graphSets.size(); --i >= 0; ) this.graphSets.get(i).integrate(-1, parameters);

}, "JSV.common.ColorParameters");
Clazz_defineMethod(c$, "getNumberOfGraphSets", 
function(){
return this.graphSets.size();
});
Clazz_defineMethod(c$, "getTitle", 
function(){
return this.title;
});
Clazz_defineMethod(c$, "refresh", 
function(){
this.doReset = true;
});
Clazz_defineMethod(c$, "setTitle", 
function(title){
this.title = title;
}, "~S");
Clazz_defineMethod(c$, "addAnnotation", 
function(tokens){
var title = this.currentGraphSet.addAnnotation(tokens, this.getTitle());
if (title != null) this.setTitle(title);
}, "JU.Lst");
Clazz_defineMethod(c$, "addPeakHighlight", 
function(peakInfo){
for (var i = 0; i < this.graphSets.size(); i++) this.graphSets.get(i).addPeakHighlight(peakInfo);

}, "JSV.common.PeakInfo");
Clazz_defineMethod(c$, "selectPeakByFileIndex", 
function(filePath, index, atomKey){
var pi = this.currentGraphSet.selectPeakByFileIndex(filePath, index, atomKey);
if (pi == null) for (var i = this.graphSets.size(); --i >= 0; ) if (this.graphSets.get(i) !== this.currentGraphSet && (pi = this.graphSets.get(i).selectPeakByFileIndex(filePath, index, atomKey)) != null) break;

return pi;
}, "~S,~S,~S");
Clazz_defineMethod(c$, "setPlotColors", 
function(colors){
for (var i = this.graphSets.size(); --i >= 0; ) this.graphSets.get(i).setPlotColors(colors);

}, "~A");
Clazz_defineMethod(c$, "selectSpectrum", 
function(filePath, type, model, andCurrent){
if (andCurrent) this.currentGraphSet.selectSpectrum(filePath, type, model);
if ("ID".equals(type)) {
this.jumpToSpectrumIndex(this.getCurrentSpectrumIndex(), true);
return;
}for (var i = 0; i < this.graphSets.size(); i++) if (this.graphSets.get(i) !== this.currentGraphSet) this.graphSets.get(i).selectSpectrum(filePath, type, model);

}, "~S,~S,~S,~B");
Clazz_defineMethod(c$, "hasFileLoaded", 
function(filePath){
for (var i = this.graphSets.size(); --i >= 0; ) if (this.graphSets.get(i).hasFileLoaded(filePath)) return true;

return false;
}, "~S");
Clazz_defineMethod(c$, "clearAllView", 
function(){
for (var i = this.graphSets.size(); --i >= 0; ) this.graphSets.get(i).resetViewCompletely();

});
Clazz_defineMethod(c$, "drawGraph", 
function(gMain, gFront, gRear, width, height, addFilePath, addBorder){
var withCoords;
this.gMain = gMain;
this.display1D = !this.isLinked && this.getBoolean(JSV.common.ScriptToken.DISPLAY1D);
var top = 40;
var bottom = 50;
var isResized = (this.isPrinting || this.doReset || this.thisWidth != width || this.thisHeight != height);
if (isResized) this.setTaintedAll();
if (this.taintedAll) this.g2d.fillBackground(gRear, this.bgcolor);
if (gFront !== gMain) {
this.g2d.fillBackground(gFront, null);
if (gMain !== gRear) this.g2d.fillBackground(gMain, null);
this.g2d.setStrokeBold(gMain, false);
}this.scalingFactor = 1;
if (this.isPrinting) {
this.scalingFactor = 10;
withCoords = false;
} else if (addBorder) {
bottom *= 2;
withCoords = false;
} else {
withCoords = !this.creatingImage && this.getBoolean(JSV.common.ScriptToken.COORDINATESON);
this.titleOn = this.getBoolean(JSV.common.ScriptToken.TITLEON);
this.gridOn = this.getBoolean(JSV.common.ScriptToken.GRIDON);
this.peakTabsOn = this.getBoolean(JSV.common.ScriptToken.PEAKTABSON);
}var pointsOnly = this.getBoolean(JSV.common.ScriptToken.POINTSONLY);
this.doReset = false;
this.titleDrawn = false;
this.unitsDrawn = false;
this.thisWidth = width;
this.thisHeight = height;
for (var i = this.graphSets.size(); --i >= 0; ) {
this.graphSets.get(i).drawGraphSet(gMain, gFront, gRear, width, height, this.left, this.right, top, bottom, isResized, this.taintedAll, pointsOnly);
}
if (this.isPrinting || this.creatingImage) this.titleDrawn = true;
if (this.isPrinting && this.titleOn && !this.titleDrawn && this.taintedAll) {
this.drawTitle(gMain, (height + 20) * this.scalingFactor, width * this.scalingFactor, this.getDrawTitle(true, -1));
}if (withCoords && this.coordStr != null) this.drawCoordinates(gFront, top, this.thisWidth - this.right, top - 20);
if (addFilePath && this.taintedAll) {
this.printFilePath(gMain, this.left, height, this.commonFilePath != null ? this.commonFilePath : this.graphSets.size() == 1 && this.currentGraphSet.getTitle(true) != null ? this.getSpectrum().getFilePath() : null);
}if (this.isPrinting) {
this.printVersion(gMain, height);
}if (!this.testingJavaScript && (this.isPrinting || gMain === gFront)) this.setTaintedAll();
 else this.taintedAll = false;
}, "~O,~O,~O,~N,~N,~B,~B");
Clazz_defineMethod(c$, "drawCoordinates", 
function(g, top, x, y){
this.g2d.setGraphicsColor(g, this.coordinatesColor);
var font = this.setFont(g, this.jsvp.getWidth(), 1, 14, true);
this.g2d.drawString(g, this.coordStr, x - font.stringWidth(this.coordStr), y);
}, "~O,~N,~N,~N");
Clazz_defineMethod(c$, "setFont", 
function(g, width, style, size, isLabel){
return this.g2d.setFont(g, this.getFont(g, width, style, size, isLabel));
}, "~O,~N,~N,~N,~B");
Clazz_defineMethod(c$, "printFilePath", 
function(g, x, y, s){
if (s == null) return;
x *= this.scalingFactor;
y *= this.scalingFactor;
if (s.indexOf("?") > 0) s = s.substring(s.indexOf("?") + 1);
s = s.substring(s.lastIndexOf("/") + 1);
s = s.substring(s.lastIndexOf("\\") + 1);
this.g2d.setGraphicsColor(g, this.BLACK);
var font = this.setFont(g, 1000, 0, 9, true);
if (x != this.left * this.scalingFactor) x -= font.stringWidth(s);
this.g2d.drawString(g, s, x, y - font.getHeight());
}, "~O,~N,~N,~S");
Clazz_defineMethod(c$, "printVersion", 
function(g, pageHeight){
this.g2d.setGraphicsColor(g, this.BLACK);
var font = this.setFont(g, 100, 0, 12, true);
var s = this.jsvp.getApiPlatform().getDateFormat(null) + " JSpecView " + JSV.common.JSVersion.VERSION_SHORT;
var w = font.stringWidth(s);
this.g2d.drawString(g, s, (this.thisWidth - this.right) * this.scalingFactor - w, pageHeight * this.scalingFactor + font.getHeight() * 3);
}, "~O,~N");
Clazz_defineMethod(c$, "drawTitle", 
function(g, y, pageWidth, title){
var font = this.getFont(g, pageWidth, this.isPrinting || this.getBoolean(JSV.common.ScriptToken.TITLEBOLDON) ? 1 : 0, 14, true);
var nPixels = font.stringWidth(title);
if (nPixels > pageWidth * 0.5) {
var size = Clazz_doubleToInt(14.0 * pageWidth * 0.5 / nPixels);
if (size < 10) size = 10;
font = this.getFont(g, pageWidth, this.isPrinting || this.getBoolean(JSV.common.ScriptToken.TITLEBOLDON) ? 1 : 0, size, true);
}this.g2d.setGraphicsColor(g, this.titleColor);
this.setCurrentFont(this.g2d.setFont(g, font));
y -= Clazz_doubleToInt(font.getHeight() * (this.isPrinting ? -0.2 : this.creatingImage ? 1.2 : 0.4));
this.g2d.drawString(g, title, (this.isPrinting ? this.left * this.scalingFactor : 5), y);
}, "~O,~N,~N,~S");
Clazz_defineMethod(c$, "setCurrentFont", 
function(font){
this.currentFont = font;
}, "JU.Font");
Clazz_defineMethod(c$, "getFontHeight", 
function(){
return this.currentFont.getAscent();
});
Clazz_defineMethod(c$, "getStringWidth", 
function(s){
return this.currentFont.stringWidth(s);
}, "~S");
Clazz_defineMethod(c$, "selectFromEntireSet", 
function(iSpec){
for (var i = 0, pt = 0; i < this.graphSets.size(); i++) {
if (iSpec == -2147483648) {
this.graphSets.get(i).setSelected(-1);
continue;
}var specs = this.graphSets.get(i).spectra;
for (var j = 0; j < specs.size(); j++, pt++) if (iSpec < 0 || iSpec == pt) this.graphSets.get(i).setSelected(j);

}
}, "~N");
Clazz_defineMethod(c$, "addToList", 
function(iSpec, list){
for (var i = 0; i < this.spectra.size(); i++) if (iSpec < 0 || i == iSpec) list.addLast(this.spectra.get(i));

}, "~N,JU.Lst");
Clazz_defineMethod(c$, "scaleSelectedBy", 
function(f){
for (var i = this.graphSets.size(); --i >= 0; ) this.graphSets.get(i).scaleSelectedBy(f);

}, "~N");
Clazz_defineMethod(c$, "setCurrentGraphSet", 
function(gs, yPixel){
var splitPoint = (gs.nSplit > 1 ? gs.getSplitPoint(yPixel) : gs.getCurrentSpectrumIndex());
var isNewSet = (this.currentGraphSet !== gs);
var isNewSplitPoint = (isNewSet || this.currentSplitPoint != splitPoint);
this.currentGraphSet = gs;
this.currentSplitPoint = splitPoint;
if (isNewSet || gs.nSplit > 1 && isNewSplitPoint) this.setSpectrum(splitPoint, true);
if (!isNewSet) {
isNewSet = gs.checkSpectrumClickedEvent(this.mouseX, this.mouseY, this.clickCount);
if (!isNewSet) return false;
this.currentSplitPoint = splitPoint = gs.getCurrentSpectrumIndex();
this.setSpectrum(splitPoint, true);
}this.jumpToSpectrumIndex(splitPoint, isNewSet || gs.nSplit > 1 && isNewSplitPoint);
return isNewSet;
}, "JSV.common.GraphSet,~N");
Clazz_defineMethod(c$, "jumpToSpectrum", 
function(spec){
var index = this.currentGraphSet.getSpectrumIndex(spec);
this.jumpToSpectrumIndex(index, true);
}, "JSV.common.Spectrum");
Clazz_defineMethod(c$, "jumpToSpectrumIndex", 
function(index, doSetSpec){
if (index < 0 || index >= this.currentGraphSet.nSpectra) return;
this.currentSplitPoint = index;
if (doSetSpec) this.setSpectrum(this.currentSplitPoint, this.currentGraphSet.nSplit > 1);
var spec = this.getSpectrum();
this.notifySubSpectrumChange(spec.getSubIndex(), spec);
}, "~N,~B");
Clazz_defineMethod(c$, "splitStack", 
function(doSplit){
this.currentGraphSet.splitStack(doSplit);
}, "~B");
Clazz_defineMethod(c$, "getNumberOfSpectraInCurrentSet", 
function(){
return this.currentGraphSet.nSpectra;
});
Clazz_defineMethod(c$, "getSourceID", 
function(){
var id = this.getSpectrum().sourceID;
return (id == null ? this.getSpectrumAt(0).sourceID : id);
});
Clazz_defineMethod(c$, "getStartingPointIndex", 
function(index){
return this.currentGraphSet.viewData.getStartingPointIndex(index);
}, "~N");
Clazz_defineMethod(c$, "getEndingPointIndex", 
function(index){
return this.currentGraphSet.viewData.getEndingPointIndex(index);
}, "~N");
Clazz_defineMethod(c$, "haveSelectedSpectrum", 
function(){
return this.currentGraphSet.haveSelectedSpectrum();
});
Clazz_defineMethod(c$, "getShowAnnotation", 
function(type){
return this.currentGraphSet.getShowAnnotation(type, -1);
}, "JSV.common.Annotation.AType");
Clazz_defineMethod(c$, "showAnnotation", 
function(type, tfToggle){
this.currentGraphSet.setShowAnnotation(type, tfToggle);
}, "JSV.common.Annotation.AType,Boolean");
Clazz_defineMethod(c$, "setYStackOffsetPercent", 
function(offset){
this.currentGraphSet.yStackOffsetPercent = offset;
}, "~N");
Clazz_defineMethod(c$, "setSpectrum", 
function(iSpec, isSplit){
this.currentGraphSet.setSpectrum(iSpec, isSplit);
}, "~N,~B");
Clazz_defineMethod(c$, "getSpectrum", 
function(){
return this.currentGraphSet.getSpectrum();
});
Clazz_defineMethod(c$, "setSpecForIRMode", 
function(spec){
this.setTaintedAll();
var spec0 = this.currentGraphSet.getSpectrum();
this.currentGraphSet.setSpectrumJDX(spec);
for (var i = 0; i < this.spectra.size(); i++) if (this.spectra.get(i) === spec0) this.spectra.set(i, spec);

}, "JSV.common.Spectrum");
Clazz_defineMethod(c$, "isShowAllStacked", 
function(){
return this.currentGraphSet.showAllStacked;
});
Clazz_defineMethod(c$, "getCurrentSpectrumIndex", 
function(){
return this.currentGraphSet.getCurrentSpectrumIndex();
});
Clazz_defineMethod(c$, "getSpectrumAt", 
function(index){
if (this.currentGraphSet == null) return null;
return this.currentGraphSet.getSpectrumAt(index);
}, "~N");
Clazz_defineMethod(c$, "addHighlight", 
function(gs, x1, x2, spec, r, g, b, a){
(gs == null ? this.currentGraphSet : gs).addHighlight(x1, x2, spec, this.g2d.getColor4(r, g, b, a));
}, "JSV.common.GraphSet,~N,~N,JSV.common.Spectrum,~N,~N,~N,~N");
Clazz_defineMethod(c$, "removeHighlight", 
function(x1, x2){
this.currentGraphSet.removeHighlight(x1, x2);
}, "~N,~N");
Clazz_defineMethod(c$, "removeAllHighlights", 
function(){
this.currentGraphSet.removeAllHighlights();
});
Clazz_defineMethod(c$, "setZoom", 
function(x1, y1, x2, y2){
this.currentGraphSet.setZoom(x1, y1, x2, y2);
this.doReset = true;
this.setTaintedAll();
this.notifyListeners( new JSV.common.ZoomEvent());
}, "~N,~N,~N,~N");
Clazz_defineMethod(c$, "resetView", 
function(){
this.currentGraphSet.resetView();
});
Clazz_defineMethod(c$, "previousView", 
function(){
this.currentGraphSet.previousView();
});
Clazz_defineMethod(c$, "nextView", 
function(){
this.currentGraphSet.nextView();
});
Clazz_defineMethod(c$, "getSelectedIntegral", 
function(){
return this.currentGraphSet.getSelectedIntegral();
});
Clazz_defineMethod(c$, "advanceSubSpectrum", 
function(dir){
this.currentGraphSet.advanceSubSpectrum(dir);
}, "~N");
Clazz_defineMethod(c$, "setSelectedIntegral", 
function(val){
this.currentGraphSet.setSelectedIntegral(val);
}, "~N");
Clazz_defineMethod(c$, "scaleYBy", 
function(f){
this.currentGraphSet.scaleYBy(f);
}, "~N");
Clazz_defineMethod(c$, "toPeak", 
function(i){
this.currentGraphSet.toPeak(i);
}, "~N");
Clazz_defineMethod(c$, "getClickedCoordinate", 
function(){
return this.coordClicked;
});
Clazz_defineMethod(c$, "getPickedCoordinates", 
function(coord, actualCoord){
return JSV.common.Coordinate.getPickedCoordinates(this.coordsClicked, this.coordClicked, coord, actualCoord);
}, "JSV.common.Coordinate,JSV.common.Coordinate");
Clazz_defineMethod(c$, "shiftSpectrum", 
function(mode, xOld, xNew){
return this.currentGraphSet.shiftSpectrum(mode, xOld, xNew);
}, "~N,~N,~N");
Clazz_defineMethod(c$, "findX", 
function(spec, d){
this.currentGraphSet.setXPointer(spec, d);
}, "JSV.common.Spectrum,~N");
Clazz_defineMethod(c$, "setXPointers", 
function(spec, x1, spec2, x2){
this.currentGraphSet.setXPointer(spec, x1);
this.currentGraphSet.setXPointer2(spec2, x2);
}, "JSV.common.Spectrum,~N,JSV.common.Spectrum,~N");
Clazz_defineMethod(c$, "isCurrentGraphSet", 
function(graphSet){
return graphSet === this.currentGraphSet;
}, "JSV.common.GraphSet");
Clazz_defineMethod(c$, "repaint", 
function(){
this.jsvp.doRepaint(false);
});
Clazz_defineMethod(c$, "setToolTipText", 
function(s){
this.jsvp.setToolTipText(s);
}, "~S");
Clazz_defineMethod(c$, "setHighlightColor", 
function(color){
this.setColor(JSV.common.ScriptToken.HIGHLIGHTCOLOR, color);
}, "javajs.api.GenericColor");
Clazz_defineMethod(c$, "getInput", 
function(message, title, sval){
return this.jsvp.getInput(message, title, sval);
}, "~S,~S,~S");
Clazz_defineMethod(c$, "getFont", 
function(g, width, style, size, isLabel){
size *= this.scalingFactor;
if (isLabel) {
if (width < 400) size = ((width * size) / 400);
} else {
if (width < 250) size = ((width * size) / 250);
}var face = this.jsvp.getFontFaceID(this.isPrinting ? this.printingFontName : this.displayFontName);
return this.currentFont = JU.Font.createFont3D(face, style, size, size, 0, this.jsvp.getApiPlatform(), g);
}, "~O,~N,~N,~N,~B");
Clazz_defineMethod(c$, "notifySubSpectrumChange", 
function(isub, spec){
this.notifyListeners( new JSV.common.SubSpecChangeEvent(isub, (spec == null ? null : spec.getTitleLabel())));
}, "~N,JSV.common.Spectrum");
Clazz_defineMethod(c$, "notifyPeakPickedListeners", 
function(p){
if (p == null) {
p =  new JSV.common.PeakPickEvent(this.jsvp, this.coordClicked, this.getSpectrum().getAssociatedPeakInfo(this.xPixelClicked, this.coordClicked));
}this.notifyListeners(p);
}, "JSV.common.PeakPickEvent");
Clazz_defineMethod(c$, "notifyListeners", 
function(eventObj){
for (var i = 0; i < this.listeners.size(); i++) if (this.listeners.get(i) != null) this.listeners.get(i).panelEvent(eventObj);

}, "~O");
Clazz_defineMethod(c$, "escapeKeyPressed", 
function(isDEL){
this.currentGraphSet.escapeKeyPressed(isDEL);
}, "~B");
Clazz_defineMethod(c$, "hasFocus", 
function(){
return this.jsvp.hasFocus();
});
Clazz_defineMethod(c$, "isMouseUp", 
function(){
return (this.mouseState === JSV.common.PanelData.Mouse.UP);
});
Clazz_defineMethod(c$, "clearMouseSet", 
function(gs){
if (gs == null) {
this.mousePeak = null;
}if (this.mouseSet != null && this.mouseSet !== gs) {
this.mouseSet.mouseMovedEvent(2147483647, 0);
}this.mouseSet = gs;
if (gs == null && this.graphSets.size() > 0) {
(this.mouseSet = gs = this.graphSets.get(this.graphSets.size() - 1)).setSpectrumMovedTo(gs.nSpectra - 1);
}}, "JSV.common.GraphSet");
Clazz_defineMethod(c$, "doMouseMoved", 
function(xPixel, yPixel){
this.mouseX = xPixel;
this.mouseY = yPixel;
this.mouseState = JSV.common.PanelData.Mouse.UP;
this.clickCount = 0;
var gs = JSV.common.GraphSet.findGraphSet(this.graphSets, xPixel, yPixel);
if (gs == null) return;
this.clearMouseSet(gs);
var peak = gs.mouseMovedEvent(xPixel, yPixel);
if (this.mousePeak !== peak) {
this.mousePeak = peak;
this.setTaintedAll();
}}, "~N,~N");
Clazz_defineMethod(c$, "doMouseClicked", 
function(xPixel, yPixel, isControlDown){
var gs = JSV.common.GraphSet.findGraphSet(this.graphSets, xPixel, yPixel);
if (gs == null) return;
this.setCurrentGraphSet(gs, yPixel);
gs.mouseClickedEvent(xPixel, yPixel, this.clickCount, isControlDown);
this.setTaintedAll();
this.repaint();
}, "~N,~N,~B");
Clazz_defineMethod(c$, "doMousePressed", 
function(xPixel, yPixel){
this.mouseState = JSV.common.PanelData.Mouse.DOWN;
var gs = JSV.common.GraphSet.findGraphSet(this.graphSets, xPixel, yPixel);
if (gs == null) return;
this.clearMouseSet(gs);
this.setCurrentGraphSet(gs, yPixel);
this.clickCount = (++this.clickCount % 3);
this.currentGraphSet.mousePressedEvent(xPixel, yPixel, this.clickCount);
}, "~N,~N");
Clazz_defineMethod(c$, "doMouseDragged", 
function(xPixel, yPixel){
this.isIntegralDrag = new Boolean (this.isIntegralDrag | this.ctrlPressed).valueOf();
this.mouseState = JSV.common.PanelData.Mouse.DOWN;
if (JSV.common.GraphSet.findGraphSet(this.graphSets, xPixel, yPixel) !== this.currentGraphSet) return;
if (this.currentGraphSet.checkWidgetEvent(xPixel, yPixel, false)) this.setTaintedAll();
this.currentGraphSet.mouseMovedEvent(xPixel, yPixel);
}, "~N,~N");
Clazz_defineMethod(c$, "doMouseReleased", 
function(xPixel, yPixel, isButton1){
this.mouseState = JSV.common.PanelData.Mouse.UP;
if (this.thisWidget == null && this.currentGraphSet.pendingMeasurement == null || !isButton1) return;
this.currentGraphSet.mouseReleasedEvent(xPixel, yPixel);
this.thisWidget = null;
this.isIntegralDrag = false;
this.integralShiftMode = 0;
}, "~N,~N,~B");
Clazz_defineMethod(c$, "hasCurrentMeasurements", 
function(type){
return this.currentGraphSet.hasCurrentMeasurement(type);
}, "JSV.common.Annotation.AType");
Clazz_defineMethod(c$, "getDialog", 
function(type){
return this.currentGraphSet.getDialog(type, -1);
}, "JSV.common.Annotation.AType");
Clazz_defineMethod(c$, "addDialog", 
function(iSpec, type, dialog){
this.currentGraphSet.addDialog(iSpec, type, dialog);
}, "~N,JSV.common.Annotation.AType,JSV.api.AnnotationData");
Clazz_defineMethod(c$, "getPeakListing", 
function(p, tfToggle){
if (p != null) this.currentGraphSet.getPeakListing(-1, p, true);
this.currentGraphSet.setPeakListing(tfToggle);
}, "JSV.common.Parameters,Boolean");
Clazz_defineMethod(c$, "checkIntegral", 
function(parameters, value){
this.currentGraphSet.checkIntegralParams(parameters, value);
}, "JSV.common.Parameters,~S");
Clazz_defineMethod(c$, "setIntegrationRatios", 
function(value){
this.currentGraphSet.setIntegrationRatios(value);
}, "~S");
Clazz_defineMethod(c$, "getView", 
function(){
return this.currentGraphSet.getCurrentView();
});
Clazz_defineMethod(c$, "closeAllDialogsExcept", 
function(type){
for (var i = this.graphSets.size(); --i >= 0; ) this.graphSets.get(i).closeDialogsExcept(type);

}, "JSV.common.Annotation.AType");
Clazz_defineMethod(c$, "removeDialog", 
function(dialog){
this.currentGraphSet.removeDialog(dialog);
}, "JSV.dialog.JSVDialog");
Clazz_defineMethod(c$, "normalizeIntegral", 
function(){
var integral = this.getSelectedIntegral();
if (integral == null) return;
var sValue = integral.text;
if (sValue.length == 0) sValue = "" + integral.getValue();
var newValue = this.getInput("Enter a new value for this integral", "Normalize Integral", sValue);
try {
this.setSelectedIntegral(Double.parseDouble(newValue));
} catch (e) {
if (Clazz_exceptionOf(e, Exception)){
} else {
throw e;
}
}
});
Clazz_defineMethod(c$, "getDrawTitle", 
function(isPrinting, iSpec){
var title = null;
if (isPrinting) {
title = this.printJobTitle;
} else if (this.nSpectra == 1) {
title = this.getSpectrum().getPeakTitle();
} else if (iSpec >= 0) {
title = this.getSpectrumAt(iSpec).getPeakTitle();
} else if (this.viewTitle != null) {
if (this.currentGraphSet.getTitle(false) != null) title = this.getSpectrum().getPeakTitle();
if (title == null) title = this.viewTitle;
} else {
title = this.jsvp.getTitle().trim();
}if (title.indexOf("\n") >= 0) title = title.substring(0, title.indexOf("\n")).trim();
return title;
}, "~B,~N");
Clazz_defineMethod(c$, "linkSpectra", 
function(mode){
if (mode === JSV.common.PanelData.LinkMode.ALL) mode = (this.nSpectra == 2 ? JSV.common.PanelData.LinkMode.AB : this.nSpectra == 3 ? JSV.common.PanelData.LinkMode.ABC : JSV.common.PanelData.LinkMode.NONE);
if (mode !== JSV.common.PanelData.LinkMode.NONE && mode.toString().length != this.nSpectra) return;
this.setGraphSets(mode);
}, "JSV.common.PanelData.LinkMode");
Clazz_defineMethod(c$, "doZoomLinked", 
function(graphSet, initX, finalX, addZoom, checkRange, is1d){
if (this.linking) return;
this.linking = true;
var spec = graphSet.getSpectrumAt(0);
for (var i = this.graphSets.size(); --i >= 0; ) {
var gs = this.graphSets.get(i);
if (gs !== graphSet && JSV.common.Spectrum.areXScalesCompatible(spec, this.graphSets.get(i).getSpectrumAt(0), false, true)) gs.doZoom(initX, 0, finalX, 0, is1d, false, checkRange, false, addZoom);
}
this.linking = false;
}, "JSV.common.GraphSet,~N,~N,~B,~B,~B");
Clazz_defineMethod(c$, "clearLinkViews", 
function(graphSet){
if (this.linking) return;
this.linking = true;
var spec = graphSet.getSpectrum();
for (var i = this.graphSets.size(); --i >= 0; ) {
var gs = this.graphSets.get(i);
if (gs !== graphSet && JSV.common.Spectrum.areXScalesCompatible(spec, this.graphSets.get(i).getSpectrum(), false, true)) gs.clearViews();
}
this.linking = false;
}, "JSV.common.GraphSet");
Clazz_defineMethod(c$, "setlinkedXMove", 
function(graphSet, x, isX2){
if (this.linking) return;
this.linking = true;
var spec = graphSet.getSpectrum();
for (var i = this.graphSets.size(); --i >= 0; ) {
var gs = this.graphSets.get(i);
if (gs !== graphSet && JSV.common.Spectrum.areXScalesCompatible(spec, this.graphSets.get(i).getSpectrum(), false, true)) {
if (gs.imageView == null) if (isX2) {
gs.setXPixelMovedTo(1.7976931348623157E308, x, 0, 0);
} else {
gs.setXPixelMovedTo(x, 1.7976931348623157E308, 0, 0);
}}}
this.linking = false;
}, "JSV.common.GraphSet,~N,~B");
Clazz_defineMethod(c$, "set2DCrossHairsLinked", 
function(graphSet, x, y, isLocked){
for (var i = this.graphSets.size(); --i >= 0; ) {
var gs = this.graphSets.get(i);
if (gs !== graphSet) gs.set2DXY(x, y, isLocked);
}
}, "JSV.common.GraphSet,~N,~N,~B");
Clazz_defineMethod(c$, "dialogsToFront", 
function(spec){
this.currentGraphSet.dialogsToFront(spec);
}, "JSV.common.Spectrum");
Clazz_defineMethod(c$, "setColor", 
function(st, color){
if (color != null) this.options.put(st, JU.CU.toRGBHexString(color));
switch (st) {
case JSV.common.ScriptToken.COORDINATESCOLOR:
this.coordinatesColor = color;
return;
case JSV.common.ScriptToken.HIGHLIGHTCOLOR:
this.highlightColor = color.addAlpha(150);
return;
case JSV.common.ScriptToken.ZOOMBOXCOLOR:
this.zoomBoxColor = color;
return;
case JSV.common.ScriptToken.ZOOMBOXCOLOR2:
this.zoomBoxColor2 = color;
return;
case JSV.common.ScriptToken.BACKGROUNDCOLOR:
this.jsvp.setBackgroundColor(this.bgcolor = color);
break;
case JSV.common.ScriptToken.GRIDCOLOR:
this.gridColor = color;
break;
case JSV.common.ScriptToken.INTEGRALPLOTCOLOR:
this.integralPlotColor = color;
break;
case JSV.common.ScriptToken.PEAKOVERCOLOR:
this.peakOverColor = color.addAlpha(30);
break;
case JSV.common.ScriptToken.PEAKTABCOLOR:
this.peakTabColor = color;
break;
case JSV.common.ScriptToken.PLOTCOLOR:
for (var i = this.graphSets.size(); --i >= 0; ) this.graphSets.get(i).setPlotColor0(color);

break;
case JSV.common.ScriptToken.PLOTAREACOLOR:
this.plotAreaColor = color;
break;
case JSV.common.ScriptToken.SCALECOLOR:
this.scaleColor = color;
break;
case JSV.common.ScriptToken.TITLECOLOR:
this.titleColor = color;
break;
case JSV.common.ScriptToken.UNITSCOLOR:
this.unitsColor = color;
break;
default:
JU.Logger.warn("AwtPanel --- unrecognized color: " + st);
return;
}
this.taintedAll = true;
}, "JSV.common.ScriptToken,javajs.api.GenericColor");
Clazz_defineMethod(c$, "getColor", 
function(whatColor){
switch (whatColor) {
default:
JU.Logger.error("awtgraphset missing color " + whatColor);
return this.BLACK;
case JSV.common.ScriptToken.ZOOMBOXCOLOR2:
return this.zoomBoxColor2;
case JSV.common.ScriptToken.ZOOMBOXCOLOR:
return this.zoomBoxColor;
case JSV.common.ScriptToken.HIGHLIGHTCOLOR:
return this.highlightColor;
case JSV.common.ScriptToken.INTEGRALPLOTCOLOR:
return this.integralPlotColor;
case JSV.common.ScriptToken.GRIDCOLOR:
return this.gridColor;
case JSV.common.ScriptToken.PEAKOVERCOLOR:
return this.peakOverColor;
case JSV.common.ScriptToken.PEAKTABCOLOR:
return this.peakTabColor;
case JSV.common.ScriptToken.PLOTAREACOLOR:
return this.plotAreaColor;
case JSV.common.ScriptToken.SCALECOLOR:
return this.scaleColor;
case JSV.common.ScriptToken.TITLECOLOR:
return this.titleColor;
case JSV.common.ScriptToken.UNITSCOLOR:
return this.unitsColor;
}
}, "JSV.common.ScriptToken");
Clazz_defineMethod(c$, "getOverlayLegendData", 
function(){
var numSpectra = this.currentGraphSet.nSpectra;
var data =  new Array(numSpectra);
var f1 = this.getSpectrumAt(0).getFilePath();
var f2 = this.getSpectrumAt(numSpectra - 1).getFilePath();
var useFileName = f1 != null && f2 != null && !f1.equals(f2);
for (var index = 0; index < numSpectra; index++) {
var cols =  new Array(3);
var spectrum = this.getSpectrumAt(index);
var title = spectrum.getTitle();
if (useFileName) title = JSV.common.JSVFileManager.getTagName(spectrum.getFilePath()) + " - " + title;
var plotColor = this.getCurrentPlotColor(index);
cols[0] =  new Integer(index + 1);
cols[1] = plotColor;
cols[2] = " " + title;
data[index] = cols;
}
return data;
});
Clazz_defineMethod(c$, "setColorOrFont", 
function(params, st){
if (st == null) {
var colors = params.elementColors;
for (var entry, $entry = colors.entrySet().iterator (); $entry.hasNext()&& ((entry = $entry.next ()) || true);) this.setColorOrFont(params, entry.getKey());

this.setColorOrFont(params, JSV.common.ScriptToken.DISPLAYFONTNAME);
this.setColorOrFont(params, JSV.common.ScriptToken.TITLEFONTNAME);
return;
}switch (st) {
case JSV.common.ScriptToken.DISPLAYFONTNAME:
this.setFontName(st, params.displayFontName);
return;
case JSV.common.ScriptToken.TITLEFONTNAME:
this.setFontName(st, params.titleFontName);
return;
}
this.setColor(st, params.getElementColor(st));
}, "JSV.common.ColorParameters,JSV.common.ScriptToken");
Clazz_defineMethod(c$, "getCurrentPlotColor", 
function(i){
return this.currentGraphSet.getPlotColor(i);
}, "~N");
Clazz_defineMethod(c$, "setPrint", 
function(pl, fontName){
if (pl == null) {
this.options.putAll(this.optionsSaved);
this.optionsSaved = null;
return;
}this.printJobTitle = pl.title;
this.printingFontName = fontName;
this.printGraphPosition = pl.position;
this.optionsSaved =  new java.util.Hashtable();
this.optionsSaved.putAll(this.options);
this.gridOn = pl.showGrid;
this.titleOn = pl.showTitles;
this.setBoolean(JSV.common.ScriptToken.XSCALEON, pl.showXScale);
this.setBoolean(JSV.common.ScriptToken.XUNITSON, pl.showXScale);
this.setBoolean(JSV.common.ScriptToken.YSCALEON, pl.showYScale);
this.setBoolean(JSV.common.ScriptToken.YUNITSON, pl.showYScale);
}, "JSV.common.PrintLayout,~S");
Clazz_defineMethod(c$, "setDefaultPrintOptions", 
function(pl){
pl.showGrid = this.gridOn;
pl.showXScale = this.getBoolean(JSV.common.ScriptToken.XSCALEON);
pl.showYScale = this.getBoolean(JSV.common.ScriptToken.YSCALEON);
pl.showTitles = this.titleOn;
}, "JSV.common.PrintLayout");
Clazz_defineMethod(c$, "showDialog", 
function(type){
var ad = this.getDialog(type);
this.closeAllDialogsExcept(type);
if (ad != null && Clazz_instanceOf(ad,"JSV.dialog.JSVDialog")) return (ad).reEnable();
var iSpec = this.getCurrentSpectrumIndex();
if (iSpec < 0) {
this.jsvp.showMessage("To enable " + type + " first select a spectrum by clicking on it.", "" + type);
return null;
}var spec = this.getSpectrum();
var dialog = this.vwr.getDialog(type, spec);
if (ad == null && type === JSV.common.Annotation.AType.Measurements) ad =  new JSV.common.MeasurementData(JSV.common.Annotation.AType.Measurements, spec);
if (ad != null) dialog.setData(ad);
this.addDialog(iSpec, type, dialog);
dialog.reEnable();
return dialog;
}, "JSV.common.Annotation.AType");
Clazz_defineMethod(c$, "printPdf", 
function(pdfCreator, pl){
var isPortrait = !pl.layout.equals("landscape");
this.print(pdfCreator, (isPortrait ? pl.imageableHeight : pl.imageableWidth), (isPortrait ? pl.imageableWidth : pl.imageableHeight), pl.imageableX, pl.imageableY, pl.paperHeight, pl.paperWidth, isPortrait, 0);
}, "J.api.GenericGraphics,JSV.common.PrintLayout");
Clazz_defineMethod(c$, "print", 
function(g, height, width, x, y, paperHeight, paperWidth, isPortrait, pageIndex){
if (pageIndex != 0) {
return 1;
}this.g2d = this.g2d0;
this.isPrinting = true;
var addFilePath = false;
if (Clazz_instanceOf(g,"J.api.GenericGraphics")) {
this.g2d = g;
g = this.gMain;
}if (this.printGraphPosition.equals("default")) {
if (isPortrait) {
height = 450;
width = 280;
} else {
height = 280;
width = 450;
}} else if (this.printGraphPosition.equals("fit to page")) {
} else {
if (isPortrait) {
height = 450;
width = 280;
x = Clazz_doubleToInt(Clazz_doubleToInt(paperWidth - width) / 2);
y = Clazz_doubleToInt(Clazz_doubleToInt(paperHeight - height) / 2);
} else {
height = 280;
width = 450;
y = Clazz_doubleToInt(Clazz_doubleToInt(paperWidth - 280) / 2);
x = Clazz_doubleToInt(Clazz_doubleToInt(paperHeight - 450) / 2);
}}this.setTaintedAll();
this.g2d.translateScale(null, x, y, 0.1);
if (g == null) g =  new java.awt.image.BufferedImage(Clazz_doubleToInt(width), Clazz_doubleToInt(height), 2).getGraphics();
this.drawGraph(g, g, g, Clazz_doubleToInt(width), Clazz_doubleToInt(height), addFilePath, false);
if (this.g2d !== this.g2d0 && g !== this.gMain) (g).dispose();
this.g2d = this.g2d0;
this.isPrinting = false;
return 0;
}, "~O,~N,~N,~N,~N,~N,~N,~B,~N");
Clazz_overrideMethod(c$, "keyPressed", 
function(code, modifiers){
if (this.isPrinting) return false;
this.checkKeyControl(code, true);
switch (code) {
case 27:
case 127:
case 8:
this.escapeKeyPressed(code != 27);
this.isIntegralDrag = false;
this.setTaintedAll();
this.repaint();
return true;
}
var scaleFactor = 0;
var doConsume = false;
if (modifiers == 0) {
switch (code) {
case 37:
case 39:
this.doMouseMoved((code == 39 ? ++this.mouseX : --this.mouseX), this.mouseY);
this.repaint();
doConsume = true;
break;
case 33:
case 34:
scaleFactor = (code == 33 ? JSV.common.GraphSet.RT2 : 1 / JSV.common.GraphSet.RT2);
doConsume = true;
break;
case 40:
case 38:
var dir = (code == 40 ? -1 : 1);
if (this.getSpectrumAt(0).getSubSpectra() == null) {
this.notifySubSpectrumChange(dir, null);
} else {
this.advanceSubSpectrum(dir);
this.setTaintedAll();
this.repaint();
}doConsume = true;
break;
}
} else if (this.checkMod(code, 2)) {
switch (code) {
case 40:
case 38:
case 45:
case 61:
scaleFactor = (code == 61 || code == 38 ? JSV.common.GraphSet.RT2 : 1 / JSV.common.GraphSet.RT2);
doConsume = true;
break;
case 37:
case 39:
this.toPeak(code == 39 ? 1 : -1);
doConsume = true;
break;
}
}if (scaleFactor != 0) {
this.scaleYBy(scaleFactor);
this.setTaintedAll();
this.repaint();
}return doConsume;
}, "~N,~N");
Clazz_overrideMethod(c$, "keyReleased", 
function(keyCode){
if (this.isPrinting) return;
this.checkKeyControl(keyCode, false);
}, "~N");
Clazz_overrideMethod(c$, "keyTyped", 
function(ch, mods){
if (this.isPrinting) return false;
switch (ch) {
case 110:
if (mods != 0) break;
this.normalizeIntegral();
return true;
case 26:
if (mods != 2) break;
this.previousView();
this.setTaintedAll();
this.repaint();
return true;
case 25:
if (mods != 2) break;
this.nextView();
this.setTaintedAll();
this.repaint();
return true;
}
return false;
}, "~N,~N");
Clazz_overrideMethod(c$, "mouseAction", 
function(mode, time, x, y, countIgnored, buttonMods){
if (this.isPrinting) return;
switch (mode) {
case 4:
if (!this.checkMod(buttonMods, 16)) return;
this.doMousePressed(x, y);
break;
case 5:
this.doMouseReleased(x, y, this.checkMod(buttonMods, 16));
this.setTaintedAll();
this.repaint();
break;
case 1:
this.doMouseDragged(x, y);
this.repaint();
break;
case 0:
this.jsvp.getFocusNow(false);
if ((buttonMods & 28) != 0) {
this.doMouseDragged(x, y);
this.repaint();
return;
}this.doMouseMoved(x, y);
if (this.coordStr != null) this.repaint();
break;
case 2:
if (this.checkMod(buttonMods, 4)) {
this.jsvp.showMenu(x, y);
return;
}this.ctrlPressed = false;
this.doMouseClicked(x, y, this.updateControlPressed(buttonMods));
break;
}
}, "~N,~N,~N,~N,~N,~N");
Clazz_defineMethod(c$, "checkMod", 
function(buttonMods, mask){
return ((buttonMods & mask) == mask);
}, "~N,~N");
Clazz_defineMethod(c$, "checkKeyControl", 
function(keyCode, isPressed){
switch (keyCode) {
case 17:
case 157:
this.ctrlPressed = isPressed;
break;
case 16:
this.shiftPressed = isPressed;
break;
}
}, "~N,~B");
Clazz_defineMethod(c$, "updateControlPressed", 
function(mods){
return (this.ctrlPressed = new Boolean (this.ctrlPressed |(this.checkMod(mods, 2) || this.checkMod(mods, 20))).valueOf());
}, "~N");
Clazz_overrideMethod(c$, "mouseEnterExit", 
function(time, x, y, isExit){
if (isExit) {
this.thisWidget = null;
this.isIntegralDrag = false;
this.integralShiftMode = 0;
} else {
try {
this.jsvp.getFocusNow(false);
} catch (e) {
if (Clazz_exceptionOf(e, Exception)){
System.out.println("pd " + this + " cannot focus");
} else {
throw e;
}
}
}}, "~N,~N,~N,~B");
Clazz_defineMethod(c$, "setSolutionColor", 
function(what){
var isNone = (what.indexOf("none") >= 0);
var asFitted = (what.indexOf("false") < 0);
if (what.indexOf("all") < 0) {
var color = (isNone ? -1 : this.vwr.getSolutionColor(asFitted));
this.getSpectrum().setFillColor(color == -1 ? null : this.vwr.parameters.getColor1(color));
} else {
var vi = JSV.common.JSViewer.getInterface("JSV.common.Visible");
for (var i = this.graphSets.size(); --i >= 0; ) this.graphSets.get(i).setSolutionColor(vi, isNone, asFitted);

}}, "~S");
Clazz_defineMethod(c$, "setIRMode", 
function(mode, type){
for (var i = this.graphSets.size(); --i >= 0; ) this.graphSets.get(i).setIRMode(mode, type);

}, "JSV.common.Spectrum.IRMode,~S");
Clazz_defineMethod(c$, "closeSpectrum", 
function(){
this.vwr.close("views");
this.vwr.close(this.getSourceID());
this.vwr.execView("*", true);
});
/*if2*/;(function(){
var c$ = Clazz_declareType(JSV.common.PanelData, "LinkMode", Enum);
c$.getMode = Clazz_defineMethod(c$, "getMode", 
function(abc){
if (abc.equals("*")) return JSV.common.PanelData.LinkMode.ALL;
for (var mode, $mode = 0, $$mode = JSV.common.PanelData.LinkMode.values(); $mode < $$mode.length && ((mode = $$mode[$mode]) || true); $mode++) if (mode.name().equalsIgnoreCase(abc)) return mode;

return JSV.common.PanelData.LinkMode.NONE;
}, "~S");
Clazz_defineEnumConstant(c$, "ALL", 0, []);
Clazz_defineEnumConstant(c$, "NONE", 1, []);
Clazz_defineEnumConstant(c$, "AB", 2, []);
Clazz_defineEnumConstant(c$, "ABC", 3, []);
/*eoif2*/})();
/*if2*/;(function(){
var c$ = Clazz_declareType(JSV.common.PanelData, "Mouse", Enum);
Clazz_defineEnumConstant(c$, "UP", 0, []);
Clazz_defineEnumConstant(c$, "DOWN", 1, []);
/*eoif2*/})();
});
;//5.0.1-v7 Mon Aug 17 10:07:10 MDT 2026
Clazz_declarePackage("JSV.common");
Clazz_load(null, "JSV.common.PanelNode", ["JU.SB", "JSV.common.Parameters"], function(){
var c$ = Clazz_decorateAsClass(function(){
this.treeNode = null;
this.source = null;
this.fileName = null;
this.jsvp = null;
this.id = null;
this.legend = null;
this.isSelected = false;
this.isView = false;
this.isSimulation = false;
this.frameTitle = null;
Clazz_instantialize(this, arguments);}, JSV.common, "PanelNode", null);
Clazz_makeConstructor(c$, 
function(id, fileName, source, jsvp){
this.id = id;
this.source = source;
this.fileName = fileName;
this.isSimulation = (source.getFilePath().indexOf("http://SIMULATION/") >= 0);
this.jsvp = jsvp;
if (jsvp != null) {
this.pd().getSpectrumAt(0).setId(id);
this.frameTitle = jsvp.getTitle();
}}, "~S,~S,JSV.source.JDXSource,JSV.api.JSVPanel");
Clazz_defineMethod(c$, "setTreeNode", 
function(node){
this.treeNode = node;
}, "JSV.api.JSVTreeNode");
Clazz_defineMethod(c$, "getTreeNode", 
function(){
return this.treeNode;
});
Clazz_defineMethod(c$, "dispose", 
function(){
this.source.dispose();
if (this.jsvp != null) this.jsvp.dispose();
this.source = null;
this.jsvp = null;
this.legend = null;
});
Clazz_defineMethod(c$, "pd", 
function(){
return this.jsvp.getPanelData();
});
Clazz_defineMethod(c$, "getSpectrum", 
function(){
return this.pd().getSpectrum();
});
Clazz_defineMethod(c$, "setLegend", 
function(legend){
if (this.legend != null) this.legend.dispose();
this.legend = legend;
return legend;
}, "JSV.dialog.JSVDialog");
Clazz_overrideMethod(c$, "toString", 
function(){
return ((this.id == null ? "" : this.id + ": ") + (this.frameTitle == null ? this.fileName : this.frameTitle));
});
c$.findSourceByNameOrId = Clazz_defineMethod(c$, "findSourceByNameOrId", 
function(id, panelNodes){
for (var i = panelNodes.size(); --i >= 0; ) {
var node = panelNodes.get(i);
if (id.equals(node.id) || id.equals(node.source.getSpectra().get(0).sourceID) || node.source.matchesFilePath(id)) return node.source;
}
for (var i = panelNodes.size(); --i >= 0; ) {
var node = panelNodes.get(i);
if (id.equals(node.fileName)) return node.source;
}
return null;
}, "~S,JU.Lst");
c$.findNodeById = Clazz_defineMethod(c$, "findNodeById", 
function(id, panelNodes){
if (id != null) for (var i = panelNodes.size(); --i >= 0; ) if (id.equals(panelNodes.get(i).id) || id.equals(panelNodes.get(i).frameTitle)) return panelNodes.get(i);

return null;
}, "~S,JU.Lst");
c$.findNode = Clazz_defineMethod(c$, "findNode", 
function(jsvp, panelNodes){
for (var i = panelNodes.size(); --i >= 0; ) if (panelNodes.get(i).jsvp === jsvp) return panelNodes.get(i);

return null;
}, "JSV.api.JSVPanel,JU.Lst");
c$.getSpectrumListAsString = Clazz_defineMethod(c$, "getSpectrumListAsString", 
function(panelNodes){
var sb =  new JU.SB();
for (var i = 0; i < panelNodes.size(); i++) {
var node = panelNodes.get(i);
if (!node.isView) sb.append(" ").append(node.id);
}
return sb.toString().trim();
}, "JU.Lst");
c$.isOpen = Clazz_defineMethod(c$, "isOpen", 
function(panelNodes, filePath){
if (filePath != null) for (var i = panelNodes.size(); --i >= 0; ) {
if (panelNodes.get(i).source.matchesFilePath(filePath) || filePath.equals(panelNodes.get(i).frameTitle)) return i;
}
return -1;
}, "JU.Lst,~S");
Clazz_defineMethod(c$, "setFrameTitle", 
function(name){
this.frameTitle = name;
}, "~S");
c$.getLastFileFirstNode = Clazz_defineMethod(c$, "getLastFileFirstNode", 
function(panelNodes){
var n = panelNodes.size();
var node = (n == 0 ? null : panelNodes.get(n - 1));
for (var i = n - 1; --i >= 0; ) {
if (panelNodes.get(i).source !== node.source) break;
node = panelNodes.get(i);
}
return (node == null ? null : node.jsvp);
}, "JU.Lst");
Clazz_defineMethod(c$, "getInfo", 
function(key){
var info = this.pd().getInfo(false, key);
JSV.common.Parameters.putInfo(key, info, "panelId", this.id);
JSV.common.Parameters.putInfo(key, info, "panelFileName", this.fileName);
JSV.common.Parameters.putInfo(key, info, "panelSource", this.source.getFilePath());
return info;
}, "~S");
});
;//5.0.1-v7 Mon Aug 17 10:07:10 MDT 2026
Clazz_declarePackage("JSV.common");
Clazz_load(null, "JSV.common.Parameters", ["java.util.Hashtable", "JSV.common.ScriptToken"], function(){
var c$ = Clazz_decorateAsClass(function(){
this.name = null;
this.integralMinY = 0.1;
this.integralRange = 50.0;
this.integralOffset = 30.0;
this.integralDrawAll = false;
this.viewOffset = 0;
this.peakListThreshold = NaN;
this.peakListInterpolation = "parabolic";
this.precision = 2;
this.htBooleans = null;
Clazz_instantialize(this, arguments);}, JSV.common, "Parameters", null);
Clazz_makeConstructor(c$, 
function(){
this.htBooleans =  new java.util.Hashtable();
this.setBoolean(JSV.common.ScriptToken.TITLEON, true);
this.setBoolean(JSV.common.ScriptToken.ENABLEZOOM, true);
this.setBoolean(JSV.common.ScriptToken.DISPLAY2D, true);
this.setBoolean(JSV.common.ScriptToken.COORDINATESON, true);
this.setBoolean(JSV.common.ScriptToken.PEAKTABSON, true);
this.setBoolean(JSV.common.ScriptToken.POINTSONLY, false);
this.setBoolean(JSV.common.ScriptToken.GRIDON, true);
this.setBoolean(JSV.common.ScriptToken.XSCALEON, true);
this.setBoolean(JSV.common.ScriptToken.YSCALEON, true);
this.setBoolean(JSV.common.ScriptToken.XUNITSON, true);
this.setBoolean(JSV.common.ScriptToken.YUNITSON, true);
});
Clazz_defineMethod(c$, "setName", 
function(name){
this.name = name;
return this;
}, "~S");
Clazz_defineMethod(c$, "getBooleans", 
function(){
return this.htBooleans;
});
Clazz_defineMethod(c$, "setBoolean", 
function(st, val){
this.htBooleans.put(st, Boolean.$valueOf(val));
return val;
}, "JSV.common.ScriptToken,~B");
Clazz_defineMethod(c$, "getBoolean", 
function(t){
return Boolean.TRUE === this.htBooleans.get(t);
}, "JSV.common.ScriptToken");
c$.isTrue = Clazz_defineMethod(c$, "isTrue", 
function(value){
return (value.length == 0 || Boolean.parseBoolean(value));
}, "~S");
c$.getTFToggle = Clazz_defineMethod(c$, "getTFToggle", 
function(value){
return (value.equalsIgnoreCase("TOGGLE") ? null : JSV.common.Parameters.isTrue(value) ? Boolean.TRUE : Boolean.FALSE);
}, "~S");
Clazz_defineMethod(c$, "setP", 
function(pd, st, value){
switch (st) {
default:
return;
case JSV.common.ScriptToken.COORDINATESON:
case JSV.common.ScriptToken.DISPLAY1D:
case JSV.common.ScriptToken.DISPLAY2D:
case JSV.common.ScriptToken.ENABLEZOOM:
case JSV.common.ScriptToken.GRIDON:
case JSV.common.ScriptToken.POINTSONLY:
case JSV.common.ScriptToken.PEAKTABSON:
case JSV.common.ScriptToken.REVERSEPLOT:
case JSV.common.ScriptToken.TITLEON:
case JSV.common.ScriptToken.TITLEBOLDON:
case JSV.common.ScriptToken.XSCALEON:
case JSV.common.ScriptToken.XUNITSON:
case JSV.common.ScriptToken.YSCALEON:
case JSV.common.ScriptToken.YUNITSON:
var tfToggle = JSV.common.Parameters.getTFToggle(value);
if (tfToggle != null) {
this.setBoolean(st, tfToggle.booleanValue());
break;
}if (pd == null) return;
var b = !pd.getBoolean(st);
switch (st) {
default:
break;
case JSV.common.ScriptToken.XSCALEON:
this.setBoolean(JSV.common.ScriptToken.XUNITSON, b);
pd.setBoolean(JSV.common.ScriptToken.XUNITSON, b);
break;
case JSV.common.ScriptToken.YSCALEON:
this.setBoolean(JSV.common.ScriptToken.YUNITSON, b);
pd.setBoolean(JSV.common.ScriptToken.YUNITSON, b);
break;
}
this.setBoolean(st, b);
break;
}
if (pd == null) return;
pd.setBooleans(this, st);
}, "JSV.common.PanelData,JSV.common.ScriptToken,~S");
c$.isMatch = Clazz_defineMethod(c$, "isMatch", 
function(match, key){
return match == null || key.equalsIgnoreCase(match);
}, "~S,~S");
c$.putInfo = Clazz_defineMethod(c$, "putInfo", 
function(match, info, key, value){
if (value != null && JSV.common.Parameters.isMatch(match, key)) info.put(match == null ? key : match, value);
}, "~S,java.util.Map,~S,~O");
});
;//5.0.1-v7 Mon Aug 17 10:07:10 MDT 2026
Clazz_declarePackage("JSV.common");
Clazz_load(["JSV.common.MeasurementData"], "JSV.common.PeakData", ["JU.DF", "JSV.common.Coordinate", "$.PeakPick"], function(){
var c$ = Clazz_decorateAsClass(function(){
this.thresh = 0;
this.minY = 0;
this.maxY = 0;
Clazz_instantialize(this, arguments);}, JSV.common, "PeakData", JSV.common.MeasurementData);
Clazz_defineMethod(c$, "getThresh", 
function(){
return this.thresh;
});
Clazz_overrideMethod(c$, "getDataHeader", 
function(){
return (this.spec.isHNMR() ? JSV.common.PeakData.HNMR_HEADER :  Clazz_newArray(-1, ["peak", this.spec.getXUnits(), this.spec.getYUnits()]));
});
Clazz_overrideMethod(c$, "getMeasurementListArray", 
function(units){
var data =  new Array(this.size());
var last =  Clazz_newDoubleArray(-1, [-1.0E100, 1e100, 1e100]);
var ddata;
for (var pt = 0, i = this.size(); --i >= 0; pt++) {
ddata = this.spec.getPeakListArray(this.get(i), last, this.maxY);
if (ddata.length == 2) data[pt] =  Clazz_newArray(-1, ["" + (pt + 1), JU.DF.formatDecimalDbl(ddata[0], 2), JU.DF.formatDecimalDbl(ddata[1], 4)]);
 else data[pt] =  Clazz_newArray(-1, ["" + (pt + 1), JU.DF.formatDecimalDbl(ddata[0], 4), JU.DF.formatDecimalDbl(ddata[1], 4), JU.DF.formatDecimalDbl(ddata[2], 2), (ddata[3] == 0 ? "" : JU.DF.formatDecimalDbl(ddata[3], 2)), (ddata[4] == 0 ? "" : JU.DF.formatDecimalDbl(ddata[4], 2)), (ddata[5] == 0 ? "" : JU.DF.formatDecimalDbl(ddata[5], 2))]);
}
return data;
}, "~S");
Clazz_overrideMethod(c$, "getMeasurementListArrayReal", 
function(units){
var data =  Clazz_newDoubleArray (this.size(), 0);
var last =  Clazz_newDoubleArray(-1, [-1.0E100, 1e100, 1e100]);
for (var pt = 0, i = this.size(); --i >= 0; pt++) data[pt] = this.spec.getPeakListArray(this.get(i), last, this.maxY);

return data;
}, "~S");
Clazz_defineMethod(c$, "getInfo", 
function(info){
info.put("interpolation", this.myParams.peakListInterpolation);
info.put("threshold", Double.$valueOf(this.myParams.peakListThreshold));
Clazz_superCall(this, JSV.common.PeakData, "getInfo", [info]);
}, "java.util.Map");
Clazz_defineMethod(c$, "setPeakList", 
function(p, precision, view){
this.precision = (precision == -2147483648 ? this.spec.getDefaultUnitPrecision() : precision);
var xyCoords = this.spec.getXYCoords();
if (xyCoords.length < 3) return;
this.clear();
if (p != null) {
this.myParams.peakListInterpolation = p.peakListInterpolation;
this.myParams.peakListThreshold = p.peakListThreshold;
}var doInterpolate = (this.myParams.peakListInterpolation.equals("parabolic"));
var isInverted = this.spec.isInverted();
this.minY = view.minYOnScale;
this.maxY = view.maxYOnScale;
var minX = view.minXOnScale;
var maxX = view.maxXOnScale;
this.thresh = this.myParams.peakListThreshold;
if (Double.isNaN(this.thresh)) this.thresh = this.myParams.peakListThreshold = (this.minY + this.maxY) / 2;
var yLast = 0;
var y3 =  Clazz_newDoubleArray(-1, [xyCoords[0].getYVal(), yLast = xyCoords[1].getYVal(), 0]);
var n = 0;
if (isInverted) for (var i = 2; i < xyCoords.length; i++) {
var y = y3[i % 3] = xyCoords[i].getYVal();
if (yLast < this.thresh && y3[(i - 2) % 3] > yLast && yLast < y) {
var x = (doInterpolate ? JSV.common.Coordinate.parabolicInterpolation(xyCoords, i - 1) : xyCoords[i - 1].getXVal());
if (x >= minX || x <= maxX) {
var m =  new JSV.common.PeakPick().setValue(x, y, this.spec, null, 0);
this.addLast(m);
if (++n == 100) break;
}}yLast = y;
}
 else for (var i = 2; i < xyCoords.length; i++) {
var y = y3[i % 3] = xyCoords[i].getYVal();
if (yLast > this.thresh && y3[(i - 2) % 3] < yLast && yLast > y) {
var x = (doInterpolate ? JSV.common.Coordinate.parabolicInterpolation(xyCoords, i - 1) : xyCoords[i - 1].getXVal());
if (x >= minX && x <= maxX) {
var m =  new JSV.common.PeakPick().setValue(x, y, this.spec, JU.DF.formatDecimalDbl(x, precision), x);
this.addLast(m);
if (++n == 100) break;
}}yLast = y;
}
}, "JSV.common.Parameters,~N,JSV.common.ScaleData");
c$.HNMR_HEADER =  Clazz_newArray(-1, ["peak", "shift/ppm", "intens", "shift/hz", "diff/hz", "2-diff", "3-diff"]);
});
;//5.0.1-v7 Mon Aug 17 10:07:10 MDT 2026
Clazz_declarePackage("JSV.common");
Clazz_load(null, "JSV.common.PeakInfo", ["JU.PT"], function(){
var c$ = Clazz_decorateAsClass(function(){
this.xMin = 0;
this.xMax = 0;
this.yMin = 0;
this.yMax = 0;
this.px0 = 0;
this.px1 = 0;
this.stringInfo = null;
this.type = null;
this.type2 = null;
this.index = null;
this.file = null;
this.filePathForwardSlash = null;
this.title = null;
this.model = null;
this.atoms = null;
this.id = null;
this.spectrum = null;
this._match = null;
this.atomKey = null;
Clazz_instantialize(this, arguments);}, JSV.common, "PeakInfo", null);
/*LV!1824 unnec constructor*/Clazz_makeConstructor(c$, 
function(s){
if (s == null) return;
this.stringInfo = s;
this.type = JU.PT.getQuotedAttribute(s, "type");
if (this.type == null) this.type = "";
this.type = this.type.toUpperCase();
var pt = this.type.indexOf('/');
this.type2 = (pt < 0 ? "" : JSV.common.PeakInfo.fixType(this.type.substring(this.type.indexOf('/') + 1)));
if (pt >= 0) this.type = JSV.common.PeakInfo.fixType(this.type.substring(0, pt)) + "/" + this.type2;
 else this.type = JSV.common.PeakInfo.fixType(this.type);
this.id = JU.PT.getQuotedAttribute(s, "id");
this.index = JU.PT.getQuotedAttribute(s, "index");
this.file = JU.PT.getQuotedAttribute(s, "file");
System.out.println("PeakInfo file=" + this.file);
this.filePathForwardSlash = (this.file == null ? null : this.file.$replace('\\', '/'));
this.model = JU.PT.getQuotedAttribute(s, "model");
var isBaseModel = s.contains("baseModel=\"\"");
if (!isBaseModel) this.atoms = JU.PT.getQuotedAttribute(s, "atoms");
this.atomKey = "," + this.atoms + ",";
this.title = JU.PT.getQuotedAttribute(s, "title");
this._match = JU.PT.getQuotedAttribute(s, "_match");
this.xMax = JU.PT.parseFloat(JU.PT.getQuotedAttribute(s, "xMax"));
this.xMin = JU.PT.parseFloat(JU.PT.getQuotedAttribute(s, "xMin"));
this.yMax = JU.PT.parseFloat(JU.PT.getQuotedAttribute(s, "yMax"));
this.yMin = JU.PT.parseFloat(JU.PT.getQuotedAttribute(s, "yMin"));
}, "~S");
Clazz_defineMethod(c$, "isClearAll", 
function(){
return (this.spectrum == null);
});
Clazz_defineMethod(c$, "getType", 
function(){
return this.type;
});
Clazz_defineMethod(c$, "getAtoms", 
function(){
return this.atoms;
});
Clazz_defineMethod(c$, "getXMax", 
function(){
return this.xMax;
});
Clazz_defineMethod(c$, "getXMin", 
function(){
return this.xMin;
});
Clazz_defineMethod(c$, "getYMin", 
function(){
return this.yMin;
});
Clazz_defineMethod(c$, "getYMax", 
function(){
return this.yMax;
});
Clazz_defineMethod(c$, "getX", 
function(){
return (this.xMax + this.xMin) / 2;
});
Clazz_defineMethod(c$, "getMatch", 
function(){
return this._match;
});
c$.fixType = Clazz_defineMethod(c$, "fixType", 
function(type){
return (type.equals("HNMR") ? "1HNMR" : type.equals("CNMR") ? "13CNMR" : type);
}, "~S");
Clazz_overrideMethod(c$, "toString", 
function(){
return this.stringInfo;
});
Clazz_defineMethod(c$, "getIndex", 
function(){
return this.index;
});
Clazz_defineMethod(c$, "getTitle", 
function(){
return this.title;
});
Clazz_defineMethod(c$, "checkFileIndex", 
function(filePath, sIndex, sAtomKey){
return (sAtomKey != null ? this.atomKey.indexOf(sAtomKey) >= 0 : sIndex.equals(this.index) && (filePath.equals(this.file) || filePath.equals(this.filePathForwardSlash)));
}, "~S,~S,~S");
Clazz_defineMethod(c$, "checkFileTypeModel", 
function(filePath, type, model){
return filePath.equals(this.file) && this.checkModel(model) && this.type.endsWith(type);
}, "~S,~S,~S");
Clazz_defineMethod(c$, "checkTypeModel", 
function(type, model){
return this.checkType(type) && this.checkModel(model);
}, "~S,~S");
Clazz_defineMethod(c$, "checkModel", 
function(model){
return (model != null && model.equals(this.model));
}, "~S");
Clazz_defineMethod(c$, "checkType", 
function(type){
return (type.endsWith(this.type));
}, "~S");
Clazz_defineMethod(c$, "checkTypeMatch", 
function(pi){
return (this.checkType(pi.type) && (this.checkId(pi._match) || this.checkModel(pi._match) || this.title.toUpperCase().indexOf(pi._match) >= 0));
}, "JSV.common.PeakInfo");
Clazz_defineMethod(c$, "checkId", 
function(match){
if (match == null) return false;
return (this.id != null && match.toUpperCase().startsWith("ID=") && match.substring(3).equals(this.id) || (match = match.toUpperCase()).startsWith("INDEX=") && match.equals("INDEX=" + this.index) || match.startsWith("#=") && match.equals("#=" + this.index));
}, "~S");
Clazz_defineMethod(c$, "getModel", 
function(){
return this.model;
});
Clazz_defineMethod(c$, "getFilePath", 
function(){
return this.file;
});
Clazz_defineMethod(c$, "autoSelectOnLoad", 
function(){
return (this.type.startsWith("GC"));
});
Clazz_defineMethod(c$, "setPixelRange", 
function(x0, x1){
this.px0 = x0;
this.px1 = x1;
}, "~N,~N");
Clazz_defineMethod(c$, "checkRange", 
function(xPixel, xVal){
if (xPixel != 2147483647 ? (this.px0 <= xPixel && this.px1 >= xPixel) : xVal >= this.xMin && xVal <= this.xMax) {
return Math.abs(xVal - this.getX());
}return 1e100;
}, "~N,~N");
Clazz_defineMethod(c$, "getXPixel", 
function(){
return Clazz_doubleToInt((this.px0 + this.px1) / 2);
});
});
;//5.0.1-v7 Mon Aug 17 10:07:10 MDT 2026
Clazz_declarePackage("JSV.common");
Clazz_load(["JSV.common.Measurement"], "JSV.common.PeakPick", null, function(){
var c$ = Clazz_declareType(JSV.common, "PeakPick", JSV.common.Measurement);
Clazz_defineMethod(c$, "setValue", 
function(x, y, spec, text, value){
if (text == null) {
this.set(x, y);
this.setPt2(spec, false);
} else {
this.setA(x, y, spec, text, false, false, 0, 6);
this.value = value;
this.setPt2(this.getXVal(), this.getYVal());
}return this;
}, "~N,~N,JSV.common.Spectrum,~S,~N");
});
;//5.0.1-v7 Mon Aug 17 10:07:10 MDT 2026
Clazz_declarePackage("JSV.common");
Clazz_load(["java.util.EventObject"], "JSV.common.PeakPickEvent", null, function(){
var c$ = Clazz_decorateAsClass(function(){
this.coord = null;
this.peakInfo = null;
Clazz_instantialize(this, arguments);}, JSV.common, "PeakPickEvent", java.util.EventObject);
Clazz_makeConstructor(c$, 
function(source, coord, peakInfo){
Clazz_superConstructor(this, JSV.common.PeakPickEvent, [source]);
this.coord = coord;
this.peakInfo = (peakInfo == null ? null : peakInfo);
}, "~O,JSV.common.Coordinate,JSV.common.PeakInfo");
Clazz_defineMethod(c$, "getCoord", 
function(){
return this.coord;
});
Clazz_defineMethod(c$, "getPeakInfo", 
function(){
return this.peakInfo;
});
Clazz_overrideMethod(c$, "toString", 
function(){
return (this.peakInfo == null ? null : this.peakInfo.toString());
});
});
;//5.0.1-v7 Mon Aug 17 10:07:10 MDT 2026
Clazz_declarePackage("JSV.common");
Clazz_load(["JSV.common.Coordinate", "$.ScriptToken"], "JSV.common.PlotWidget", null, function(){
var c$ = Clazz_decorateAsClass(function(){
this.xPixel0 = 0;
this.yPixel0 = 0;
this.xPixel1 = 0;
this.yPixel1 = 0;
this.isPin = false;
this.isPinOrCursor = false;
this.isXtype = false;
this.is2D = false;
this.is2Donly = false;
this.isEnabled = true;
this.isVisible = false;
this.name = null;
this.color = null;
Clazz_instantialize(this, arguments);}, JSV.common, "PlotWidget", JSV.common.Coordinate);
Clazz_prepareFields (c$, function(){
this.color = JSV.common.ScriptToken.PLOTCOLOR;
});
Clazz_makeConstructor(c$, 
function(name){
Clazz_superConstructor (this, JSV.common.PlotWidget, []);
this.name = name;
this.isPin = (name.charAt(0) == 'p');
this.isPinOrCursor = (name.charAt(0) != 'z');
this.isXtype = (name.indexOf("x") >= 0);
this.is2D = (name.indexOf("2D") >= 0);
this.is2Donly = (this.is2D && name.charAt(0) == 'p');
}, "~S");
Clazz_overrideMethod(c$, "toString", 
function(){
return this.name + (!this.isPinOrCursor ? "" + this.xPixel0 + " " + this.yPixel0 + " / " + this.xPixel1 + " " + this.yPixel1 : " x=" + this.getXVal() + "/" + this.xPixel0 + " y=" + this.getYVal() + "/" + this.yPixel0);
});
Clazz_defineMethod(c$, "selected", 
function(xPixel, yPixel){
return (this.isVisible && Math.abs(xPixel - this.xPixel0) < 5 && Math.abs(yPixel - this.yPixel0) < 5);
}, "~N,~N");
Clazz_defineMethod(c$, "setX", 
function(x, xPixel){
this.setXVal(x);
this.xPixel0 = this.xPixel1 = xPixel;
}, "~N,~N");
Clazz_defineMethod(c$, "setY", 
function(y, yPixel){
this.setYVal(y);
this.yPixel0 = this.yPixel1 = yPixel;
}, "~N,~N");
Clazz_defineMethod(c$, "getValue", 
function(){
return (this.isXtype ? this.getXVal() : this.getYVal());
});
Clazz_defineMethod(c$, "setEnabled", 
function(enabled){
this.isEnabled = enabled;
}, "~B");
});
;//5.0.1-v7 Mon Aug 17 10:07:10 MDT 2026
Clazz_declarePackage("JSV.common");
(function(){
var c$ = Clazz_decorateAsClass(function(){
this.imageableX = 0;
this.imageableY = 0;
this.paperHeight = 0;
this.paperWidth = 0;
this.imageableHeight = 0;
this.imageableWidth = 0;
this.layout = "landscape";
this.position = "fit to page";
this.showGrid = true;
this.showXScale = true;
this.showYScale = true;
this.showTitles = true;
this.font = "Helvetica";
this.paper = null;
this.asPDF = true;
this.title = null;
this.date = null;
Clazz_instantialize(this, arguments);}, JSV.common, "PrintLayout", null);
Clazz_prepareFields (c$, function(){
this.paperHeight = Clazz_floatToInt(Math.min(11, 11.69) * 72);
this.paperWidth = Clazz_floatToInt(Math.min(8.5, 8.27) * 72);
this.imageableHeight = this.paperHeight;
this.imageableWidth = this.paperWidth;
});
Clazz_makeConstructor(c$, 
function(pd){
if (pd != null) {
this.asPDF = true;
pd.setDefaultPrintOptions(this);
}}, "JSV.common.PanelData");
})();
;//5.0.1-v7 Mon Aug 17 10:07:10 MDT 2026
Clazz_declarePackage("JSV.common");
Clazz_load(null, "JSV.common.RepaintManager", ["JSV.common.JSViewer"], function(){
var c$ = Clazz_decorateAsClass(function(){
this.repaintPending = false;
this.vwr = null;
Clazz_instantialize(this, arguments);}, JSV.common, "RepaintManager", null);
Clazz_makeConstructor(c$, 
function(viewer){
this.vwr = viewer;
}, "JSV.common.JSViewer");
Clazz_defineMethod(c$, "refresh", 
function(){
if (this.repaintPending) {
return false;
}this.repaintPending = true;
var applet = this.vwr.html5Applet;
var jmol = (JSV.common.JSViewer.isJS && !JSV.common.JSViewer.isSwingJS ? JSV.common.JSViewer.jsmolObject : null);
if (jmol == null) {
this.vwr.selectedPanel.repaint();
} else {
jmol.repaint(applet, false);
this.repaintDone();
}return true;
});
Clazz_defineMethod(c$, "repaintDone", 
function(){
this.repaintPending = false;
this.notify();
});
});
;//5.0.1-v7 Mon Aug 17 10:07:10 MDT 2026
Clazz_declarePackage("JSV.common");
Clazz_load(null, "JSV.common.ScaleData", ["JSV.common.Coordinate"], function(){
var c$ = Clazz_decorateAsClass(function(){
this.initMinYOnScale = 0;
this.initMaxYOnScale = 0;
this.initMinY = 0;
this.initMaxY = 0;
this.startDataPointIndex = 0;
this.endDataPointIndex = 0;
this.pointCount = 0;
this.minX = 0;
this.maxX = 0;
this.firstX = NaN;
this.minXOnScale = 0;
this.maxXOnScale = 0;
this.specShift = 0;
this.precision = null;
this.exportPrecision = null;
this.steps = null;
this.minorTickCounts = null;
this.minYOnScale = 0;
this.maxYOnScale = 0;
this.minY = 0;
this.maxY = 0;
this.isShiftZoomedY = false;
this.spectrumScaleFactor = 1;
this.spectrumYRef = 0;
this.userYFactor = 1;
this.firstY = 0;
this.minY2D = 0;
this.maxY2D = 0;
this.xFactorForScale = 0;
this.yFactorForScale = 0;
Clazz_instantialize(this, arguments);}, JSV.common, "ScaleData", null);
Clazz_prepareFields (c$, function(){
this.precision =  Clazz_newIntArray (2, 0);
this.exportPrecision =  Clazz_newIntArray (2, 0);
this.steps =  Clazz_newDoubleArray (2, 0);
this.minorTickCounts =  Clazz_newIntArray (2, 0);
});
Clazz_makeConstructor(c$, 
function(){
});
Clazz_makeConstructor(c$, 
function(iStart, iEnd){
this.startDataPointIndex = iStart;
this.endDataPointIndex = iEnd;
this.pointCount = this.endDataPointIndex - this.startDataPointIndex + 1;
}, "~N,~N");
Clazz_makeConstructor(c$, 
function(coords, start, end, isContinuous, isInverted){
this.minX = JSV.common.Coordinate.getMinX(coords, start, end);
this.maxX = JSV.common.Coordinate.getMaxX(coords, start, end);
this.minY = JSV.common.Coordinate.getMinY(coords, start, end);
if (this.minY > 0 && !isContinuous) this.minY = 0;
this.maxY = JSV.common.Coordinate.getMaxY(coords, start, end);
this.setScale(isContinuous, isInverted);
}, "~A,~N,~N,~B,~B");
Clazz_defineMethod(c$, "setScale", 
function(isContinuous, isInverted){
this.setXScale();
if (!isContinuous) this.maxXOnScale += this.steps[0] / 2;
this.setYScale(this.minY, this.maxY, true, isInverted);
}, "~B,~B");
Clazz_defineMethod(c$, "setXScale", 
function(){
var xStep = this.setScaleParams(this.minX, this.maxX, 0);
this.firstX = Math.floor(this.minX / xStep) * xStep;
if (Math.abs((this.minX - this.firstX) / xStep) > 0.0001) this.firstX += xStep;
this.minXOnScale = this.minX;
this.maxXOnScale = this.maxX;
});
Clazz_defineMethod(c$, "isYZeroOnScale", 
function(){
return (this.minYOnScale < this.spectrumYRef && this.maxYOnScale > this.spectrumYRef);
});
Clazz_defineMethod(c$, "setYScale", 
function(minY, maxY, setScaleMinMax, isInverted){
if (minY == 0 && maxY == 0) maxY = 1;
if (this.isShiftZoomedY) {
minY = this.minYOnScale;
maxY = this.maxYOnScale;
}var yStep = this.setScaleParams(minY, maxY, 1);
var dy = (isInverted ? yStep / 2 : yStep / 4);
var dy2 = (isInverted ? yStep / 4 : yStep / 2);
if (!this.isShiftZoomedY) {
this.minYOnScale = (minY == 0 ? 0 : setScaleMinMax ? dy * Math.floor(minY / dy) : minY);
this.maxYOnScale = (setScaleMinMax ? dy2 * Math.ceil(maxY * 1.05 / dy2) : maxY);
}this.firstY = (minY == 0 ? 0 : Math.floor(minY / dy) * dy);
if (this.minYOnScale < 0 && this.maxYOnScale > 0) {
this.firstY = 0;
while (this.firstY - yStep > this.minYOnScale) this.firstY -= yStep;

} else if (this.minYOnScale != 0 && Math.abs((minY - this.firstY) / dy) > 0.0001) {
this.firstY += dy;
}if (setScaleMinMax) {
this.initMinYOnScale = this.minYOnScale;
this.initMaxYOnScale = this.maxYOnScale;
this.initMinY = minY;
this.initMaxY = maxY;
}}, "~N,~N,~B,~B");
Clazz_defineMethod(c$, "scale2D", 
function(f){
var dy = this.maxY - this.minY;
if (f == 1) {
this.maxY = this.initMaxY;
this.minY = this.initMinY;
return;
}this.maxY = this.minY + dy / f;
}, "~N");
Clazz_defineMethod(c$, "setXRange", 
function(x1, x2){
this.minX = x1;
this.maxX = x2;
this.setXScale();
}, "~N,~N");
c$.getXRange = Clazz_defineMethod(c$, "getXRange", 
function(i, xyCoords, initX, finalX, iStart, iEnd, startIndices, endIndices){
var index = 0;
var ptCount = 0;
for (index = iStart; index <= iEnd; index++) {
if (xyCoords[index].getXVal() >= initX) {
startIndices[i] = index;
ptCount = 1;
break;
}}
while (++index <= iEnd && xyCoords[index].getXVal() <= finalX) {
ptCount++;
}
endIndices[i] = startIndices[i] + ptCount - 1;
return ptCount;
}, "~N,~A,~N,~N,~N,~N,~A,~A");
Clazz_defineMethod(c$, "setScaleParams", 
function(min, max, i){
var dx = (max == min ? 1 : Math.abs(max - min) / 14);
var log = Math.log10(Math.abs(dx));
var exp = Clazz_doubleToInt(Math.floor(log));
this.exportPrecision[i] = exp;
this.precision[i] = (exp <= 0 ? Math.min(8, 1 - exp) : exp > 3 ? -2 : 0);
var j = 0;
var dec = Math.pow(10, log - exp);
while (dec > JSV.common.ScaleData.NTICKS[j]) {
j++;
}
this.steps[i] = Math.pow(10, exp) * JSV.common.ScaleData.NTICKS[j];
log = Math.log10(Math.abs(this.steps[i] * 1.0001e5));
var mantissa = log - Math.floor(log);
var n = 0;
for (j = 0; j < JSV.common.ScaleData.NTICKS.length; j++) if (Math.abs(mantissa - JSV.common.ScaleData.LOGTICKS[j]) < 0.001) {
n = JSV.common.ScaleData.NTICKS[j];
break;
}
this.minorTickCounts[i] = n;
return this.steps[i];
}, "~N,~N,~N");
Clazz_defineMethod(c$, "isInRangeX", 
function(x){
return (x >= this.minX && x <= this.maxX);
}, "~N");
Clazz_defineMethod(c$, "addSpecShift", 
function(dx){
this.specShift += dx;
this.minX += dx;
this.maxX += dx;
this.minXOnScale += dx;
this.maxXOnScale += dx;
this.firstX += dx;
}, "~N");
Clazz_defineMethod(c$, "getInfo", 
function(info){
info.put("specShift", Double.$valueOf(this.specShift));
info.put("minX", Double.$valueOf(this.minX));
info.put("maxX", Double.$valueOf(this.maxX));
info.put("minXOnScale", Double.$valueOf(this.minXOnScale));
info.put("maxXOnScale", Double.$valueOf(this.maxXOnScale));
info.put("minY", Double.$valueOf(this.minY));
info.put("maxY", Double.$valueOf(this.maxY));
info.put("minYOnScale", Double.$valueOf(this.minYOnScale));
info.put("maxYOnScale", Double.$valueOf(this.maxYOnScale));
info.put("minorTickCountX", Integer.$valueOf(this.minorTickCounts[0]));
info.put("xStep", Double.$valueOf(this.steps[0]));
return info;
}, "java.util.Map");
Clazz_defineMethod(c$, "setMinMax", 
function(minX, maxX, minY, maxY){
this.minX = minX;
this.maxX = maxX;
this.minY = minY;
this.maxY = maxY;
}, "~N,~N,~N,~N");
Clazz_defineMethod(c$, "toX", 
function(xPixel, xPixel1, drawXAxisLeftToRight){
return this.toXScaled(xPixel, xPixel1, drawXAxisLeftToRight, this.xFactorForScale);
}, "~N,~N,~B");
Clazz_defineMethod(c$, "toX0", 
function(xPixel, xPixel0, xPixel1, drawXAxisLeftToRight){
return this.toXScaled(xPixel, xPixel1, drawXAxisLeftToRight, (this.maxXOnScale - this.minXOnScale) / (xPixel1 - xPixel0));
}, "~N,~N,~N,~B");
Clazz_defineMethod(c$, "toXScaled", 
function(xPixel, xPixel1, drawXAxisLeftToRight, factor){
return (drawXAxisLeftToRight ? this.maxXOnScale - (xPixel1 - xPixel) * factor : this.minXOnScale + (xPixel1 - xPixel) * factor);
}, "~N,~N,~B,~N");
Clazz_defineMethod(c$, "toPixelX", 
function(dx, xPixel0, xPixel1, drawXAxisLeftToRight){
return this.toPixelXScaled(dx, xPixel0, xPixel1, drawXAxisLeftToRight, this.xFactorForScale);
}, "~N,~N,~N,~B");
Clazz_defineMethod(c$, "toPixelX0", 
function(dx, xPixel0, xPixel1, drawXAxisLeftToRight){
return this.toPixelXScaled(dx, xPixel0, xPixel1, drawXAxisLeftToRight, (this.maxXOnScale - this.minXOnScale) / (xPixel1 - xPixel0));
}, "~N,~N,~N,~B");
Clazz_defineMethod(c$, "toPixelXScaled", 
function(dx, xPixel0, xPixel1, drawXAxisLeftToRight, factor){
var x = Clazz_doubleToInt((dx - this.minXOnScale) / factor);
return (drawXAxisLeftToRight ? xPixel0 + x : xPixel1 - x);
}, "~N,~N,~N,~B,~N");
Clazz_defineMethod(c$, "toY", 
function(yPixel, yPixel0){
return this.maxYOnScale + (yPixel0 - yPixel) * this.yFactorForScale;
}, "~N,~N");
Clazz_defineMethod(c$, "toY0", 
function(yPixel, yPixel0, yPixel1){
var factor = (this.maxYOnScale - this.minYOnScale) / (yPixel1 - yPixel0);
var y = this.maxYOnScale + (yPixel0 - yPixel) * factor;
return Math.max(this.minYOnScale, Math.min(y, this.maxYOnScale));
}, "~N,~N,~N");
Clazz_defineMethod(c$, "toPixelY", 
function(yVal, yPixel1){
return (Double.isNaN(yVal) ? -2147483648 : yPixel1 - Clazz_doubleToInt(((yVal - this.spectrumYRef) * this.userYFactor + this.spectrumYRef - this.minYOnScale) / this.yFactorForScale));
}, "~N,~N");
Clazz_defineMethod(c$, "toPixelY0", 
function(y, yPixel0, yPixel1){
var factor = (this.maxYOnScale - this.minYOnScale) / (yPixel1 - yPixel0);
return Clazz_doubleToInt(yPixel0 + (this.maxYOnScale - y) / factor);
}, "~N,~N,~N");
Clazz_defineMethod(c$, "setXYScale", 
function(xPixels, yPixels, isInverted){
var yRef = this.spectrumYRef;
var f = this.spectrumScaleFactor;
var useInit = (f != 1 || this.isShiftZoomedY);
var minY = (useInit ? this.initMinYOnScale : this.minY);
var maxY = (useInit ? this.initMaxYOnScale : this.maxY);
if (useInit && yRef < minY) yRef = minY;
if (useInit && yRef > maxY) yRef = maxY;
this.setYScale((minY - yRef) / f + yRef, (maxY - yRef) / f + yRef, f == 1, isInverted);
this.xFactorForScale = (this.maxXOnScale - this.minXOnScale) / (xPixels - 1);
this.yFactorForScale = (this.maxYOnScale - this.minYOnScale) / (yPixels - 1);
}, "~N,~N,~B");
c$.copyScaleFactors = Clazz_defineMethod(c$, "copyScaleFactors", 
function(sdFrom, sdTo){
for (var i = 0; i < sdFrom.length; i++) {
sdTo[i].spectrumScaleFactor = sdFrom[i].spectrumScaleFactor;
sdTo[i].spectrumYRef = sdFrom[i].spectrumYRef;
sdTo[i].userYFactor = sdFrom[i].userYFactor;
sdTo[i].specShift = sdFrom[i].specShift;
sdTo[i].isShiftZoomedY = sdFrom[i].isShiftZoomedY;
}
}, "~A,~A");
c$.copyYScales = Clazz_defineMethod(c$, "copyYScales", 
function(sdFrom, sdTo){
for (var i = 0; i < sdFrom.length; i++) {
sdTo[i].initMinYOnScale = sdFrom[i].initMinYOnScale;
sdTo[i].initMaxYOnScale = sdFrom[i].initMaxYOnScale;
sdTo[i].minY = sdFrom[i].minY;
sdTo[i].maxY = sdFrom[i].maxY;
if (sdFrom[i].isShiftZoomedY) {
sdTo[i].isShiftZoomedY = true;
sdTo[i].minYOnScale = sdFrom[i].minYOnScale;
sdTo[i].maxYOnScale = sdFrom[i].maxYOnScale;
}}
}, "~A,~A");
c$.setDataPointIndices = Clazz_defineMethod(c$, "setDataPointIndices", 
function(graphsTemp, initX, finalX, minPoints, startIndices, endIndices){
var nSpectraOK = 0;
var nSpectra = graphsTemp.size();
for (var i = 0; i < nSpectra; i++) {
var xyCoords = graphsTemp.get(i).getXYCoords();
if (JSV.common.ScaleData.getXRange(i, xyCoords, initX, finalX, 0, xyCoords.length - 1, startIndices, endIndices) >= minPoints) nSpectraOK++;
}
return (nSpectraOK == nSpectra);
}, "JU.Lst,~N,~N,~N,~A,~A");
c$.fixScale = Clazz_defineMethod(c$, "fixScale", 
function(map){
if (map.isEmpty()) return;
while (true) {
for (var entry, $entry = map.entrySet().iterator (); $entry.hasNext()&& ((entry = $entry.next ()) || true);) {
var s = entry.getValue();
var pt = s.indexOf("E");
if (pt >= 0) s = s.substring(0, pt);
if (s.indexOf(".") < 0) return;
if (!s.endsWith("0") && !s.endsWith(".")) return;
}
for (var entry, $entry = map.entrySet().iterator (); $entry.hasNext()&& ((entry = $entry.next ()) || true);) {
var s = entry.getValue();
var pt = s.indexOf("E");
if (pt >= 0) entry.setValue(s.substring(0, pt - 1) + s.substring(pt));
 else entry.setValue(s.substring(0, s.length - 1));
}
}
}, "java.util.Map");
Clazz_defineMethod(c$, "scaleBy", 
function(f){
if (this.isShiftZoomedY) {
var center = (this.isYZeroOnScale() ? this.spectrumYRef : (this.minYOnScale + this.maxYOnScale) / 2);
this.minYOnScale = center - (center - this.minYOnScale) / f;
this.maxYOnScale = center - (center - this.maxYOnScale) / f;
} else {
this.spectrumScaleFactor *= f;
}}, "~N");
c$.NTICKS =  Clazz_newIntArray(-1, [2, 5, 10, 10]);
c$.LOGTICKS =  Clazz_newDoubleArray(-1, [Math.log10(2), Math.log10(5), 0, 1]);
});
;//5.0.1-v7 Mon Aug 17 10:07:10 MDT 2026
Clazz_declarePackage("JSV.common");
Clazz_load(["java.lang.Enum"], "JSV.common.ScriptToken", ["java.util.Hashtable", "JU.Lst", "$.PT", "$.SB", "JSV.common.ScriptTokenizer"], function(){
var c$ = Clazz_decorateAsClass(function(){
this.tip = null;
this.description = null;
Clazz_instantialize(this, arguments);}, JSV.common, "ScriptToken", Enum);
Clazz_defineMethod(c$, "getTip", 
function(){
return "  " + (this.tip === "T" ? "TRUE/FALSE/TOGGLE" : this.tip === "TF" ? "TRUE or FALSE" : this.tip === "C" ? "COLOR" : this.tip);
});
Clazz_makeConstructor(c$, 
function(){
});
Clazz_makeConstructor(c$, 
function(tip){
this.tip = tip;
this.description = "";
}, "~S");
Clazz_makeConstructor(c$, 
function(tip, description){
this.tip = tip;
this.description = "-- " + description;
}, "~S,~S");
c$.getParams = Clazz_defineMethod(c$, "getParams", 
function(){
if (JSV.common.ScriptToken.htParams == null) {
JSV.common.ScriptToken.htParams =  new java.util.Hashtable();
for (var item, $item = 0, $$item = JSV.common.ScriptToken.values(); $item < $$item.length && ((item = $$item[$item]) || true); $item++) JSV.common.ScriptToken.htParams.put(item.name(), item);

}return JSV.common.ScriptToken.htParams;
});
c$.getScriptToken = Clazz_defineMethod(c$, "getScriptToken", 
function(name){
var st = JSV.common.ScriptToken.getParams().get(name.toUpperCase());
return (st == null ? JSV.common.ScriptToken.UNKNOWN : st);
}, "~S");
c$.getScriptTokenList = Clazz_defineMethod(c$, "getScriptTokenList", 
function(name, isExact){
if (name != null) name = name.toUpperCase();
var list =  new JU.Lst();
if (isExact) {
var st = JSV.common.ScriptToken.getScriptToken(name);
if (st != null) list.addLast(st);
} else {
for (var entry, $entry = JSV.common.ScriptToken.getParams().entrySet().iterator (); $entry.hasNext()&& ((entry = $entry.next ()) || true);) if ((name == null || entry.getKey().startsWith(name)) && entry.getValue().tip != null) list.addLast(entry.getValue());

}return list;
}, "~S,~B");
c$.getValue = Clazz_defineMethod(c$, "getValue", 
function(st, params, cmd){
if (!params.hasMoreTokens()) return "";
switch (st) {
default:
return JSV.common.ScriptTokenizer.nextStringToken(params, true);
case JSV.common.ScriptToken.CLOSE:
case JSV.common.ScriptToken.GETPROPERTY:
case JSV.common.ScriptToken.INTEGRATION:
case JSV.common.ScriptToken.INTEGRATE:
case JSV.common.ScriptToken.JMOL:
case JSV.common.ScriptToken.LABEL:
case JSV.common.ScriptToken.LOAD:
case JSV.common.ScriptToken.PEAK:
case JSV.common.ScriptToken.PLOTCOLORS:
case JSV.common.ScriptToken.YSCALE:
case JSV.common.ScriptToken.WRITE:
return JSV.common.ScriptToken.removeCommandName(cmd);
case JSV.common.ScriptToken.SELECT:
case JSV.common.ScriptToken.OVERLAY:
case JSV.common.ScriptToken.VIEW:
case JSV.common.ScriptToken.ZOOM:
return JSV.common.ScriptToken.removeCommandName(cmd).$replace(',', ' ').trim();
}
}, "JSV.common.ScriptToken,JSV.common.ScriptTokenizer,~S");
c$.removeCommandName = Clazz_defineMethod(c$, "removeCommandName", 
function(cmd){
var pt = cmd.indexOf(" ");
if (pt < 0) return "";
return cmd.substring(pt).trim();
}, "~S");
c$.getKey = Clazz_defineMethod(c$, "getKey", 
function(eachParam){
var key = eachParam.nextToken();
if (key.startsWith("#") || key.startsWith("//")) return null;
if (key.equalsIgnoreCase("SET")) key = eachParam.nextToken();
return key.toUpperCase();
}, "JSV.common.ScriptTokenizer");
c$.getTokens = Clazz_defineMethod(c$, "getTokens", 
function(value){
if (value.startsWith("'") && value.endsWith("'")) value = "\"" + JU.PT.trim(value, "'") + "\"";
var tokens =  new JU.Lst();
var st =  new JSV.common.ScriptTokenizer(value, false);
while (st.hasMoreTokens()) {
var s = JSV.common.ScriptTokenizer.nextStringToken(st, false);
if (s.startsWith("//") || s.startsWith("#")) break;
tokens.addLast(s);
}
return tokens;
}, "~S");
c$.getNameList = Clazz_defineMethod(c$, "getNameList", 
function(list){
if (list.size() == 0) return "";
var sb =  new JU.SB();
for (var i = 0; i < list.size(); i++) sb.append(",").append(list.get(i).toString());

return sb.toString().substring(1);
}, "JU.Lst");
Clazz_defineMethod(c$, "getDescription", 
function(){
return this.description;
});
c$.htParams = null;
Clazz_defineEnumConstant(c$, "UNKNOWN", 0, []);
Clazz_defineEnumConstant(c$, "APPLETID", 1, []);
Clazz_defineEnumConstant(c$, "APPLETREADYCALLBACKFUNCTIONNAME", 2, []);
Clazz_defineEnumConstant(c$, "AUTOINTEGRATE", 3, ["TF", "automatically integrate an NMR spectrum"]);
Clazz_defineEnumConstant(c$, "BACKGROUNDCOLOR", 4, ["C", "set the background color"]);
Clazz_defineEnumConstant(c$, "CLOSE", 5, ["spectrumId or fileName or ALL or VIEWS or SIMULATIONS", "close one or more views or simulations"]);
Clazz_defineEnumConstant(c$, "COMPOUNDMENUON", 6, []);
Clazz_defineEnumConstant(c$, "COORDCALLBACKFUNCTIONNAME", 7, []);
Clazz_defineEnumConstant(c$, "COORDINATESCOLOR", 8, ["C", "set the color of the coordinates shown in the upper right-hand corner"]);
Clazz_defineEnumConstant(c$, "COORDINATESON", 9, ["T", "turn on or off the coordinates shown in the upper right-hand corner"]);
Clazz_defineEnumConstant(c$, "DEBUG", 10, ["TF", "turn debugging on and off"]);
Clazz_defineEnumConstant(c$, "DEFAULTLOADSCRIPT", 11, ["\"script...\"", "set the script to be run after each file is loaded"]);
Clazz_defineEnumConstant(c$, "DEFAULTNMRNORMALIZATION", 12, ["maxYvalue", "set the value to be given the largest peak in an HMR spectrum"]);
Clazz_defineEnumConstant(c$, "DISPLAYFONTNAME", 13, []);
Clazz_defineEnumConstant(c$, "DISPLAY1D", 14, ["T", "turn on or off display of 1D spectra when 1D and 2D spectra are loaded"]);
Clazz_defineEnumConstant(c$, "DISPLAY2D", 15, ["T", "turn on or off display of the 2D spectrum when 1D and 2D spectra are loaded"]);
Clazz_defineEnumConstant(c$, "ENABLEZOOM", 16, ["T", "allow or disallow zooming"]);
Clazz_defineEnumConstant(c$, "ENDINDEX", 17, []);
Clazz_defineEnumConstant(c$, "FINDX", 18, ["value", "move the vertical-line cursor to a specific x-axis value"]);
Clazz_defineEnumConstant(c$, "GETPROPERTY", 19, ["[propertyName] or ALL or NAMES", "get a property value or all property values as key/value pairs, or a list of names"]);
Clazz_defineEnumConstant(c$, "GETSOLUTIONCOLOR", 20, [" FILL or FILLNONE or FILLALL or FILLALLNONE", "estimate the solution color for UV/VIS spectra"]);
Clazz_defineEnumConstant(c$, "GRIDCOLOR", 21, ["C", "color of the grid"]);
Clazz_defineEnumConstant(c$, "GRIDON", 22, ["T", "turn the grid lines on or off"]);
Clazz_defineEnumConstant(c$, "HELP", 23, ["[command]", "get this listing or help for a specific command"]);
Clazz_defineEnumConstant(c$, "HIDDEN", 24, []);
Clazz_defineEnumConstant(c$, "HIGHLIGHTCOLOR", 25, ["C", "set the highlight color"]);
Clazz_defineEnumConstant(c$, "HIGHLIGHT", 26, ["OFF or X1 X2 [OFF] or X1 X2 r g b [a]", "turns on or off a highlight color, possibily setting its color, where r g b a are 0-255 or 0.0-1.0"]);
Clazz_defineEnumConstant(c$, "INTEGRALOFFSET", 27, ["percent", "sets the integral offset from baseline"]);
Clazz_defineEnumConstant(c$, "INTEGRALRANGE", 28, ["percent", "sets the height of the total integration"]);
Clazz_defineEnumConstant(c$, "INTEGRATE", 29, ["", "see INTEGRATION"]);
Clazz_defineEnumConstant(c$, "INTEGRATION", 30, ["ON/OFF/TOGGLE/AUTO/CLEAR/MIN value/MARK ppm1-ppm2:norm,ppm3-ppm4,...", "show/hide integration or set integrals (1D 1H NMR only)"]);
Clazz_defineEnumConstant(c$, "INTEGRALPLOTCOLOR", 31, ["C", "color of the integration line"]);
Clazz_defineEnumConstant(c$, "INTEGRATIONRATIOS", 32, ["'x:value,x:value,..'", "annotate the spectrum with numbers or text at specific x values"]);
Clazz_defineEnumConstant(c$, "INTERFACE", 33, ["SINGLE or OVERLAY", "set how multiple spectra are displayed"]);
Clazz_defineEnumConstant(c$, "INVERTY", 34, ["", "invert the Y axis"]);
Clazz_defineEnumConstant(c$, "IRMODE", 35, ["A or T or TOGGLE", "set the IR mode to absorption or transmission"]);
Clazz_defineEnumConstant(c$, "JMOL", 36, ["...Jmol command...", "send a command to Jmol (if present)"]);
Clazz_defineEnumConstant(c$, "JSV", 37, []);
Clazz_defineEnumConstant(c$, "LABEL", 38, ["x y [color and/or \"text\"]", "add a text label"]);
Clazz_defineEnumConstant(c$, "LINK", 39, ["AB or ABC or NONE or ALL", "synchronize the crosshair of a 2D spectrum with 1D cursors"]);
Clazz_defineEnumConstant(c$, "LOAD", 40, ["[APPEND] \"fileName\" [first] [last]; use \"\" for current file; $H1/name or $C13/name for simulation", "load a specturm"]);
Clazz_defineEnumConstant(c$, "LOADFILECALLBACKFUNCTIONNAME", 41, []);
Clazz_defineEnumConstant(c$, "LOADIMAGINARY", 42, ["TF", "set TRUE to load imaginary NMR component"]);
Clazz_defineEnumConstant(c$, "MENUON", 43, []);
Clazz_defineEnumConstant(c$, "OBSCURE", 44, []);
Clazz_defineEnumConstant(c$, "OVERLAY", 45, []);
Clazz_defineEnumConstant(c$, "OVERLAYSTACKED", 46, ["TF", "whether viewed spectra are shown separately, in a stack"]);
Clazz_defineEnumConstant(c$, "PEAK", 47, ["[IR,CNMR,HNMR,MS] [#nnn or ID=xxx or text] [ALL], for example: PEAK HNMR #3", "highlights a peak based on its number or title text, optionally checking all loade spectra"]);
Clazz_defineEnumConstant(c$, "PEAKCALLBACKFUNCTIONNAME", 48, []);
Clazz_defineEnumConstant(c$, "PEAKLIST", 49, ["[THRESHOLD=n] [INTERPOLATE=PARABOLIC or NONE]", "creates a peak list based on a threshold value and parabolic or no interpolation"]);
Clazz_defineEnumConstant(c$, "PEAKOVERCOLOR", 50, ["C", "sets the color of peak backgrounds when moused over"]);
Clazz_defineEnumConstant(c$, "PEAKTABCOLOR", 51, ["C", "sets the color of peak marks for a peak listing"]);
Clazz_defineEnumConstant(c$, "PEAKTABSON", 52, ["T", "show peak tabs for simulated spectra"]);
Clazz_defineEnumConstant(c$, "PLOTAREACOLOR", 53, ["C", "sets the color of the plot background"]);
Clazz_defineEnumConstant(c$, "PLOTCOLOR", 54, ["C", "sets the color of the graph line"]);
Clazz_defineEnumConstant(c$, "PLOTCOLORS", 55, ["color,color,color,...", "sets the colors of multiple plots"]);
Clazz_defineEnumConstant(c$, "POINTSONLY", 56, ["TF", "show points only for all data"]);
Clazz_defineEnumConstant(c$, "PRINT", 57, ["", "prints the current spectrum"]);
Clazz_defineEnumConstant(c$, "REVERSEPLOT", 58, ["T", "reverses the x-axis of a spectrum"]);
Clazz_defineEnumConstant(c$, "SCALEBY", 59, ["factor", "multiplies the y-scale of the spectrum by a factor"]);
Clazz_defineEnumConstant(c$, "SCALECOLOR", 60, ["C", "sets the color of the x-axis and y-axis scales"]);
Clazz_defineEnumConstant(c$, "SCRIPT", 61, ["filename.jsv", "runs a script from a file"]);
Clazz_defineEnumConstant(c$, "SELECT", 62, ["spectrumID, spectrumID,...", "selects one or more spectra based on IDs"]);
Clazz_defineEnumConstant(c$, "SETPEAK", 63, ["xNew, xOld xNew, ?, or NONE", "sets nearest peak to xOld ppm to a new value; NONE resets (1D NMR only)"]);
Clazz_defineEnumConstant(c$, "SETX", 64, ["xNew, xOld xNew, ?, or NONE", "sets an old ppm position in the spectrum to a new value; NONE resets (1D NMR only)"]);
Clazz_defineEnumConstant(c$, "SHIFTX", 65, ["dx or NONE", "shifts the x-axis of a 1D NMR spectrum by the given ppm; NONE resets (1D NMR only)"]);
Clazz_defineEnumConstant(c$, "SHOWERRORS", 66, ["shows recent errors"]);
Clazz_defineEnumConstant(c$, "SHOWINTEGRATION", 67, ["T", "shows an integration listing"]);
Clazz_defineEnumConstant(c$, "SHOWMEASUREMENTS", 68, ["T", "shows a listing of measurements"]);
Clazz_defineEnumConstant(c$, "SHOWMENU", 69, ["displays the popup menu"]);
Clazz_defineEnumConstant(c$, "SHOWPEAKLIST", 70, ["T", "shows a listing for peak picking"]);
Clazz_defineEnumConstant(c$, "SHOWPROPERTIES", 71, ["displays the header information of a JDX file"]);
Clazz_defineEnumConstant(c$, "SHOWSOURCE", 72, ["displays the source JDX file associated with the selected data"]);
Clazz_defineEnumConstant(c$, "SPECTRUM", 73, ["id", "displays a specific spectrum, where id is a number 1, 2, 3... or a file.spectrum number such as 2.1"]);
Clazz_defineEnumConstant(c$, "SPECTRUMNUMBER", 74, ["n", "displays the nth spectrum loaded"]);
Clazz_defineEnumConstant(c$, "STACKOFFSETY", 75, ["percent", "sets the y-axis offset of stacked spectra"]);
Clazz_defineEnumConstant(c$, "STARTINDEX", 76, []);
Clazz_defineEnumConstant(c$, "SYNCCALLBACKFUNCTIONNAME", 77, []);
Clazz_defineEnumConstant(c$, "SYNCID", 78, []);
Clazz_defineEnumConstant(c$, "TEST", 79, []);
Clazz_defineEnumConstant(c$, "TITLEON", 80, ["T", "turns the title in the bottom left corner on or off"]);
Clazz_defineEnumConstant(c$, "TITLEBOLDON", 81, ["T", "makes the title bold"]);
Clazz_defineEnumConstant(c$, "TITLECOLOR", 82, ["C", "sets the color of the title"]);
Clazz_defineEnumConstant(c$, "TITLEFONTNAME", 83, ["fontName", "sets the title font"]);
Clazz_defineEnumConstant(c$, "UNITSCOLOR", 84, ["C", "sets the color of the x-axis and y-axis units"]);
Clazz_defineEnumConstant(c$, "VERSION", 85, []);
Clazz_defineEnumConstant(c$, "VIEW", 86, ["spectrumID, spectrumID, ... Example: VIEW 3.1, 3.2  or  VIEW \"acetophenone\"", "creates a view of one or more spectra"]);
Clazz_defineEnumConstant(c$, "XSCALEON", 87, ["T", "set FALSE to turn off the x-axis scale"]);
Clazz_defineEnumConstant(c$, "XUNITSON", 88, ["T", "set FALSE to turn off the x-axis units"]);
Clazz_defineEnumConstant(c$, "YSCALE", 89, ["[ALL] lowValue highValue"]);
Clazz_defineEnumConstant(c$, "YSCALEON", 90, ["T", "set FALSE to turn off the y-axis scale"]);
Clazz_defineEnumConstant(c$, "YUNITSON", 91, ["T", "set FALSE to turn off the y-axis units"]);
Clazz_defineEnumConstant(c$, "WINDOW", 92, []);
Clazz_defineEnumConstant(c$, "WRITE", 93, ["[XY,DIF,DIFDUP,PAC,FIX,SQZ,AML,CML,JPG,PDF,PNG,SVG] \"filename\"", "writes a file in the specified format"]);
Clazz_defineEnumConstant(c$, "ZOOM", 94, ["OUT or PREVIOUS or NEXT or x1,x2 or x1,y1 x2,y2", "sets the zoom"]);
Clazz_defineEnumConstant(c$, "ZOOMBOXCOLOR", 95, []);
Clazz_defineEnumConstant(c$, "ZOOMBOXCOLOR2", 96, []);
});
;//5.0.1-v7 Mon Aug 17 10:07:10 MDT 2026
Clazz_declarePackage("JSV.common");
Clazz_load(null, "JSV.common.ScriptTokenizer", ["JU.PT"], function(){
var c$ = Clazz_decorateAsClass(function(){
this.str = null;
this.pt = -1;
this.len = 0;
this.isCmd = false;
this.doCheck = true;
Clazz_instantialize(this, arguments);}, JSV.common, "ScriptTokenizer", null);
Clazz_makeConstructor(c$, 
function(str, isCmd){
this.str = str;
this.len = str.length;
this.isCmd = isCmd;
}, "~S,~B");
c$.nextStringToken = Clazz_defineMethod(c$, "nextStringToken", 
function(eachParam, removeQuotes){
var s = eachParam.nextToken();
return (removeQuotes && s.charAt(0) == '"' && s.endsWith("\"") && s.length > 1 ? JU.PT.trimQuotes(s) : s);
}, "JSV.common.ScriptTokenizer,~B");
Clazz_defineMethod(c$, "nextToken", 
function(){
if (this.doCheck) this.hasMoreTokens();
var pt0 = this.pt;
var inQuote = (this.str.charAt(this.pt) == '"');
while (++this.pt < this.len) {
switch ((this.str.charAt(this.pt)).charCodeAt(0)) {
case 34:
if (inQuote) {
if (this.isCmd) {
inQuote = false;
continue;
}this.pt++;
break;
}if (this.isCmd) inQuote = true;
continue;
case 32:
if (!this.isCmd && !inQuote) break;
continue;
case 59:
case 10:
if (this.isCmd && !inQuote) break;
continue;
default:
continue;
}
break;
}
this.doCheck = true;
return this.str.substring(pt0, this.pt);
});
Clazz_defineMethod(c$, "hasMoreTokens", 
function(){
while (++this.pt < this.len) {
switch ((this.str.charAt(this.pt)).charCodeAt(0)) {
case 32:
case 59:
case 10:
continue;
}
break;
}
this.doCheck = false;
return (this.pt < this.len);
});
Clazz_defineMethod(c$, "getRemainingScript", 
function(){
return this.str.substring(this.pt);
});
});
;//5.0.1-v7 Mon Aug 17 10:07:10 MDT 2026
Clazz_declarePackage("JSV.common");
(function(){
var c$ = Clazz_decorateAsClass(function(){
this.isub = 0;
this.title = null;
Clazz_instantialize(this, arguments);}, JSV.common, "SubSpecChangeEvent", null);
Clazz_makeConstructor(c$, 
function(isub, title){
this.isub = isub;
this.title = title;
}, "~N,~S");
Clazz_defineMethod(c$, "isValid", 
function(){
return (this.title != null);
});
Clazz_defineMethod(c$, "getSubIndex", 
function(){
return this.isub;
});
Clazz_overrideMethod(c$, "toString", 
function(){
return this.title;
});
})();
;//5.0.1-v7 Mon Aug 17 10:07:10 MDT 2026
Clazz_declarePackage("JSV.common");
Clazz_load(null, "JSV.common.SyncManager", ["JU.PT", "$.SB", "JSV.common.PanelNode", "JU.Logger"], function(){
var c$ = Clazz_declareType(JSV.common, "SyncManager", null);
c$.syncToJmol = Clazz_defineMethod(c$, "syncToJmol", 
function(vwr, pi){
vwr.peakInfoModelSentToJmol = pi.getModel();
vwr.si.syncToJmol(JSV.common.SyncManager.jmolSelect(vwr.pd(), pi));
}, "JSV.common.JSViewer,JSV.common.PeakInfo");
c$.syncFromJmol = Clazz_defineMethod(c$, "syncFromJmol", 
function(vwr, peakScript){
if (peakScript.equals("TEST")) peakScript = JSV.common.SyncManager.testScript;
if (peakScript.indexOf("<PeakData") < 0) {
if (peakScript.startsWith("JSVSTR:")) {
vwr.si.syncToJmol(peakScript);
return;
}vwr.runScriptNow(peakScript);
if (peakScript.indexOf("#SYNC_PEAKS") >= 0) JSV.common.SyncManager.syncToJmolPeaksAfterSyncScript(vwr);
return;
}var sourceID = JU.PT.getQuotedAttribute(peakScript, "sourceID");
var type;
var model;
var file;
var jmolSource;
var index;
var atomKey;
if (sourceID == null) {
file = JU.PT.getQuotedAttribute(peakScript, "file");
index = JU.PT.getQuotedAttribute(peakScript, "index");
if (file == null || index == null) return;
file = JU.PT.rep(file, "#molfile", "");
model = JU.PT.getQuotedAttribute(peakScript, "model");
jmolSource = JU.PT.getQuotedAttribute(peakScript, "src");
var modelSent = (jmolSource != null && jmolSource.startsWith("Jmol") ? null : vwr.peakInfoModelSentToJmol);
if (model != null && modelSent != null && !model.equals(modelSent)) {
JU.Logger.info("JSV ignoring model " + model + "; should be " + modelSent);
return;
}vwr.peakInfoModelSentToJmol = null;
if (vwr.panelNodes.size() == 0 || !vwr.checkFileAlreadyLoaded(file)) {
JU.Logger.info("file " + file + " not found -- JSViewer closing all and reopening");
vwr.si.siSyncLoad(file);
}type = JU.PT.getQuotedAttribute(peakScript, "type");
atomKey = null;
} else {
file = null;
index = model = sourceID;
atomKey = "," + JU.PT.getQuotedAttribute(peakScript, "atom") + ",";
type = "ID";
jmolSource = sourceID;
}var pi = JSV.common.SyncManager.selectPanelByPeak(vwr, file, index, atomKey);
var pd = vwr.pd();
pd.selectSpectrum(file, type, model, true);
vwr.si.siSendPanelChange();
pd.addPeakHighlight(pi);
vwr.repaint(true);
if (jmolSource == null || (pi != null && pi.getAtoms() != null)) vwr.si.syncToJmol(JSV.common.SyncManager.jmolSelect(vwr.pd(), pi));
}, "JSV.common.JSViewer,~S");
c$.syncToJmolPeaksAfterSyncScript = Clazz_defineMethod(c$, "syncToJmolPeaksAfterSyncScript", 
function(vwr){
var source = vwr.currentSource;
if (source == null) return;
try {
var file = "file=" + JU.PT.esc(source.getFilePath());
var spectra = source.getSpectra();
var peaks = spectra.get(spectra.size() - 1).getPeakList();
var sb =  new JU.SB();
sb.append("[");
var n = peaks.size();
for (var i = 0; i < n; i++) {
var s = peaks.get(i).toString();
s = s + " " + file;
sb.append(JU.PT.esc(s));
if (i > 0) sb.append(",");
}
sb.append("]");
vwr.si.syncToJmol("Peaks: " + sb);
} catch (e) {
if (Clazz_exceptionOf(e, Exception)){
} else {
throw e;
}
}
}, "JSV.common.JSViewer");
c$.selectPanelByPeak = Clazz_defineMethod(c$, "selectPanelByPeak", 
function(vwr, file, index, atomKey){
var panelNodes = vwr.panelNodes;
if (panelNodes == null) return null;
var pi = null;
for (var i = panelNodes.size(); --i >= 0; ) panelNodes.get(i).pd().addPeakHighlight(null);

pi = vwr.pd().selectPeakByFileIndex(file, index, atomKey);
if (pi != null) {
vwr.setNode(JSV.common.PanelNode.findNode(vwr.selectedPanel, panelNodes));
} else {
for (var i = panelNodes.size(); --i >= 0; ) {
var node = panelNodes.get(i);
if ((pi = node.pd().selectPeakByFileIndex(file, index, atomKey)) != null) {
vwr.setNode(node);
break;
}}
}return pi;
}, "JSV.common.JSViewer,~S,~S,~S");
c$.jmolSelect = Clazz_defineMethod(c$, "jmolSelect", 
function(pd, pi){
var script = ("IR".equals(pi.getType()) || "RAMAN".equals(pi.getType()) ? "vibration ON; selectionHalos OFF;" : "vibration OFF; selectionhalos " + (pi.getAtoms() == null ? "OFF" : "ON"));
return "Select: " + pi + " script=\"" + script + " \" sourceID=\"" + pd.getSpectrum().sourceID + "\"";
}, "JSV.common.PanelData,JSV.common.PeakInfo");
c$.testScript = "<PeakData  index=\"1\" title=\"\" model=\"~1.1\" type=\"1HNMR\" xMin=\"3.2915\" xMax=\"3.2965\" atoms=\"15,16,17,18,19,20\" multiplicity=\"\" integral=\"1\"> src=\"JPECVIEW\" file=\"http://SIMULATION/$caffeine\"";
});
;//5.0.1-v7 Mon Aug 17 10:07:10 MDT 2026
Clazz_declarePackage("JSV.common");
Clazz_load(null, "JSV.common.ViewData", ["JSV.common.Coordinate", "$.ScaleData"], function(){
var c$ = Clazz_decorateAsClass(function(){
this.scaleData = null;
this.thisScale = null;
this.nSpectra = 0;
this.iThisScale = 0;
this.spectra = null;
Clazz_instantialize(this, arguments);}, JSV.common, "ViewData", null);
Clazz_makeConstructor(c$, 
function(spectra, yPt1, yPt2, startList, endList, isContinuous, is2D){
this.nSpectra = (is2D ? 1 : spectra.size());
this.scaleData =  new Array(this.nSpectra);
for (var j = 0; j < this.nSpectra; j++) this.scaleData[j] =  new JSV.common.ScaleData(startList[j], endList[j]);

this.init(spectra, yPt1, yPt2, isContinuous);
}, "JU.Lst,~N,~N,~A,~A,~B,~B");
Clazz_makeConstructor(c$, 
function(spectra, yPt1, yPt2, isContinuous){
this.nSpectra = spectra.size();
var n = spectra.get(0).getXYCoords().length;
this.scaleData =  new Array(1);
this.scaleData[0] =  new JSV.common.ScaleData(0, n - 1);
this.init(spectra, yPt1, yPt2, isContinuous);
}, "JU.Lst,~N,~N,~B");
Clazz_defineMethod(c$, "getScaleData", 
function(){
return this.scaleData;
});
Clazz_defineMethod(c$, "getScale", 
function(){
return this.thisScale;
});
Clazz_defineMethod(c$, "init", 
function(spectra, yPt1, yPt2, isContinuous){
if (spectra == null) spectra = this.spectra;
 else this.spectra = spectra;
this.thisScale = this.scaleData[this.iThisScale = 0];
for (var i = 0; i < this.scaleData.length; i++) {
this.scaleData[i].userYFactor = spectra.get(i).getUserYFactor();
this.scaleData[i].spectrumYRef = spectra.get(i).getYRef();
}
this.resetScaleFactors();
var minX = JSV.common.Coordinate.getMinX(spectra, this);
var maxX = JSV.common.Coordinate.getMaxX(spectra, this);
var minY = JSV.common.Coordinate.getMinYUser(spectra, this);
var maxY = JSV.common.Coordinate.getMaxYUser(spectra, this);
if (yPt1 != yPt2) {
minY = yPt1;
maxY = yPt2;
if (minY > maxY) {
var t = minY;
minY = maxY;
maxY = t;
}}var isInverted = spectra.get(0).isInverted();
for (var i = 0; i < this.scaleData.length; i++) {
this.scaleData[i].setMinMax(minX, maxX, minY, maxY);
this.scaleData[i].setScale(isContinuous, isInverted);
}
}, "JU.Lst,~N,~N,~B");
Clazz_defineMethod(c$, "newSpectrum", 
function(spectra){
this.init(spectra, 0, 0, false);
}, "JU.Lst");
Clazz_defineMethod(c$, "setXRangeForSubSpectrum", 
function(xyCoords){
this.setXRange(0, xyCoords, this.scaleData[0].minX, this.scaleData[0].maxX, 0, xyCoords.length - 1);
}, "~A");
Clazz_defineMethod(c$, "setXRange", 
function(i, xyCoords, initX, finalX, iStart, iEnd){
var index = 0;
var ptCount = 0;
for (index = iStart; index <= iEnd; index++) {
var x = xyCoords[index].getXVal();
if (x >= initX) {
this.scaleData[i % this.scaleData.length].startDataPointIndex = index;
break;
}}
for (; index <= iEnd; index++) {
var x = xyCoords[index].getXVal();
ptCount++;
if (x >= finalX) {
break;
}}
this.scaleData[i % this.scaleData.length].endDataPointIndex = index;
return ptCount;
}, "~N,~A,~N,~N,~N,~N");
Clazz_defineMethod(c$, "getStartingPointIndex", 
function(i){
return this.scaleData[i % this.scaleData.length].startDataPointIndex;
}, "~N");
Clazz_defineMethod(c$, "getEndingPointIndex", 
function(i){
return this.scaleData[i % this.scaleData.length].endDataPointIndex;
}, "~N");
Clazz_defineMethod(c$, "areYScalesSame", 
function(i, j){
i %= this.scaleData.length;
j %= this.scaleData.length;
return (this.scaleData[i].minYOnScale == this.scaleData[j].minYOnScale && this.scaleData[i].maxYOnScale == this.scaleData[j].maxYOnScale);
}, "~N,~N");
Clazz_defineMethod(c$, "setScale", 
function(i, xPixels, yPixels, isInverted){
this.iThisScale = i % this.scaleData.length;
this.thisScale = this.scaleData[this.iThisScale];
this.thisScale.setXYScale(xPixels, yPixels, isInverted);
}, "~N,~N,~N,~B");
Clazz_defineMethod(c$, "resetScaleFactors", 
function(){
for (var i = 0; i < this.scaleData.length; i++) this.scaleData[i].spectrumScaleFactor = 1;

});
Clazz_defineMethod(c$, "scaleSpectrum", 
function(i, f){
if (f <= 0 || i >= this.nSpectra) return;
if (i == -2) {
this.thisScale.scale2D(f);
return;
}if (i < 0) for (i = 0; i < this.scaleData.length; i++) this.scaleData[i].scaleBy(f);

 else this.scaleData[i % this.scaleData.length].scaleBy(f);
}, "~N,~N");
Clazz_defineMethod(c$, "getNewScales", 
function(iSelected, isXOnly, y1, y2){
if (isXOnly) return this.scaleData;
iSelected %= this.scaleData.length;
var f1 = (y1 - this.thisScale.minYOnScale) / (this.thisScale.maxYOnScale - this.thisScale.minYOnScale);
var f2 = (y2 - this.thisScale.minYOnScale) / (this.thisScale.maxYOnScale - this.thisScale.minYOnScale);
var sd =  new Array(this.scaleData.length);
for (var i = 0; i < this.scaleData.length; i++) sd[i] = (iSelected >= 0 && i != iSelected ? this.scaleData[i] :  new JSV.common.ScaleData());

JSV.common.ScaleData.copyScaleFactors(this.scaleData, sd);
JSV.common.ScaleData.copyYScales(this.scaleData, sd);
for (var i = 0; i < this.scaleData.length; i++) {
if (iSelected >= 0 && i != iSelected) continue;
sd[i].isShiftZoomedY = true;
sd[i].minYOnScale = this.scaleData[i].minYOnScale * (1 - f1) + f1 * this.scaleData[i].maxYOnScale;
sd[i].maxYOnScale = this.scaleData[i].minYOnScale * (1 - f2) + f2 * this.scaleData[i].maxYOnScale;
}
return sd;
}, "~N,~B,~N,~N");
});
;//5.0.1-v7 Mon Aug 17 10:07:10 MDT 2026
Clazz_declarePackage("JSV.common");
Clazz_declareInterface(JSV.common, "XYScaleConverter");
;//5.0.1-v7 Mon Aug 17 10:07:10 MDT 2026
Clazz_declarePackage("JSV.common");
(function(){
var c$ = Clazz_declareType(JSV.common, "ZoomEvent", null);
/*LV!1824 unnec constructor*/})();
;//5.0.1-v7 Mon Aug 17 10:07:10 MDT 2026
Clazz_declarePackage("JSV.dialog");
Clazz_load(["JSV.api.AnnotationData", "JSV.common.Annotation"], "JSV.dialog.JSVDialog", ["JU.DF", "$.PT", "JSV.common.IntegralData", "$.PeakData", "JSV.dialog.DialogManager"], function(){
var c$ = Clazz_decorateAsClass(function(){
this.optionKey = null;
this.options = null;
this.type = null;
this.title = null;
this.vwr = null;
this.$spec = null;
this.manager = null;
this.dialog = null;
this.jsvp = null;
this.txt1 = null;
this.txt2 = null;
this.txt3 = null;
this.combo1 = null;
this.xyData = null;
this.myParams = null;
this.precision = 1;
this.loc = null;
this.showHideButton = null;
this.addClearBtn = false;
this.addCombo1 = false;
this.addApplyBtn = false;
this.isNumeric = false;
this.defaultVisible = false;
this.subType = null;
this.graphSetKey = null;
this.tableData = null;
this.addUnits = false;
this.unitOptions = null;
this.formatOptions = null;
this.unitPtr = null;
this.isON = true;
this.iRowColSelected = -1;
this.iSelected = -1;
this.skipCreate = false;
this.iRowSelected = -1;
this.iColSelected = -1;
Clazz_instantialize(this, arguments);}, JSV.dialog, "JSVDialog", JSV.common.Annotation, JSV.api.AnnotationData);
Clazz_overrideMethod(c$, "isDialog", 
function(){
return true;
});
Clazz_defineMethod(c$, "setParams", 
function(title, viewer, spec){
title = JSV.dialog.DialogManager.fixTitle(title);
this.title = title;
this.vwr = viewer;
this.$spec = spec;
this.manager = viewer.getDialogManager();
this.jsvp = viewer.selectedPanel;
this.myParams = (viewer.getPlatformInterface("Parameters")).setName("dialogParams");
this.subType = (spec == null ? "!" : spec.getTypeLabel());
this.optionKey = this.type + "_" + this.subType;
this.options = this.manager.getDialogOptions();
if (spec != null) {
var specOptions = spec.getDefaultAnnotationInfo(this.type);
this.options.put(this.optionKey, specOptions);
this.unitOptions = specOptions[0];
this.formatOptions = specOptions[1];
this.unitPtr = this.options.get(this.optionKey + "_unitPtr");
if (this.unitPtr == null) this.unitPtr = specOptions[2];
}switch (this.type) {
case JSV.common.Annotation.AType.Integration:
this.isNumeric = true;
this.addClearBtn = true;
this.defaultVisible = true;
this.addApplyBtn = true;
break;
case JSV.common.Annotation.AType.Measurements:
this.isNumeric = true;
this.addClearBtn = true;
this.addCombo1 = true;
this.defaultVisible = true;
break;
case JSV.common.Annotation.AType.OverlayLegend:
break;
case JSV.common.Annotation.AType.PeakList:
this.isNumeric = true;
this.addApplyBtn = true;
this.defaultVisible = true;
break;
case JSV.common.Annotation.AType.Views:
this.defaultVisible = true;
break;
case JSV.common.Annotation.AType.NONE:
break;
}
this.initDialog();
return this;
}, "~S,JSV.common.JSViewer,JSV.common.Spectrum");
Clazz_defineMethod(c$, "initDialog", 
function(){
this.dialog = this.manager.getDialog(this);
this.restoreDialogPosition(this.jsvp, this.getPosXY());
this.dialog.setTitle(this.title);
this.layoutDialog();
});
Clazz_defineMethod(c$, "layoutDialog", 
function(){
this.dialog.startLayout();
this.addUniqueControls();
if (this.isNumeric) {
this.getUnitOptions();
if (this.addCombo1) this.combo1 = this.dialog.addSelectOption("cmbUnits", "Units", this.unitOptions, this.unitPtr.intValue(), this.addUnits);
if (this.addApplyBtn) this.dialog.addButton("btnApply", "Apply");
this.showHideButton = this.dialog.addButton("btnShow", "Show");
if (this.addClearBtn) this.dialog.addButton("btnClear", "Clear");
}this.dialog.endLayout();
this.checkEnables();
this.dialog.setVisible(this.defaultVisible);
});
Clazz_defineMethod(c$, "callbackAD", 
function(id, msg){
if (id.equals("FOCUS")) {
this.eventFocus();
} else if (id.equals("tableSelect")) {
this.tableSelect(msg);
} else if (id.equals("btnClear")) {
this.clear();
} else if (id.equals("btnApply")) {
this.eventApply();
} else if (id.equals("btnShow")) {
var label = this.dialog.getText(this.showHideButton);
this.eventShowHide(label.equals("Show"));
} else if (id.equals("cmbUnits")) {
this.setPrecision(this.dialog.getSelectedIndex(this.combo1));
} else if (id.startsWith("txt")) {
this.eventApply();
} else if (id.equals("windowClosing")) {
this.done();
return true;
}if (this.jsvp != null) this.jsvp.doRepaint(true);
return true;
}, "~S,~S");
Clazz_defineMethod(c$, "addUniqueControls", 
function(dialogHelper){
}, "JSV.dialog.DialogManager");
Clazz_overrideMethod(c$, "getAType", 
function(){
return this.type;
});
Clazz_overrideMethod(c$, "getGraphSetKey", 
function(){
return this.graphSetKey;
});
Clazz_overrideMethod(c$, "setGraphSetKey", 
function(key){
this.graphSetKey = key;
}, "~S");
Clazz_overrideMethod(c$, "getSpectrum", 
function(){
return this.$spec;
});
Clazz_overrideMethod(c$, "getState", 
function(){
return this.isON;
});
Clazz_overrideMethod(c$, "setState", 
function(b){
this.isON = b;
}, "~B");
Clazz_defineMethod(c$, "checkEnables", 
function(){
var isShow = this.checkVisible();
this.dialog.setText(this.showHideButton, isShow ? "Hide" : "Show");
});
Clazz_defineMethod(c$, "createTable", 
function(data, header, widths){
this.tableData = data;
this.dialog.createTable(data, header, widths);
}, "~A,~A,~A");
Clazz_defineMethod(c$, "setTableSelectionEnabled", 
function(enabled){
this.dialog.setCellSelectionEnabled(enabled);
}, "~B");
Clazz_defineMethod(c$, "getParameters", 
function(){
return this.myParams;
});
Clazz_defineMethod(c$, "showMessage", 
function(msg, title, msgType){
this.manager.showMessageDialog(this.dialog, msg, title, msgType);
}, "~S,~S,~N");
Clazz_defineMethod(c$, "setThreshold", 
function(y){
this.dialog.setText(this.txt1, this.getThreasholdText(y));
}, "~N");
Clazz_defineMethod(c$, "applyFromFields", 
function(){
this.apply(null);
});
Clazz_defineMethod(c$, "reEnable", 
function(){
this.paramsReEnable();
return this;
});
Clazz_defineMethod(c$, "dispose", 
function(){
this.dialog.dispose();
});
Clazz_defineMethod(c$, "setVisible", 
function(visible){
this.dialog.setVisible(visible);
}, "~B");
Clazz_overrideMethod(c$, "isVisible", 
function(){
return this.dialog.isVisible();
});
Clazz_defineMethod(c$, "selectTableRow", 
function(i){
this.dialog.selectTableRow(i);
}, "~N");
Clazz_defineMethod(c$, "repaint", 
function(){
this.dialog.repaint();
});
Clazz_defineMethod(c$, "setFields", 
function(){
switch (this.type) {
case JSV.common.Annotation.AType.Integration:
break;
case JSV.common.Annotation.AType.Measurements:
break;
case JSV.common.Annotation.AType.NONE:
break;
case JSV.common.Annotation.AType.PeakList:
this.myParams = this.xyData.getParameters();
this.setThreshold(this.myParams.peakListThreshold);
this.dialog.setSelectedIndex(this.combo1, this.myParams.peakListInterpolation.equals("none") ? 1 : 0);
this.createData();
break;
case JSV.common.Annotation.AType.OverlayLegend:
break;
case JSV.common.Annotation.AType.Views:
break;
}
});
Clazz_defineMethod(c$, "setFocus", 
function(tf){
this.dialog.setFocus(tf);
}, "~B");
Clazz_defineMethod(c$, "update", 
function(clicked, xRange, yOffset){
this.selectTableRow(-1);
switch (this.type) {
case JSV.common.Annotation.AType.Integration:
this.loadData();
this.checkEnables();
break;
case JSV.common.Annotation.AType.Measurements:
this.loadData();
this.checkEnables();
break;
case JSV.common.Annotation.AType.NONE:
break;
case JSV.common.Annotation.AType.PeakList:
if (yOffset > 20) this.applyFromFields();
if (this.xyData == null || clicked == null || yOffset > 20) return;
var ipt = 0;
var dx0 = 1e100;
var xval = clicked.getXVal();
var md = this.xyData;
var min = Math.abs(xRange / 20);
for (var i = md.size(); --i >= 0; ) {
var dx = Math.abs(xval - md.get(i).getXVal());
if (dx < dx0) {
dx0 = dx;
ipt = i;
}}
if (dx0 < min) {
this.selectTableRow(md.size() - 2 - ipt);
this.repaint();
}break;
case JSV.common.Annotation.AType.OverlayLegend:
break;
case JSV.common.Annotation.AType.Views:
break;
}
}, "JSV.common.Coordinate,~N,~N");
Clazz_overrideMethod(c$, "getData", 
function(){
if (this.xyData == null) this.createData();
return this.xyData;
});
Clazz_defineMethod(c$, "setData", 
function(data){
this.myParams = data.getParameters();
this.xyData = data;
}, "JSV.api.AnnotationData");
Clazz_overrideMethod(c$, "setSpecShift", 
function(dx){
if (this.xyData != null) this.xyData.setSpecShift(dx);
}, "~N");
Clazz_defineMethod(c$, "apply", 
function(objects){
try {
switch (this.type) {
case JSV.common.Annotation.AType.Integration:
var offset = Double.parseDouble(objects[0]);
var scale = Double.parseDouble(objects[1]);
this.myParams.integralOffset = offset;
this.myParams.integralRange = scale;
this.myParams.integralDrawAll = false;
(this.getData()).update(this.myParams);
break;
case JSV.common.Annotation.AType.Measurements:
break;
case JSV.common.Annotation.AType.NONE:
return;
case JSV.common.Annotation.AType.PeakList:
if (!this.skipCreate) {
this.setThreshold(NaN);
this.createData();
}this.skipCreate = false;
break;
case JSV.common.Annotation.AType.OverlayLegend:
break;
case JSV.common.Annotation.AType.Views:
this.vwr.parameters.viewOffset = Double.parseDouble(objects[0]);
break;
}
this.loadData();
this.checkEnables();
this.jsvp.doRepaint(true);
} catch (e) {
if (Clazz_exceptionOf(e, Exception)){
} else {
throw e;
}
}
}, "~A");
Clazz_defineMethod(c$, "done", 
function(){
if (this.jsvp != null && this.$spec != null) this.jsvp.getPanelData().removeDialog(this);
if (this.xyData != null) this.xyData.setState(this.isON);
this.saveDialogPosition(this.getPosXY());
this.dispose();
this.jsvp.doRepaint(true);
});
Clazz_defineMethod(c$, "restoreDialogPosition", 
function(panel, posXY){
if (panel != null) {
if (posXY[0] == -2147483648) {
posXY[0] = 50;
posXY[1] = 50;
}var pt = this.manager.getLocationOnScreen(panel);
var height = panel.getHeight();
this.loc =  Clazz_newIntArray(-1, [Math.max(0, pt[0] + posXY[0]), Math.max(0, pt[1] + posXY[1])]);
this.dialog.setIntLocation(this.loc);
}}, "JSV.api.JSVPanel,~A");
Clazz_defineMethod(c$, "saveDialogPosition", 
function(posXY){
try {
var pt = this.manager.getLocationOnScreen(this.dialog);
posXY[0] += pt[0] - this.loc[0];
posXY[1] += pt[1] - this.loc[1];
} catch (e) {
if (Clazz_exceptionOf(e, Exception)){
} else {
throw e;
}
}
}, "~A");
Clazz_defineMethod(c$, "getThreasholdText", 
function(y){
if (Double.isNaN(y)) {
var pd = this.jsvp.getPanelData();
var f = (pd.getSpectrum().isInverted() ? 0.1 : 0.9);
var c = pd.getClickedCoordinate();
y = (c == null ? (pd.getView().minYOnScale * f + pd.getView().maxYOnScale) * (1 - f) : c.getYVal());
}var sy = JU.DF.formatDecimalDbl(y, y < 1000 ? 2 : -2);
return " " + sy;
}, "~N");
Clazz_defineMethod(c$, "checkVisible", 
function(){
return this.vwr.pd().getShowAnnotation(this.type);
});
Clazz_defineMethod(c$, "getUnitOptions", 
function(){
var key = this.optionKey + "_format";
var format = this.options.get(key);
if (format == null) this.options.put(key, format = Integer.$valueOf(this.formatOptions[this.unitPtr == null ? 0 : this.unitPtr.intValue()]));
});
Clazz_defineMethod(c$, "eventFocus", 
function(){
if (this.$spec != null) this.jsvp.getPanelData().jumpToSpectrum(this.$spec);
switch (this.type) {
case JSV.common.Annotation.AType.Integration:
if (this.iRowSelected >= 0) {
this.iRowSelected++;
this.tableCellSelect(-1, -1);
}break;
case JSV.common.Annotation.AType.Measurements:
break;
case JSV.common.Annotation.AType.NONE:
break;
case JSV.common.Annotation.AType.PeakList:
this.createData();
this.skipCreate = true;
break;
case JSV.common.Annotation.AType.OverlayLegend:
break;
case JSV.common.Annotation.AType.Views:
break;
}
});
Clazz_defineMethod(c$, "eventApply", 
function(){
switch (this.type) {
case JSV.common.Annotation.AType.Integration:
break;
case JSV.common.Annotation.AType.Measurements:
break;
case JSV.common.Annotation.AType.NONE:
break;
case JSV.common.Annotation.AType.PeakList:
this.createData();
this.skipCreate = true;
break;
case JSV.common.Annotation.AType.OverlayLegend:
break;
case JSV.common.Annotation.AType.Views:
break;
}
this.applyFromFields();
});
Clazz_defineMethod(c$, "eventShowHide", 
function(isShow){
this.isON = isShow;
if (isShow) this.eventApply();
this.jsvp.doRepaint(true);
this.checkEnables();
}, "~B");
Clazz_defineMethod(c$, "clear", 
function(){
this.setState(true);
if (this.xyData != null) {
this.xyData.clear();
this.applyFromFields();
}});
Clazz_defineMethod(c$, "paramsReEnable", 
function(){
switch (this.type) {
case JSV.common.Annotation.AType.Integration:
break;
case JSV.common.Annotation.AType.Measurements:
break;
case JSV.common.Annotation.AType.NONE:
break;
case JSV.common.Annotation.AType.PeakList:
this.skipCreate = true;
break;
case JSV.common.Annotation.AType.OverlayLegend:
break;
case JSV.common.Annotation.AType.Views:
break;
}
this.setVisible(true);
this.isON = true;
this.applyFromFields();
});
Clazz_defineMethod(c$, "tableCellSelect", 
function(iRow, iCol){
System.out.println(iRow + " jSVDial " + iCol);
if (iRow < 0) {
iRow = Clazz_doubleToInt(this.iRowColSelected / 1000);
iCol = this.iRowColSelected % 1000;
this.iRowColSelected = -1;
}var value = this.tableData[iRow][1];
var icolrow = iRow * 1000 + iCol;
if (icolrow == this.iRowColSelected) return;
this.iRowColSelected = icolrow;
System.out.println("Setting rc = " + this.iRowColSelected + " " + this.$spec);
this.selectTableRow(this.iRowSelected);
try {
switch (this.type) {
case JSV.common.Annotation.AType.Integration:
this.callback("SHOWSELECTION", value.toString());
this.checkEnables();
break;
case JSV.common.Annotation.AType.Measurements:
break;
case JSV.common.Annotation.AType.NONE:
break;
case JSV.common.Annotation.AType.PeakList:
try {
switch (iCol) {
case 6:
case 5:
case 4:
var x1 = Double.parseDouble(value);
var x2 = Double.parseDouble(this.tableData[iRow + 3 - iCol][1]);
this.jsvp.getPanelData().setXPointers(this.$spec, x1, this.$spec, x2);
break;
default:
this.jsvp.getPanelData().findX(this.$spec, Double.parseDouble(value));
}
} catch (e) {
if (Clazz_exceptionOf(e, Exception)){
this.jsvp.getPanelData().findX(this.$spec, 1E100);
} else {
throw e;
}
}
this.jsvp.doRepaint(false);
break;
case JSV.common.Annotation.AType.OverlayLegend:
this.jsvp.getPanelData().setSpectrum(iRow, false);
break;
case JSV.common.Annotation.AType.Views:
break;
}
} catch (e) {
if (Clazz_exceptionOf(e, Exception)){
} else {
throw e;
}
}
}, "~N,~N");
Clazz_defineMethod(c$, "loadData", 
function(){
var data;
var header;
var widths;
switch (this.type) {
case JSV.common.Annotation.AType.Integration:
if (this.xyData == null) this.createData();
this.iSelected = -1;
data = (this.xyData).getMeasurementListArray(null);
header = this.xyData.getDataHeader();
widths =  Clazz_newIntArray(-1, [40, 65, 65, 50]);
this.createTable(data, header, widths);
break;
case JSV.common.Annotation.AType.Measurements:
if (this.xyData == null) return;
data = this.xyData.getMeasurementListArray(this.dialog.getSelectedItem(this.combo1).toString());
header = this.xyData.getDataHeader();
widths =  Clazz_newIntArray(-1, [40, 65, 65, 50]);
this.createTable(data, header, widths);
break;
case JSV.common.Annotation.AType.NONE:
break;
case JSV.common.Annotation.AType.PeakList:
if (this.xyData == null) this.createData();
data = (this.xyData).getMeasurementListArray(null);
header = (this.xyData).getDataHeader();
widths =  Clazz_newIntArray(-1, [40, 65, 50, 50, 50, 50, 50]);
this.createTable(data, header, widths);
this.setTableSelectionEnabled(true);
break;
case JSV.common.Annotation.AType.OverlayLegend:
header =  Clazz_newArray(-1, ["No.", "Plot Color", "Title"]);
data = this.vwr.selectedPanel.getPanelData().getOverlayLegendData();
widths =  Clazz_newIntArray(-1, [30, 60, 250]);
this.createTable(data, header, widths);
this.setTableSelectionEnabled(true);
break;
case JSV.common.Annotation.AType.Views:
break;
}
});
Clazz_defineMethod(c$, "createData", 
function(){
switch (this.type) {
case JSV.common.Annotation.AType.Integration:
this.xyData =  new JSV.common.IntegralData(this.$spec, this.myParams);
this.iSelected = -1;
break;
case JSV.common.Annotation.AType.Measurements:
break;
case JSV.common.Annotation.AType.NONE:
break;
case JSV.common.Annotation.AType.PeakList:
try {
var thresh = Double.parseDouble(this.dialog.getText(this.txt1));
this.myParams.peakListThreshold = thresh;
this.myParams.peakListInterpolation = this.dialog.getSelectedItem(this.combo1).toString();
this.myParams.precision = this.precision;
var md =  new JSV.common.PeakData(JSV.common.Annotation.AType.PeakList, this.$spec);
md.setPeakList(this.myParams, this.precision, this.jsvp.getPanelData().getView());
this.xyData = md;
this.loadData();
} catch (e) {
if (Clazz_exceptionOf(e, Exception)){
} else {
throw e;
}
}
break;
case JSV.common.Annotation.AType.OverlayLegend:
break;
case JSV.common.Annotation.AType.Views:
break;
}
});
Clazz_defineMethod(c$, "setPrecision", 
function(i){
this.precision = this.formatOptions[i];
}, "~N");
Clazz_defineMethod(c$, "tableSelect", 
function(url){
var isAdjusting = "true".equals(this.getField(url, "adjusting"));
if (isAdjusting) {
this.iColSelected = this.iRowSelected = -1;
System.out.println("adjusting" + url);
return;
}var index = JU.PT.parseInt(this.getField(url, "index"));
switch ("ROW COL ROWCOL".indexOf(this.getField(url, "selector"))) {
case 8:
this.iColSelected = JU.PT.parseInt(this.getField(url, "index2"));
case 0:
this.iRowSelected = index;
System.out.println("r set to " + index);
break;
case 4:
this.iColSelected = index;
System.out.println("c set to " + index);
break;
}
if (this.iColSelected >= 0 && this.iRowSelected >= 0) {
this.tableCellSelect(this.iRowSelected, this.iColSelected);
}}, "~S");
Clazz_defineMethod(c$, "getField", 
function(url, name){
url += "&";
var key = "&" + name + "=";
var pt = url.indexOf(key);
return (pt < 0 ? null : url.substring(pt + key.length, url.indexOf("&", pt + 1)));
}, "~S,~S");
});
;//5.0.1-v7 Mon Aug 17 10:07:10 MDT 2026
Clazz_declarePackage("JSV.exception");
Clazz_load(["java.lang.Exception"], "JSV.exception.JSVException", null, function(){
var c$ = Clazz_declareType(JSV.exception, "JSVException", Exception);
});
;//5.0.1-v7 Mon Aug 17 10:07:10 MDT 2026
Clazz_declarePackage("JSV.js2d");
(function(){
var c$ = Clazz_declareType(JSV.js2d, "Display", null);
c$.getFullScreenDimensions = Clazz_defineMethod(c$, "getFullScreenDimensions", 
function(canvas, widthHeight){
{
widthHeight[0] = canvas.width;
widthHeight[1] = canvas.height;
}}, "~O,~A");
c$.hasFocus = Clazz_defineMethod(c$, "hasFocus", 
function(canvas){
return true;
}, "~O");
c$.requestFocusInWindow = Clazz_defineMethod(c$, "requestFocusInWindow", 
function(canvas){
}, "~O");
c$.repaint = Clazz_defineMethod(c$, "repaint", 
function(canvas){
}, "~O");
c$.renderScreenImage = Clazz_defineMethod(c$, "renderScreenImage", 
function(viewer, g, size){
{
}}, "J.api.PlatformViewer,~O,~O");
c$.setTransparentCursor = Clazz_defineMethod(c$, "setTransparentCursor", 
function(canvas){
}, "~O");
c$.setCursor = Clazz_defineMethod(c$, "setCursor", 
function(c, canvas){
}, "~N,~O");
c$.prompt = Clazz_defineMethod(c$, "prompt", 
function(label, data, list, asButtons){
{
var s = prompt(label, data);
if (s != null)return s;
}return "null";
}, "~S,~S,~A,~B");
c$.convertPointFromScreen = Clazz_defineMethod(c$, "convertPointFromScreen", 
function(canvas, ptTemp){
}, "~O,JU.P3");
})();
;//5.0.1-v7 Mon Aug 17 10:07:10 MDT 2026
Clazz_declarePackage("JSV.js2d");
(function(){
var c$ = Clazz_declareType(JSV.js2d, "Image", null);
c$.getWidth = Clazz_defineMethod(c$, "getWidth", 
function(canvas){
{
return (canvas.imageWidth ? canvas.imageWidth : canvas.width);
}}, "~O");
c$.getHeight = Clazz_defineMethod(c$, "getHeight", 
function(canvas){
{
return (canvas.imageHeight ? canvas.imageHeight : canvas.height);
}}, "~O");
c$.grabPixels = Clazz_defineMethod(c$, "grabPixels", 
function(context, width, height){
var data = null;
{
if (context._buf32) return context._buf32; // non-canvas internal buffer for image writing
data = context.getImageData(0, 0, width, height).data;
}return JSV.js2d.Image.toIntARGB(data);
}, "~O,~N,~N");
c$.toIntARGB = Clazz_defineMethod(c$, "toIntARGB", 
function(imgData){
var n = Clazz_doubleToInt(imgData.length / 4);
var iData =  Clazz_newIntArray (n, 0);
for (var i = 0, j = 0; i < n; j++) {
iData[i++] = (imgData[j++] << 16) | (imgData[j++] << 8) | imgData[j++] | 0xFF000000;
}
return iData;
}, "~A");
c$.fromIntARGB = Clazz_defineMethod(c$, "fromIntARGB", 
function(buf32, buf8){
var n = buf8.length >> 2;
for (var i = 0, j = 0; i < n; i++) {
buf8[j++] = (buf32[i] >> 16) & 0xFF;
buf8[j++] = (buf32[i] >> 8) & 0xFF;
buf8[j++] = buf32[i] & 0xFF;
buf8[j++] = 0xFF;
}
}, "~A,~A");
c$.getTextPixels = Clazz_defineMethod(c$, "getTextPixels", 
function(text, font3d, context, width, height, ascent){
{
context.fillStyle = "#000000";
context.fillRect(0, 0, width, height);
context.fillStyle = "#FFFFFF";
context.font = font3d.font;
context.fillText(text, 0, ascent);
}return JSV.js2d.Image.grabPixels(context, width, height);
}, "~S,JU.Font,~O,~N,~N,~N");
c$.allocateRgbImage = Clazz_defineMethod(c$, "allocateRgbImage", 
function(windowWidth, windowHeight, pBuffer, windowSize, backgroundTransparent, canvas){
{
if (canvas == null)
canvas = {width:windowWidth,height:windowHeight};
canvas.buf32 = pBuffer;
}}, "~N,~N,~A,~N,~B,~O");
c$.getStaticGraphics = Clazz_defineMethod(c$, "getStaticGraphics", 
function(canvas, backgroundTransparent){
return JSV.js2d.Image.getGraphics(canvas);
}, "~O,~B");
c$.getGraphics = Clazz_defineMethod(c$, "getGraphics", 
function(canvas){
{
return canvas.getContext("2d");
}}, "~O");
c$.drawImage = Clazz_defineMethod(c$, "drawImage", 
function(context, canvas, x, y, width, height){
{
this.fromIntARGB(canvas.buf32, canvas.buf8);
context.putImageData(canvas.imgdata,x,y);
}}, "~O,~O,~N,~N,~N,~N");
})();
;//5.0.1-v7 Mon Aug 17 10:07:10 MDT 2026
Clazz_declarePackage("JSV.js2d");
Clazz_load(["J.api.GenericFileInterface"], "JSV.js2d.JsFile", ["JU.PT", "JSV.common.JSVFileManager"], function(){
var c$ = Clazz_decorateAsClass(function(){
this.name = null;
this.fullName = null;
Clazz_instantialize(this, arguments);}, JSV.js2d, "JsFile", null, J.api.GenericFileInterface);
Clazz_makeConstructor(c$, 
function(name){
this.name = name.$replace('\\', '/');
this.fullName = name;
if (!this.fullName.startsWith("/") && JSV.common.JSVFileManager.urlTypeIndex(name) < 0) this.fullName = JSV.common.JSVFileManager.jsDocumentBase + "/" + this.fullName;
this.fullName = JU.PT.rep(this.fullName, "/./", "/");
name = name.substring(name.lastIndexOf("/") + 1);
}, "~S");
c$.newFile = Clazz_defineMethod(c$, "newFile", 
function(name){
return  new JSV.js2d.JsFile(name);
}, "~S");
Clazz_overrideMethod(c$, "getParentAsFile", 
function(){
var pt = this.fullName.lastIndexOf("/");
return (pt < 0 ? null :  new JSV.js2d.JsFile(this.fullName.substring(0, pt)));
});
Clazz_overrideMethod(c$, "getFullPath", 
function(){
return this.fullName;
});
Clazz_overrideMethod(c$, "getName", 
function(){
return this.name;
});
Clazz_overrideMethod(c$, "isDirectory", 
function(){
return this.fullName.endsWith("/");
});
Clazz_overrideMethod(c$, "length", 
function(){
return 0;
});
c$.getURLContents = Clazz_defineMethod(c$, "getURLContents", 
function(url, outputBytes, post){
try {
var conn = url.openConnection();
if (outputBytes != null) {
conn.outputBytes(outputBytes);
} else if (post != null) {
if (post.charAt(0) == '{') {
post = post.$replace("\n", "\\n");
}conn.outputString(post);
}return conn.getContents();
} catch (e) {
if (Clazz_exceptionOf(e, Exception)){
return e.toString();
} else {
throw e;
}
}
}, "java.net.URL,~A,~S");
});
;//5.0.1-v7 Mon Aug 17 10:07:10 MDT 2026
Clazz_declarePackage("JSV.js2d");
Clazz_load(["JSV.api.JSVFileHelper"], "JSV.js2d.JsFileHelper", ["JU.PT", "JSV.common.JSViewer", "JSV.js2d.JsFile"], function(){
var c$ = Clazz_decorateAsClass(function(){
this.vwr = null;
Clazz_instantialize(this, arguments);}, JSV.js2d, "JsFileHelper", null, JSV.api.JSVFileHelper);
/*LV!1824 unnec constructor*/Clazz_overrideMethod(c$, "set", 
function(viewer){
this.vwr = viewer;
return this;
}, "JSV.common.JSViewer");
Clazz_overrideMethod(c$, "getFile", 
function(fileName, panelOrFrame, isSave){
var f = null;
fileName = JU.PT.rep(fileName, "=", "_");
{
f = prompt("Enter a file name:", fileName);
}return (f == null ? null :  new JSV.js2d.JsFile(f));
}, "~S,~O,~B");
Clazz_overrideMethod(c$, "setDirLastExported", 
function(name){
return name;
}, "~S");
Clazz_overrideMethod(c$, "setFileChooser", 
function(pdf){
}, "JSV.common.ExportType");
Clazz_overrideMethod(c$, "showFileOpenDialog", 
function(panelOrFrame, userData){
JSV.common.JSViewer.jsmolObject.loadFileAsynchronously(this, this.vwr.html5Applet, "?", userData);
return null;
}, "~O,~A");
Clazz_defineMethod(c$, "setData", 
function(fileName, data, userInfo){
if (fileName == null) return;
if (data == null) {
this.vwr.selectedPanel.showMessage(fileName, "File Open Error");
return;
}var script = (userInfo == null ? null : "");
var isAppend = false;
{
isAppend = userInfo[0];
script = userInfo[1];
}this.vwr.si.siOpenDataOrFile( String.instantialize(data), "cache://" + fileName, null, null, -1, -1, isAppend, null, null);
if (script != null) this.vwr.runScript(script);
}, "~S,~O,~A");
Clazz_overrideMethod(c$, "getUrlFromDialog", 
function(info, msg){
{
return prompt(info, msg);
}}, "~S,~S");
});
;//5.0.1-v7 Mon Aug 17 10:07:10 MDT 2026
Clazz_declarePackage("JSV.js2d");
(function(){
var c$ = Clazz_declareType(JSV.js2d, "JsFont", null);
c$.newFont = Clazz_defineMethod(c$, "newFont", 
function(fontFace, isBold, isItalic, fontSize, type){
fontFace = (fontFace.equals("Monospaced") ? "Courier" : fontFace.startsWith("Sans") ? "Sans-Serif" : "Serif");
return (isBold ? "bold " : "") + (isItalic ? "italic " : "") + fontSize + type + " " + fontFace;
}, "~S,~B,~B,~N,~S");
c$.getFontMetrics = Clazz_defineMethod(c$, "getFontMetrics", 
function(font, context){
{
if (context.font != font.font) {
context.font = font.font;
font.font = context.font;
context._fontAscent = Math.ceil(font.fontSize); //pt, not px
// the descent is actually (px - pt)
// but I know of no way of getting access to the drawn height
context._fontDescent = Math.ceil(font.fontSize * 0.25);//approx
}
}return context;
}, "JU.Font,~O");
c$.getAscent = Clazz_defineMethod(c$, "getAscent", 
function(context){
{
return Math.ceil(context._fontAscent);
}}, "~O");
c$.getDescent = Clazz_defineMethod(c$, "getDescent", 
function(context){
{
return Math.ceil(context._fontDescent);
}}, "~O");
c$.stringWidth = Clazz_defineMethod(c$, "stringWidth", 
function(font, text){
{
font.fontMetrics.font = font.font;
return Math.ceil(font.fontMetrics.measureText(text).width);
}}, "JU.Font,~S");
})();
;//5.0.1-v7 Mon Aug 17 10:07:10 MDT 2026
Clazz_declarePackage("JSV.js2d");
Clazz_load(["J.api.GenericGraphics"], "JSV.js2d.JsG2D", ["JU.CU", "JSV.common.JSViewer", "JS.Color"], function(){
var c$ = Clazz_decorateAsClass(function(){
this.windowWidth = 0;
this.windowHeight = 0;
this.isShifted = false;
this.inPath = false;
Clazz_instantialize(this, arguments);}, JSV.js2d, "JsG2D", null, J.api.GenericGraphics);
/*LV!1824 unnec constructor*/Clazz_overrideMethod(c$, "getColor4", 
function(r, g, b, a){
return JS.Color.get4(r, g, b, a);
}, "~N,~N,~N,~N");
Clazz_overrideMethod(c$, "getColor3", 
function(r, g, b){
return JS.Color.get3(r, g, b);
}, "~N,~N,~N");
Clazz_overrideMethod(c$, "getColor1", 
function(rgb){
return JS.Color.get1(rgb);
}, "~N");
Clazz_overrideMethod(c$, "newGrayScaleImage", 
function(context, image, width, height, grayBuffer){
return JSV.common.JSViewer.jsmolObject.newGrayScaleImage(context, image, width, height, grayBuffer);
}, "~O,~O,~N,~N,~A");
Clazz_overrideMethod(c$, "drawGrayScaleImage", 
function(g, image, destX0, destY0, destX1, destY1, srcX0, srcY0, srcX1, srcY1){
var iw;
var ih;
{
iw = image.w;
ih = image.h;
}var dw = (destX1 - destX0 + 1);
var dh = (destY1 - destY0 + 1);
var sw = (srcX1 - srcX0 + 1);
var sh = (srcY1 - srcY0 + 1);
var x = -srcX0 * dw / sw;
var w = iw * dw / sw;
var y = -srcY0 * dh / sh;
var h = ih * dh / sh;
{
image.width = w;
image.height = h;
var div = image.div;
var layer = image.layer;
layer.style.left = destX0 + "px";
layer.style.top = destY0 + "px";
layer.style.width = dw + "px";
layer.style.height = dh+ "px";
div.style.left= x + "px";
div.style.top = y + "px";
div.style.width = w + "px";
div.style.height = h + "px";
}}, "~O,~O,~N,~N,~N,~N,~N,~N,~N,~N");
Clazz_overrideMethod(c$, "drawLine", 
function(g, x0, y0, x1, y1){
var inPath = this.inPath;
{
if (!inPath) g.beginPath();
g.moveTo(x0, y0);
g.lineTo(x1, y1);
if (!inPath) g.stroke();
}}, "~O,~N,~N,~N,~N");
Clazz_overrideMethod(c$, "drawCircle", 
function(g, x, y, diameter){
{
var r = diameter/2;
g.beginPath();
g.arc(x + r, y + r, r, 0, 2 * Math.PI, false);
g.stroke();
}}, "~O,~N,~N,~N");
Clazz_overrideMethod(c$, "drawPolygon", 
function(g, ayPoints, axPoints, nPoints){
this.doPoly(g, ayPoints, axPoints, nPoints, false);
}, "~O,~A,~A,~N");
Clazz_defineMethod(c$, "doPoly", 
function(g, axPoints, ayPoints, nPoints, doFill){
{
g.beginPath();
g.moveTo(axPoints[0], ayPoints[0]);
for (var i = 1; i < nPoints; i++)
g.lineTo(axPoints[i], ayPoints[i]);
if (doFill)
g.fill();
else
g.stroke();
}}, "~O,~A,~A,~N,~B");
Clazz_overrideMethod(c$, "drawRect", 
function(g, x, y, width, height){
{
g.beginPath();
g.rect(x ,y, width, height);
g.stroke();
}}, "~O,~N,~N,~N,~N");
Clazz_overrideMethod(c$, "drawString", 
function(g, s, x, y){
{
g.fillText(s,x,y);
}}, "~O,~S,~N,~N");
Clazz_overrideMethod(c$, "drawStringRotated", 
function(g, s, x, y, angle){
}, "~O,~S,~N,~N,~N");
Clazz_overrideMethod(c$, "fillBackground", 
function(g, bgcolor){
if (bgcolor == null) {
{
if (!this.isShifted) {
g.translate(-0.5, -0.5);
this.isShifted = true;
}
g.clearRect(0,0, this.windowWidth, this.windowHeight);
return;
}}this.setGraphicsColor(g, bgcolor);
this.fillRect(g, 0, 0, this.windowWidth, this.windowHeight);
}, "~O,javajs.api.GenericColor");
Clazz_overrideMethod(c$, "fillCircle", 
function(g, x, y, diameter){
{
var r = diameter/2;
g.beginPath();
g.arc(x + r, y + r, r, 0, 2 * Math.PI, false);
g.fill();
}}, "~O,~N,~N,~N");
Clazz_overrideMethod(c$, "fillPolygon", 
function(g, ayPoints, axPoints, nPoints){
this.doPoly(g, ayPoints, axPoints, nPoints, true);
}, "~O,~A,~A,~N");
Clazz_overrideMethod(c$, "fillRect", 
function(g, x, y, width, height){
{
g.fillRect(x, y, width, height);
}}, "~O,~N,~N,~N,~N");
Clazz_overrideMethod(c$, "setGraphicsColor", 
function(g, c){
var s = JU.CU.toCSSString(c);
{
g.fillStyle = g.strokeStyle = s;
}}, "~O,javajs.api.GenericColor");
Clazz_overrideMethod(c$, "setFont", 
function(g, font){
var s = font.getInfo();
var pt = s.indexOf(" ");
s = s.substring(0, pt) + "px" + s.substring(pt);
{
g.font = s;
}return font;
}, "~O,JU.Font");
Clazz_overrideMethod(c$, "setStrokeBold", 
function(g, tf){
{
g.lineWidth = (tf ? 2 : 1);
}}, "~O,~B");
Clazz_overrideMethod(c$, "setWindowParameters", 
function(width, height){
this.windowWidth = width;
this.windowHeight = height;
}, "~N,~N");
Clazz_overrideMethod(c$, "translateScale", 
function(g, x, y, scale){
}, "~O,~N,~N,~N");
Clazz_overrideMethod(c$, "canDoLineTo", 
function(){
return true;
});
Clazz_overrideMethod(c$, "doStroke", 
function(g, isBegin){
this.inPath = isBegin;
{
if (isBegin) {
g.beginPath();
} else {
g.stroke();
}
}}, "~O,~B");
Clazz_overrideMethod(c$, "lineTo", 
function(g, x2, y2){
{
g.lineTo(x2, y2);
}}, "~O,~N,~N");
});
;//5.0.1-v7 Mon Aug 17 10:07:10 MDT 2026
Clazz_declarePackage("JSV.js2d");
Clazz_load(["JSV.api.JSVPanel"], "JSV.js2d.JsPanel", ["JSV.common.JSViewer", "$.PanelData", "JU.Font", "$.Logger"], function(){
var c$ = Clazz_decorateAsClass(function(){
this.apiPlatform = null;
this.pd = null;
this.mouse = null;
this.vwr = null;
this.name = null;
this.bgcolor = null;
Clazz_instantialize(this, arguments);}, JSV.js2d, "JsPanel", null, JSV.api.JSVPanel);
Clazz_makeConstructor(c$, 
function(viewer, withPd){
this.vwr = viewer;
this.pd = (withPd ?  new JSV.common.PanelData(this, viewer) : null);
this.apiPlatform = viewer.apiPlatform;
this.mouse = this.apiPlatform.getMouseManager(0, this);
}, "JSV.common.JSViewer,~B");
Clazz_overrideMethod(c$, "getApiPlatform", 
function(){
return this.apiPlatform;
});
Clazz_overrideMethod(c$, "getPanelData", 
function(){
return this.pd;
});
c$.getEmptyPanel = Clazz_defineMethod(c$, "getEmptyPanel", 
function(viewer){
var p =  new JSV.js2d.JsPanel(viewer, false);
p.pd = null;
return p;
}, "JSV.common.JSViewer");
c$.getPanelMany = Clazz_defineMethod(c$, "getPanelMany", 
function(viewer, spectra){
var p =  new JSV.js2d.JsPanel(viewer, true);
p.pd.initMany(spectra, viewer.initialStartIndex, viewer.initialEndIndex);
return p;
}, "JSV.common.JSViewer,JU.Lst");
Clazz_overrideMethod(c$, "getTitle", 
function(){
return this.pd.getTitle();
});
Clazz_overrideMethod(c$, "dispose", 
function(){
if (this.pd != null) this.pd.dispose();
this.pd = null;
this.mouse.dispose();
this.mouse = null;
});
Clazz_overrideMethod(c$, "setTitle", 
function(title){
this.pd.setTitle(title);
this.name = title;
}, "~S");
Clazz_defineMethod(c$, "setColorOrFont", 
function(ds, st){
this.pd.setColorOrFont(ds, st);
}, "JSV.common.ColorParameters,JSV.common.ScriptToken");
Clazz_overrideMethod(c$, "setBackgroundColor", 
function(color){
this.bgcolor = color;
}, "javajs.api.GenericColor");
Clazz_overrideMethod(c$, "getInput", 
function(message, title, sval){
var ret = null;
{
ret = prompt(message, sval);
}this.getFocusNow(true);
return ret;
}, "~S,~S,~S");
Clazz_overrideMethod(c$, "showMessage", 
function(msg, title){
JU.Logger.info(msg);
var applet = this.vwr.html5Applet;
{
applet._showStatus(msg, title);
}this.getFocusNow(true);
}, "~S,~S");
Clazz_overrideMethod(c$, "getFocusNow", 
function(asThread){
if (this.pd != null) this.pd.dialogsToFront(null);
}, "~B");
Clazz_overrideMethod(c$, "getFontFaceID", 
function(name){
return JU.Font.getFontFaceID("SansSerif");
}, "~S");
Clazz_overrideMethod(c$, "doRepaint", 
function(andTaintAll){
if (this.pd == null) return;
if (andTaintAll) this.pd.setTaintedAll();
if (!this.pd.isPrinting) this.vwr.requestRepaint();
}, "~B");
Clazz_overrideMethod(c$, "paintComponent", 
function(context){
var contextFront = null;
var contextRear = null;
{
contextFront = context.canvas.frontLayer.getContext("2d");
contextRear = context;
}if (this.vwr == null) return;
if (this.pd == null) {
if (this.bgcolor == null) this.bgcolor = this.vwr.g2d.getColor1(-1);
this.vwr.g2d.fillBackground(context, this.bgcolor);
this.vwr.g2d.fillBackground(contextRear, this.bgcolor);
this.vwr.g2d.fillBackground(contextFront, this.bgcolor);
return;
}if (this.pd.graphSets == null || this.pd.isPrinting) return;
this.pd.g2d = this.pd.g2d0;
this.pd.drawGraph(context, contextFront, contextRear, this.getWidth(), this.getHeight(), false, false);
this.vwr.repaintDone();
}, "~O");
Clazz_overrideMethod(c$, "printPanel", 
function(pl, os, title){
pl.title = title;
pl.date = this.apiPlatform.getDateFormat("8824");
this.pd.setPrint(pl, "Helvetica");
try {
(JSV.common.JSViewer.getInterface("JSV.common.PDFWriter")).createPdfDocument(this, pl, os);
} catch (ex) {
if (Clazz_exceptionOf(ex, Exception)){
this.showMessage(ex.toString(), "creating PDF");
} else {
throw ex;
}
} finally {
this.pd.setPrint(null, null);
}
}, "JSV.common.PrintLayout,java.io.OutputStream,~S");
Clazz_overrideMethod(c$, "saveImage", 
function(type, file, out, width, height){
var fname = file.getName();
if (out != null) out.cancel();
JSV.common.JSViewer.jsmolObject.saveImage(this.vwr.html5Applet, "png", fname);
return "OK";
}, "~S,J.api.GenericFileInterface,JU.OC,~N,~N");
Clazz_overrideMethod(c$, "hasFocus", 
function(){
return false;
});
Clazz_overrideMethod(c$, "repaint", 
function(){
});
Clazz_overrideMethod(c$, "setToolTipText", 
function(s){
var x = this.pd.mouseX;
var y = this.pd.mouseY;
var applet = this.vwr.html5Applet;
{
applet._showTooltip && applet._showTooltip(s, x, y);
}}, "~S");
Clazz_overrideMethod(c$, "getHeight", 
function(){
return this.vwr.getHeight();
});
Clazz_overrideMethod(c$, "getWidth", 
function(){
return this.vwr.getWidth();
});
Clazz_overrideMethod(c$, "isEnabled", 
function(){
return false;
});
Clazz_overrideMethod(c$, "isFocusable", 
function(){
return false;
});
Clazz_overrideMethod(c$, "isVisible", 
function(){
return false;
});
Clazz_overrideMethod(c$, "setEnabled", 
function(b){
}, "~B");
Clazz_overrideMethod(c$, "setFocusable", 
function(b){
}, "~B");
Clazz_overrideMethod(c$, "toString", 
function(){
return (this.pd == null ? "<closed>" : "" + this.pd.getSpectrumAt(0));
});
Clazz_overrideMethod(c$, "processMouseEvent", 
function(id, x, y, modifiers, time){
return this.mouse != null && this.mouse.processEvent(id, x, y, modifiers, time);
}, "~N,~N,~N,~N,~N");
Clazz_overrideMethod(c$, "processTwoPointGesture", 
function(touches){
if (this.mouse != null) this.mouse.processTwoPointGesture(touches);
}, "~A");
Clazz_overrideMethod(c$, "processKeyEvent", 
function(event){
if (this.mouse != null) this.mouse.processKeyEvent(event);
}, "~O");
Clazz_overrideMethod(c$, "showMenu", 
function(x, y){
this.vwr.showMenu(x, y);
}, "~N,~N");
});
;//5.0.1-v7 Mon Aug 17 10:07:10 MDT 2026
Clazz_declarePackage("JSV.js2d");
Clazz_load(["JSV.common.ColorParameters"], "JSV.js2d.JsParameters", ["JS.Color"], function(){
var c$ = Clazz_declareType(JSV.js2d, "JsParameters", JSV.common.ColorParameters);
Clazz_makeConstructor(c$, 
function(){
Clazz_superConstructor (this, JSV.js2d.JsParameters, []);
});
Clazz_overrideMethod(c$, "isValidFontName", 
function(name){
return true;
}, "~S");
Clazz_overrideMethod(c$, "getColor1", 
function(rgb){
return JS.Color.get1(rgb);
}, "~N");
Clazz_overrideMethod(c$, "getColor3", 
function(r, g, b){
return JS.Color.get3(r, g, b);
}, "~N,~N,~N");
Clazz_defineMethod(c$, "copy", 
function(newName){
return ( new JSV.js2d.JsParameters().setName(newName)).setElementColors(this);
}, "~S");
});
;//5.0.1-v7 Mon Aug 17 10:07:10 MDT 2026
Clazz_declarePackage("JSV.js2d");
Clazz_load(["J.api.GenericPlatform"], "JSV.js2d.JsPlatform", ["java.net.URL", "JU.AjaxURLStreamHandlerFactory", "$.Rdr", "JSV.app.GenericMouse", "JSV.js2d.Display", "$.Image", "$.JsFile", "$.JsFont"], function(){
var c$ = Clazz_decorateAsClass(function(){
this.canvas = null;
this.viewer = null;
this.context = null;
Clazz_instantialize(this, arguments);}, JSV.js2d, "JsPlatform", null, J.api.GenericPlatform);
Clazz_overrideMethod(c$, "setViewer", 
function(viewer, canvas){
var context = "";
this.viewer = viewer;
this.canvas = canvas;
{
if (canvas != null) {
context = canvas.getContext("2d");
canvas.imgdata = context.getImageData(0, 0, canvas.width, canvas.height);
canvas.buf8 = canvas.imgdata.data;
}
}if (context !== "") this.context = context;
try {
java.net.URL.setURLStreamHandlerFactory( new JU.AjaxURLStreamHandlerFactory());
} catch (e) {
}
}, "J.api.PlatformViewer,~O");
Clazz_overrideMethod(c$, "isSingleThreaded", 
function(){
return true;
});
Clazz_overrideMethod(c$, "getJsObjectInfo", 
function(jsObject, method, args){
{
return (method == null ? null : method == "localName" ? jsObject[0]["nodeName"] : args == null ? jsObject[0][method] : jsObject[0][method](args[0]));
}}, "~A,~S,~A");
Clazz_overrideMethod(c$, "isHeadless", 
function(){
return false;
});
Clazz_overrideMethod(c$, "getMouseManager", 
function(privateKey, jsvp){
return  new JSV.app.GenericMouse(jsvp);
}, "~N,~O");
Clazz_overrideMethod(c$, "convertPointFromScreen", 
function(canvas, ptTemp){
JSV.js2d.Display.convertPointFromScreen(canvas, ptTemp);
}, "~O,JU.P3");
Clazz_overrideMethod(c$, "getFullScreenDimensions", 
function(canvas, widthHeight){
JSV.js2d.Display.getFullScreenDimensions(canvas, widthHeight);
}, "~O,~A");
Clazz_overrideMethod(c$, "getMenuPopup", 
function(menuStructure, type){
return null;
}, "~S,~S");
Clazz_overrideMethod(c$, "hasFocus", 
function(canvas){
return JSV.js2d.Display.hasFocus(canvas);
}, "~O");
Clazz_overrideMethod(c$, "prompt", 
function(label, data, list, asButtons){
return JSV.js2d.Display.prompt(label, data, list, asButtons);
}, "~S,~S,~A,~B");
Clazz_overrideMethod(c$, "renderScreenImage", 
function(context, size){
JSV.js2d.Display.renderScreenImage(this.viewer, context, size);
}, "~O,~O");
Clazz_overrideMethod(c$, "drawImage", 
function(context, canvas, x, y, width, height, isDTI){
JSV.js2d.Image.drawImage(context, canvas, x, y, width, height);
}, "~O,~O,~N,~N,~N,~N,~B");
Clazz_overrideMethod(c$, "requestFocusInWindow", 
function(canvas){
JSV.js2d.Display.requestFocusInWindow(canvas);
}, "~O");
Clazz_overrideMethod(c$, "repaint", 
function(canvas){
JSV.js2d.Display.repaint(canvas);
}, "~O");
Clazz_overrideMethod(c$, "setTransparentCursor", 
function(canvas){
JSV.js2d.Display.setTransparentCursor(canvas);
}, "~O");
Clazz_overrideMethod(c$, "setCursor", 
function(c, canvas){
JSV.js2d.Display.setCursor(c, canvas);
}, "~N,~O");
Clazz_overrideMethod(c$, "allocateRgbImage", 
function(windowWidth, windowHeight, pBuffer, windowSize, backgroundTransparent, isImageWrite){
return JSV.js2d.Image.allocateRgbImage(windowWidth, windowHeight, pBuffer, windowSize, backgroundTransparent, (isImageWrite ? null : this.canvas));
}, "~N,~N,~A,~N,~B,~B");
Clazz_overrideMethod(c$, "notifyEndOfRendering", 
function(){
});
Clazz_overrideMethod(c$, "createImage", 
function(data){
return null;
}, "~O");
Clazz_overrideMethod(c$, "disposeGraphics", 
function(gOffscreen){
}, "~O");
Clazz_overrideMethod(c$, "grabPixels", 
function(canvas, width, height, pixels){
{
if (canvas.image && (width != canvas.width || height != canvas.height))
Jmol._setCanvasImage(canvas, width, height);
if (canvas.buf32) return canvas.buf32;
}var buf = JSV.js2d.Image.grabPixels(JSV.js2d.Image.getGraphics(canvas), width, height);
{
canvas.buf32 = buf;
}return buf;
}, "~O,~N,~N,~A");
Clazz_overrideMethod(c$, "drawImageToBuffer", 
function(gOffscreen, imageOffscreen, canvas, width, height, bgcolor){
return this.grabPixels(canvas, width, height, null);
}, "~O,~O,~O,~N,~N,~N");
Clazz_overrideMethod(c$, "getTextPixels", 
function(text, font3d, context, image, width, height, ascent){
return JSV.js2d.Image.getTextPixels(text, font3d, context, width, height, ascent);
}, "~S,JU.Font,~O,~O,~N,~N,~N");
Clazz_overrideMethod(c$, "flushImage", 
function(imagePixelBuffer){
}, "~O");
Clazz_overrideMethod(c$, "getGraphics", 
function(canvas){
return (canvas == null ? this.context : (this.context = JSV.js2d.Image.getGraphics(this.canvas = canvas)));
}, "~O");
Clazz_overrideMethod(c$, "getImageHeight", 
function(canvas){
return (canvas == null ? -1 : JSV.js2d.Image.getHeight(canvas));
}, "~O");
Clazz_overrideMethod(c$, "getImageWidth", 
function(canvas){
return (canvas == null ? -1 : JSV.js2d.Image.getWidth(canvas));
}, "~O");
Clazz_overrideMethod(c$, "getStaticGraphics", 
function(image, backgroundTransparent){
return JSV.js2d.Image.getStaticGraphics(image, backgroundTransparent);
}, "~O,~B");
Clazz_overrideMethod(c$, "newBufferedImage", 
function(image, w, h){
{
if (self.Jmol && Jmol._getHiddenCanvas)
return Jmol._getHiddenCanvas(this.vwr.html5Applet, "stereoImage", w, h);
}return null;
}, "~O,~N,~N");
Clazz_overrideMethod(c$, "newOffScreenImage", 
function(w, h){
{
if (self.Jmol && Jmol._getHiddenCanvas)
return Jmol._getHiddenCanvas(this.vwr.html5Applet, "textImage", w, h);
}return null;
}, "~N,~N");
Clazz_overrideMethod(c$, "waitForDisplay", 
function(echoNameAndPath, zipBytes){
return false;
}, "~O,~O");
Clazz_overrideMethod(c$, "fontStringWidth", 
function(font, text){
return JSV.js2d.JsFont.stringWidth(font, text);
}, "JU.Font,~S");
Clazz_overrideMethod(c$, "getFontAscent", 
function(context){
return JSV.js2d.JsFont.getAscent(context);
}, "~O");
Clazz_overrideMethod(c$, "getFontDescent", 
function(context){
return JSV.js2d.JsFont.getDescent(context);
}, "~O");
Clazz_overrideMethod(c$, "getFontMetrics", 
function(font, context){
return JSV.js2d.JsFont.getFontMetrics(font, context);
}, "JU.Font,~O");
Clazz_overrideMethod(c$, "newFont", 
function(fontFace, isBold, isItalic, fontSize){
return JSV.js2d.JsFont.newFont(fontFace, isBold, isItalic, fontSize, "px");
}, "~S,~B,~B,~N");
Clazz_overrideMethod(c$, "getDateFormat", 
function(isoType){
{
if (isoType == null) {
} else if (isoType.indexOf("8824") >= 0) {
var d = new Date();
var x = d.toString().split(" ");
var MM = "0" + d.getMonth(); MM = MM.substring(MM.length - 2);
var dd = "0" + d.getDate(); dd = dd.substring(dd.length - 2);
return x[3] + MM + dd + x[4].replace(/\:/g,"") + x[5].substring(3,6) + "'" + x[5].substring(6,8) + "'"
} else if (isoType.indexOf("8601") >= 0){
var d = new Date();
var x = d.toString().split(" ");
var MM = "0" + d.getMonth(); MM = MM.substring(MM.length - 2);
var dd = "0" + d.getDate(); dd = dd.substring(dd.length - 2);
return x[3] + MM + dd + x[4].replace(/\:/g,"") + x[5].substring(3,6) + "'" + x[5].substring(6,8) + "'"
}
return ("" + (new Date())).split(" (")[0];
}}, "~S");
Clazz_overrideMethod(c$, "newFile", 
function(name){
return  new JSV.js2d.JsFile(name);
}, "~S");
Clazz_overrideMethod(c$, "getBufferedFileInputStream", 
function(name){
return null;
}, "~S");
Clazz_overrideMethod(c$, "getURLContents", 
function(url, outputBytes, post, asString){
var ret = JSV.js2d.JsFile.getURLContents(url, outputBytes, post);
try {
return (!asString ? ret : (typeof(ret)=='string') ? ret : Clazz_instanceOf(ret,"JU.SB") ? (ret).toString() : Clazz_instanceOf(ret,Array) ?  String.instantialize(ret) :  String.instantialize(JU.Rdr.getStreamAsBytes(ret, null)));
} catch (e) {
if (Clazz_exceptionOf(e, Exception)){
return "" + e;
} else {
throw e;
}
}
}, "java.net.URL,~A,~S,~B");
Clazz_overrideMethod(c$, "getLocalUrl", 
function(fileName){
return null;
}, "~S");
Clazz_overrideMethod(c$, "getImageDialog", 
function(title, imageMap){
return null;
}, "~S,java.util.Map");
Clazz_overrideMethod(c$, "forceAsyncLoad", 
function(filename){
return false;
}, "~S");
Clazz_overrideMethod(c$, "getInChI", 
function(){
return null;
});
Clazz_overrideMethod(c$, "confirm", 
function(msg, msgNo){
var ok = false;
if (ok) return 0;
if (msgNo != null) ok = false;
return (ok ? 1 : 2);
}, "~S,~S");
});
;//5.0.1-v7 Mon Aug 17 10:07:10 MDT 2026
Clazz_declarePackage("JSV.js2d");
Clazz_load(["JSV.api.JSVMainPanel"], "JSV.js2d.JsMainPanel", null, function(){
var c$ = Clazz_decorateAsClass(function(){
this.mainSelectedPanel = null;
this.currentPanelIndex = 0;
this.title = null;
this.visible = false;
this.focusable = false;
this.enabled = false;
Clazz_instantialize(this, arguments);}, JSV.js2d, "JsMainPanel", null, JSV.api.JSVMainPanel);
Clazz_overrideMethod(c$, "getCurrentPanelIndex", 
function(){
return this.currentPanelIndex;
});
Clazz_overrideMethod(c$, "dispose", 
function(){
});
Clazz_overrideMethod(c$, "getTitle", 
function(){
return this.title;
});
Clazz_overrideMethod(c$, "setTitle", 
function(title){
this.title = title;
}, "~S");
Clazz_defineMethod(c$, "getHeight", 
function(){
return (this.mainSelectedPanel == null ? 0 : this.mainSelectedPanel.getHeight());
});
Clazz_defineMethod(c$, "getWidth", 
function(){
return (this.mainSelectedPanel == null ? 0 : this.mainSelectedPanel.getWidth());
});
Clazz_overrideMethod(c$, "isEnabled", 
function(){
return this.enabled;
});
Clazz_overrideMethod(c$, "isFocusable", 
function(){
return this.focusable;
});
Clazz_overrideMethod(c$, "isVisible", 
function(){
return this.visible;
});
Clazz_overrideMethod(c$, "setEnabled", 
function(b){
this.enabled = b;
}, "~B");
Clazz_overrideMethod(c$, "setFocusable", 
function(b){
this.focusable = b;
}, "~B");
Clazz_overrideMethod(c$, "setSelectedPanel", 
function(viewer, jsvp, panelNodes){
if (jsvp !== this.mainSelectedPanel) {
this.mainSelectedPanel = jsvp;
}var i = viewer.selectPanel(jsvp, panelNodes);
if (i >= 0) this.currentPanelIndex = i;
this.visible = true;
}, "JSV.common.JSViewer,JSV.api.JSVPanel,JU.Lst");
});
;//5.0.1-v7 Mon Aug 17 10:07:10 MDT 2026
Clazz_declarePackage("JSV.source");
Clazz_load(["JSV.source.JDXHeader", "java.util.Hashtable"], "JSV.source.JDXDataObject", ["JU.DF", "$.PT", "JSV.common.Annotation", "$.Coordinate", "JSV.exception.JSVException", "JU.Logger"], function(){
var c$ = Clazz_decorateAsClass(function(){
this.sourceID = "";
this.isSimulation = false;
this.blockID = 0;
this.filePath = null;
this.filePathForwardSlash = null;
this.inlineData = null;
this.fileShiftRef = 1.7976931348623157E308;
this.fileShiftRefType = -1;
this.fileShiftRefDataPt = -1;
this.minX = NaN;
this.minY = NaN;
this.maxX = NaN;
this.maxY = NaN;
this.deltaX = NaN;
this.xyCoords = null;
this.continuous = false;
this.$isHZtoPPM = false;
this.xIncreases = true;
this.fileFirstX = 1.7976931348623157E308;
this.fileLastX = 1.7976931348623157E308;
this.fileNPoints = -1;
this.xFactor = 1.7976931348623157E308;
this.yFactor = 1.7976931348623157E308;
this.nucleusX = null;
this.nucleusY = "?";
this.freq2dX = NaN;
this.freq2dY = NaN;
this.y2DUnits = "";
this.parent = null;
this.xUnits = "";
this.yUnits = "";
this.xLabel = null;
this.yLabel = null;
this.varName = "";
this.observedNucl = "";
this.observedFreq = 1.7976931348623157E308;
this.numDim = 1;
this.nH = 0;
this.y2D = NaN;
Clazz_instantialize(this, arguments);}, JSV.source, "JDXDataObject", JSV.source.JDXHeader);
Clazz_defineMethod(c$, "setInlineData", 
function(data){
this.inlineData = data;
}, "~S");
Clazz_defineMethod(c$, "getInlineData", 
function(){
return this.inlineData;
});
Clazz_defineMethod(c$, "setFilePath", 
function(filePath){
if (filePath != null) this.filePathForwardSlash = (this.filePath = filePath.trim()).$replace('\\', '/');
}, "~S");
Clazz_defineMethod(c$, "getFilePath", 
function(){
return this.filePath;
});
Clazz_defineMethod(c$, "getFilePathForwardSlash", 
function(){
return this.filePathForwardSlash;
});
Clazz_defineMethod(c$, "setBlockID", 
function(id){
this.blockID = id;
}, "~N");
Clazz_defineMethod(c$, "checkJDXRequiredTokens", 
function(){
var missingTag = (this.fileFirstX == 1.7976931348623157E308 ? "##FIRSTX" : this.fileLastX == 1.7976931348623157E308 ? "##LASTX" : this.fileNPoints == -1 ? "##NPOINTS" : this.xFactor == 1.7976931348623157E308 ? "##XFACTOR" : this.yFactor == 1.7976931348623157E308 ? "##YFACTOR" : null);
if (missingTag != null) throw  new JSV.exception.JSVException("Error Reading Data Set: " + missingTag + " not found");
});
Clazz_defineMethod(c$, "setXFactor", 
function(xFactor){
this.xFactor = xFactor;
}, "~N");
Clazz_defineMethod(c$, "getXFactor", 
function(){
return this.xFactor;
});
Clazz_defineMethod(c$, "setYFactor", 
function(yFactor){
this.yFactor = yFactor;
}, "~N");
Clazz_defineMethod(c$, "getYFactor", 
function(){
return this.yFactor;
});
Clazz_defineMethod(c$, "setVarName", 
function(name){
this.varName = name;
}, "~S");
Clazz_defineMethod(c$, "isImaginary", 
function(){
return this.varName.contains("IMAG");
});
Clazz_defineMethod(c$, "setXUnits", 
function(xUnits){
this.xUnits = xUnits;
}, "~S");
Clazz_defineMethod(c$, "getXUnits", 
function(){
return this.xUnits;
});
Clazz_defineMethod(c$, "setYUnits", 
function(yUnits){
if (yUnits.equals("PPM")) yUnits = "ARBITRARY UNITS";
this.yUnits = yUnits;
}, "~S");
Clazz_defineMethod(c$, "getYUnits", 
function(){
return this.yUnits;
});
Clazz_defineMethod(c$, "setXLabel", 
function(value){
this.xLabel = value;
}, "~S");
Clazz_defineMethod(c$, "setYLabel", 
function(value){
this.yLabel = value;
}, "~S");
Clazz_defineMethod(c$, "setObservedNucleus", 
function(value){
this.observedNucl = value;
if (this.is1D()) this.parent.nucleusX = this.nucleusX = this.fixNucleus(value);
}, "~S");
Clazz_defineMethod(c$, "getObservedNucleus", 
function(){
return this.observedNucl;
});
Clazz_defineMethod(c$, "setObservedFreq", 
function(observedFreq){
this.observedFreq = observedFreq;
}, "~N");
Clazz_defineMethod(c$, "getObservedFreq", 
function(){
return this.observedFreq;
});
Clazz_defineMethod(c$, "setHydrogenCount", 
function(nH){
this.nH = nH;
}, "~N");
Clazz_defineMethod(c$, "getHydrogenCount", 
function(){
return this.nH;
});
Clazz_defineMethod(c$, "is1D", 
function(){
return this.numDim == 1;
});
Clazz_defineMethod(c$, "getNumDim", 
function(){
return this.numDim;
});
Clazz_defineMethod(c$, "setNumDim", 
function(n){
this.numDim = n;
}, "~N");
Clazz_defineMethod(c$, "setY2D", 
function(d){
this.y2D = d;
}, "~N");
Clazz_defineMethod(c$, "getY2D", 
function(){
return this.y2D;
});
Clazz_defineMethod(c$, "setY2DUnits", 
function(units){
this.y2DUnits = units;
}, "~S");
Clazz_defineMethod(c$, "getY2DPPM", 
function(){
var d = this.y2D;
if (this.y2DUnits.equals("HZ")) d /= this.freq2dY;
return d;
});
Clazz_defineMethod(c$, "setNucleusAndFreq", 
function(nuc, isX){
nuc = this.fixNucleus(nuc);
if (isX) this.nucleusX = nuc;
 else this.nucleusY = nuc;
var freq;
if (this.observedNucl.indexOf(nuc) >= 0) {
freq = this.observedFreq;
} else {
var g1 = JSV.source.JDXDataObject.getGyromagneticRatio(this.fixNucleus(this.observedNucl));
var g2 = JSV.source.JDXDataObject.getGyromagneticRatio(nuc);
freq = this.observedFreq * g2 / g1;
}if (isX) this.freq2dX = freq;
 else this.freq2dY = freq;
JU.Logger.info("Freq for " + nuc + " = " + freq);
}, "~S,~B");
Clazz_defineMethod(c$, "fixNucleus", 
function(nuc){
return JU.PT.rep(JU.PT.trim(nuc, "[]^<>"), "NUC_", "");
}, "~S");
c$.getNominalSpecFreq = Clazz_defineMethod(c$, "getNominalSpecFreq", 
function(nuc, freq){
var d = JSV.source.JDXDataObject.getSpecFreq(nuc, freq);
var century = Math.round(d / 100) * 100;
return (Double.isNaN(d) ? -1 : Math.abs(d - century) < 2 ? century : Math.round(d));
}, "~S,~N");
c$.getSpecFreq = Clazz_defineMethod(c$, "getSpecFreq", 
function(nuc, freq){
return freq * JSV.source.JDXDataObject.getGyromagneticRatio("1H") / JSV.source.JDXDataObject.getGyromagneticRatio(nuc);
}, "~S,~N");
c$.getGyromagneticRatio = Clazz_defineMethod(c$, "getGyromagneticRatio", 
function(nuc){
var v = null;
try {
v = JSV.source.JDXDataObject.gyroMap.get(nuc);
if (v != null) return v.doubleValue();
var pt = 0;
while (pt < nuc.length && Character.isDigit(nuc.charAt(pt))) pt++;

v = JSV.source.JDXDataObject.gyroMap.get(nuc.substring(0, pt));
if (v != null) JSV.source.JDXDataObject.gyroMap.put(nuc, v);
} catch (e) {
if (Clazz_exceptionOf(e, Exception)){
} else {
throw e;
}
}
return (v == null ? NaN : v.doubleValue());
}, "~S");
Clazz_defineMethod(c$, "isTransmittance", 
function(){
var s = this.yUnits.toLowerCase();
return (s.equals("transmittance") || s.contains("trans") || s.equals("t"));
});
Clazz_defineMethod(c$, "isAbsorbance", 
function(){
var s = this.yUnits.toLowerCase();
return (s.equals("absorbance") || s.contains("abs") || s.equals("a"));
});
Clazz_defineMethod(c$, "canSaveAsJDX", 
function(){
return this.getDataClass().equals("XYDATA");
});
Clazz_defineMethod(c$, "canIntegrate", 
function(){
return (this.continuous && (this.isHNMR() || this.isGC()) && this.is1D());
});
Clazz_defineMethod(c$, "isAutoOverlayFromJmolClick", 
function(){
return (this.isGC());
});
Clazz_defineMethod(c$, "isGC", 
function(){
return this.dataType.startsWith("GC") || this.dataType.startsWith("GAS");
});
Clazz_defineMethod(c$, "isMS", 
function(){
return this.dataType.startsWith("MASS") || this.dataType.startsWith("MS");
});
Clazz_defineMethod(c$, "isStackable", 
function(){
return !this.isMS();
});
Clazz_defineMethod(c$, "isScalable", 
function(){
return true;
});
Clazz_defineMethod(c$, "getYRef", 
function(){
return (!this.isTransmittance() ? 0.0 : JSV.common.Coordinate.getMaxY(this.xyCoords, 0, this.xyCoords.length - 1) < 2 ? 1.0 : 100.0);
});
Clazz_defineMethod(c$, "isInverted", 
function(){
return this.isTransmittance();
});
Clazz_defineMethod(c$, "canConvertTransAbs", 
function(){
return (this.continuous && (this.yUnits.toLowerCase().contains("abs")) || this.yUnits.toLowerCase().contains("trans"));
});
Clazz_defineMethod(c$, "canShowSolutionColor", 
function(){
return (this.isContinuous() && this.canConvertTransAbs() && (this.xUnits.toLowerCase().contains("nanometer") || this.xUnits.equalsIgnoreCase("nm")) && this.getFirstX() < 401 && this.getLastX() > 699 && this.xyCoords.length >= 30);
});
Clazz_defineMethod(c$, "isHZtoPPM", 
function(){
return this.$isHZtoPPM;
});
Clazz_defineMethod(c$, "setHZtoPPM", 
function(val){
this.$isHZtoPPM = val;
}, "~B");
Clazz_defineMethod(c$, "setIncreasing", 
function(val){
this.xIncreases = val;
}, "~B");
Clazz_defineMethod(c$, "isXIncreasing", 
function(){
return this.xIncreases;
});
Clazz_defineMethod(c$, "shouldDisplayXAxisIncreasing", 
function(){
var dt = this.dataType.toUpperCase();
var xu = this.xUnits.toUpperCase();
if (dt.contains("NMR") && !dt.contains("FID")) {
return false;
} else if (dt.contains("LINK") && xu.contains("CM")) {
return false;
} else if (dt.startsWith("IR") || dt.contains("INFRA") && xu.contains("CM")) {
return false;
} else if (dt.contains("RAMAN") && xu.contains("CM")) {
return false;
} else if (dt.contains("VIS") && xu.contains("NANOMETERS")) {
return true;
}return this.xIncreases;
});
Clazz_defineMethod(c$, "setContinuous", 
function(val){
this.continuous = val;
}, "~B");
Clazz_defineMethod(c$, "isContinuous", 
function(){
return this.continuous;
});
Clazz_defineMethod(c$, "getHeaderRowDataAsArray", 
function(){
var n = 8;
if (this.observedFreq != 1.7976931348623157E308) n++;
if (this.observedNucl !== "") n++;
var rowData = this.getHeaderRowDataAsArray(true, n);
var i = rowData.length - n;
if (this.observedFreq != 1.7976931348623157E308) rowData[i++] =  Clazz_newArray(-1, ["##.OBSERVE FREQUENCY", "" + this.observedFreq]);
if (this.observedNucl !== "") rowData[i++] =  Clazz_newArray(-1, ["##.OBSERVE NUCLEUS", this.observedNucl]);
rowData[i++] =  Clazz_newArray(-1, ["##XUNITS", this.$isHZtoPPM ? "HZ" : this.xUnits]);
rowData[i++] =  Clazz_newArray(-1, ["##YUNITS", this.yUnits]);
var x = (this.xIncreases ? this.getFirstX() : this.getLastX());
rowData[i++] =  Clazz_newArray(-1, ["##FIRSTX", String.valueOf(this.isHZtoPPM() ? x * this.observedFreq : x)]);
x = (this.xIncreases ? this.getLastX() : this.getFirstX());
rowData[i++] =  Clazz_newArray(-1, ["##FIRSTY", String.valueOf(this.xIncreases ? this.getFirstY() : this.getLastY())]);
rowData[i++] =  Clazz_newArray(-1, ["##LASTX", String.valueOf(this.isHZtoPPM() ? x * this.observedFreq : x)]);
rowData[i++] =  Clazz_newArray(-1, ["##XFACTOR", String.valueOf(this.getXFactor())]);
rowData[i++] =  Clazz_newArray(-1, ["##YFACTOR", String.valueOf(this.getYFactor())]);
rowData[i++] =  Clazz_newArray(-1, ["##NPOINTS", String.valueOf(this.xyCoords.length)]);
return rowData;
});
Clazz_defineMethod(c$, "getDefaultUnitPrecision", 
function(){
return 2;
});
Clazz_defineMethod(c$, "setMeasurementText", 
function(m){
var dx = m.getValue();
if (Double.isNaN(dx)) return "";
var precision = 1;
var units = "";
if (this.isNMR()) {
if (this.is1D()) {
var isIntegral = (Clazz_instanceOf(m,"JSV.common.Integral"));
if (this.isHNMR() || isIntegral) {
if (!isIntegral) {
dx *= this.observedFreq;
units = " Hz";
}} else {
units = " ppm";
precision = 2;
}} else {
return "";
}}return (dx < 0.1 ? "" : JU.DF.formatDecimalDbl(dx, precision) + units);
}, "JSV.common.Measurement");
Clazz_defineMethod(c$, "isNMR", 
function(){
return (this.dataType.toUpperCase().indexOf("NMR") >= 0);
});
Clazz_defineMethod(c$, "isHNMR", 
function(){
return (this.isNMR() && this.observedNucl.toUpperCase().indexOf("H") >= 0);
});
Clazz_defineMethod(c$, "setXYCoords", 
function(coords){
this.xyCoords = coords;
}, "~A");
Clazz_defineMethod(c$, "invertYAxis", 
function(){
for (var i = this.xyCoords.length; --i >= 0; ) {
this.xyCoords[i].setYVal(-this.xyCoords[i].getYVal());
}
var d = this.minY;
this.minY = -this.maxY;
this.maxY = -d;
return this;
});
Clazz_defineMethod(c$, "getFirstX", 
function(){
return this.xyCoords[0].getXVal();
});
Clazz_defineMethod(c$, "getFirstY", 
function(){
return this.xyCoords[0].getYVal();
});
Clazz_defineMethod(c$, "getLastX", 
function(){
return this.xyCoords[this.xyCoords.length - 1].getXVal();
});
Clazz_defineMethod(c$, "getLastY", 
function(){
return this.xyCoords[this.xyCoords.length - 1].getYVal();
});
Clazz_defineMethod(c$, "getMinX", 
function(){
return (Double.isNaN(this.minX) ? (this.minX = JSV.common.Coordinate.getMinX(this.xyCoords, 0, this.xyCoords.length - 1)) : this.minX);
});
Clazz_defineMethod(c$, "getMinY", 
function(){
return (Double.isNaN(this.minY) ? (this.minY = JSV.common.Coordinate.getMinY(this.xyCoords, 0, this.xyCoords.length - 1)) : this.minY);
});
Clazz_defineMethod(c$, "getMaxX", 
function(){
return (Double.isNaN(this.maxX) ? (this.maxX = JSV.common.Coordinate.getMaxX(this.xyCoords, 0, this.xyCoords.length - 1)) : this.maxX);
});
Clazz_defineMethod(c$, "getMaxY", 
function(){
return (Double.isNaN(this.maxY) ? (this.maxY = JSV.common.Coordinate.getMaxY(this.xyCoords, 0, this.xyCoords.length - 1)) : this.maxY);
});
Clazz_defineMethod(c$, "normalizeSimulation", 
function(max){
if (!this.isNMR() || !this.is1D()) return;
var f = max / this.getMaxY();
this.maxY = NaN;
JSV.common.Coordinate.applyScale(this.xyCoords, 1, f);
JU.Logger.info("Y values have been scaled by a factor of " + f);
}, "~N");
Clazz_defineMethod(c$, "getDeltaX", 
function(){
return (Double.isNaN(this.deltaX) ? (this.deltaX = JSV.common.Coordinate.deltaX(this.getLastX(), this.getFirstX(), this.xyCoords.length)) : this.deltaX);
});
Clazz_defineMethod(c$, "copyTo", 
function(newObj){
newObj.setTitle(this.title);
newObj.setJcampdx(this.jcampdx);
newObj.setOrigin(this.origin);
newObj.setOwner(this.owner);
newObj.setDataClass(this.dataClass);
newObj.setDataType(this.dataType);
newObj.setHeaderTable(this.headerTable);
newObj.setXFactor(this.xFactor);
newObj.setYFactor(this.yFactor);
newObj.setXUnits(this.xUnits);
newObj.setYUnits(this.yUnits);
newObj.setXLabel(this.xLabel);
newObj.setYLabel(this.yLabel);
newObj.setXYCoords(this.xyCoords);
newObj.setContinuous(this.continuous);
newObj.setIncreasing(this.xIncreases);
newObj.observedFreq = this.observedFreq;
newObj.observedNucl = this.observedNucl;
newObj.fileShiftRef = this.fileShiftRef;
newObj.fileShiftRefDataPt = this.fileShiftRefDataPt;
newObj.fileShiftRefType = this.fileShiftRefType;
newObj.$isHZtoPPM = this.$isHZtoPPM;
newObj.numDim = this.numDim;
newObj.nucleusX = this.nucleusX;
newObj.nucleusY = this.nucleusY;
newObj.freq2dX = this.freq2dX;
newObj.freq2dY = this.freq2dY;
newObj.setFilePath(this.filePath);
newObj.nH = this.nH;
}, "JSV.source.JDXDataObject");
Clazz_defineMethod(c$, "getTypeLabel", 
function(){
return (this.isNMR() ? this.nucleusX + "NMR" : this.dataType);
});
Clazz_defineMethod(c$, "getDefaultAnnotationInfo", 
function(type){
var s1;
var s2;
var isNMR = this.isNMR();
switch (type) {
case JSV.common.Annotation.AType.Integration:
return  Clazz_newArray(-1, [null,  Clazz_newIntArray(-1, [1]), null]);
case JSV.common.Annotation.AType.Measurements:
s1 = (isNMR ?  Clazz_newArray(-1, ["Hz", "ppm"]) :  Clazz_newArray(-1, [""]));
s2 = (this.isHNMR() ?  Clazz_newIntArray(-1, [1, 4]) :  Clazz_newIntArray(-1, [1, 3]));
return  Clazz_newArray(-1, [s1, s2, Integer.$valueOf(0)]);
case JSV.common.Annotation.AType.PeakList:
s1 = (isNMR ?  Clazz_newArray(-1, ["Hz", "ppm"]) :  Clazz_newArray(-1, [""]));
s2 = (this.isHNMR() ?  Clazz_newIntArray(-1, [1, 2]) :  Clazz_newIntArray(-1, [1, 1]));
return  Clazz_newArray(-1, [s1, s2, Integer.$valueOf(isNMR ? 1 : 0)]);
case JSV.common.Annotation.AType.NONE:
case JSV.common.Annotation.AType.OverlayLegend:
break;
case JSV.common.Annotation.AType.Views:
break;
}
return null;
}, "JSV.common.Annotation.AType");
Clazz_defineMethod(c$, "getPeakListArray", 
function(m, last, maxY){
var x = m.getXVal();
var y = m.getYVal();
if (this.isNMR()) y /= maxY;
var dx = Math.abs(x - last[0]);
last[0] = x;
var ddx = dx + last[1];
last[1] = dx;
var dddx = ddx + last[2];
last[2] = ddx;
if (this.isNMR()) {
return  Clazz_newDoubleArray(-1, [x, y, x * this.observedFreq, (dx * this.observedFreq > 20 ? 0 : dx * this.observedFreq), (ddx * this.observedFreq > 20 ? 0 : ddx * this.observedFreq), (dddx * this.observedFreq > 20 ? 0 : dddx * this.observedFreq)]);
}return  Clazz_newDoubleArray(-1, [x, y]);
}, "JSV.common.Measurement,~A,~N");
Clazz_defineMethod(c$, "finalizeCoordinates", 
function(){
var freq = (Double.isNaN(this.freq2dX) ? this.observedFreq : this.freq2dX);
var isHz = (freq != 1.7976931348623157E308 && this.getXUnits().toUpperCase().equals("HZ"));
if (this.fileShiftRef != 1.7976931348623157E308 && freq != 1.7976931348623157E308 && this.dataType.toUpperCase().contains("SPECTRUM") && this.jcampdx.indexOf("JEOL") < 0) {
this.applyShiftReference(isHz ? freq : 1, this.fileShiftRef);
}if (this.fileFirstX > this.fileLastX) JSV.common.Coordinate.reverse(this.xyCoords);
if (isHz) {
JSV.common.Coordinate.applyScale(this.xyCoords, (1.0 / freq), 1);
this.setXUnits("PPM");
this.setHZtoPPM(true);
}});
Clazz_defineMethod(c$, "setShiftReference", 
function(shift, pt, type){
this.fileShiftRef = shift;
this.fileShiftRefDataPt = (pt > 0 ? pt : 1);
this.fileShiftRefType = type;
}, "~N,~N,~N");
Clazz_defineMethod(c$, "isShiftTypeSpecified", 
function(){
return (this.fileShiftRefType != -1);
});
Clazz_defineMethod(c$, "applyShiftReference", 
function(referenceFreq, shift){
if (this.fileShiftRefDataPt > this.xyCoords.length || this.fileShiftRefDataPt < 0) return;
var coord;
switch (this.fileShiftRefType) {
case 0:
shift = this.xyCoords[this.fileShiftRefDataPt - 1].getXVal() - shift * referenceFreq;
break;
case 1:
shift = this.fileFirstX - shift * referenceFreq;
break;
case 2:
shift = this.fileLastX + shift;
break;
}
for (var index = 0; index < this.xyCoords.length; index++) {
coord = this.xyCoords[index];
coord.setXVal(coord.getXVal() - shift);
this.xyCoords[index] = coord;
}
}, "~N,~N");
c$.gyroData =  Clazz_newDoubleArray(-1, [1, 42.5774806, 2, 6.53590131, 3, 45.4148, 3, 32.436, 6, 6.2661, 7, 16.5483, 9, 5.9842, 10, 4.5752, 11, 13.663, 13, 10.70839657, 14, 3.07770646, 15, 4.31726570, 17, 5.7742, 19, 40.07757016, 21, 3.3631, 23, 11.26952167, 25, 2.6083, 27, 11.1031, 29, 8.4655, 31, 17.25144090, 33, 3.2717, 35, 4.1765, 37, 3.4765, 37, 5.819, 39, 3.46, 39, 1.9893, 40, 2.4737, 41, 1.0919, 43, 2.8688, 45, 10.3591, 47, 2.4041, 49, 2.4048, 50, 4.2505, 51, 11.2133, 53, 2.4115, 55, 10.5763, 57, 1.3816, 59, 10.077, 61, 3.8114, 63, 11.2982, 65, 12.103, 67, 2.6694, 69, 10.2478, 71, 13.0208, 73, 1.4897, 75, 7.315, 77, 8.1571, 79, 10.7042, 81, 11.5384, 83, 1.6442, 85, 4.1254, 87, 13.9811, 87, 1.8525, 89, 2.0949, 91, 3.9748, 93, 10.4523, 95, 2.7874, 97, 2.8463, 99, 9.6294, 99, 1.9553, 101, 2.1916, 103, 1.3477, 105, 1.957, 107, 1.7331, 109, 1.9924, 111, 9.0692, 113, 9.4871, 113, 9.3655, 115, 9.3856, 115, 14.0077, 117, 15.261, 119, 15.966, 121, 10.2551, 123, 5.5532, 123, 11.2349, 125, 13.5454, 127, 8.5778, 129, 11.8604, 131, 3.5159, 133, 5.6234, 135, 4.2582, 137, 4.7634, 138, 5.6615, 139, 6.0612, 137, 4.88, 139, 5.39, 141, 2.37, 141, 13.0359, 143, 2.319, 145, 1.429, 143, 11.59, 147, 5.62, 147, 1.7748, 149, 14631, 151, 10.5856, 153, 4.6745, 155, 1.312, 157, 1.72, 159, 10.23, 161, 1.4654, 163, 2.0508, 165, 9.0883, 167, 1.2281, 169, 3.531, 171, 7.5261, 173, 2.073, 175, 4.8626, 176, 3.451, 177, 1.7282, 179, 1.0856, 180, 4.087, 181, 5.1627, 183, 1.7957, 185, 9.7176, 187, 9.817, 187, 0.9856, 189, 3.3536, 191, 0.7658, 191, 0.8319, 195, 9.2922, 197, 0.7406, 199, 7.7123, 201, 2.8469, 203, 24.7316, 205, 24.9749, 207, 9.034, 209, 6.963, 209, 11.7, 211, 9.16, 223, 5.95, 223, 1.3746, 225, 11.187, 227, 5.6, 229, 1.4, 231, 10.2, 235, 0.83, 237, 9.57, 239, 3.09, 243, 4.6, 1E100]);
c$.gyroMap =  new java.util.Hashtable();
{
for (var i = 0, n = JSV.source.JDXDataObject.gyroData.length - 1; i < n; i += 2) JSV.source.JDXDataObject.gyroMap.put("" + Clazz_doubleToInt(JSV.source.JDXDataObject.gyroData[i]), Double.$valueOf(JSV.source.JDXDataObject.gyroData[i + 1]));

}});
;//5.0.1-v7 Mon Aug 17 10:07:10 MDT 2026
Clazz_declarePackage("JSV.source");
Clazz_load(["java.util.Iterator"], "JSV.source.JDXDecompressor", ["JSV.common.Coordinate", "JU.Logger"], function(){
var c$ = Clazz_decorateAsClass(function(){
this.xFactor = 0;
this.yFactor = 0;
this.nPoints = 0;
this.ich = 0;
this.t = null;
this.firstX = 0;
this.lastX = 0;
this.maxY = 4.9E-324;
this.minY = 1.7976931348623157E308;
this.debugging = false;
this.xyCoords = null;
this.line = null;
this.lineLen = 0;
this.errorLog = null;
this.lastDif = -2147483648;
this.dupCount = 0;
this.nptsFound = 0;
this.lastY = 0;
this.isDIF = true;
Clazz_instantialize(this, arguments);}, JSV.source, "JDXDecompressor", null, java.util.Iterator);
Clazz_makeConstructor(c$, 
function(t, firstX, lastX, xFactor, yFactor, nPoints){
this.t = t;
this.firstX = firstX;
this.lastX = lastX;
this.xFactor = xFactor;
this.yFactor = yFactor;
this.nPoints = nPoints;
this.debugging = JU.Logger.isActiveLevel(6);
}, "JSV.source.JDXSourceStreamTokenizer,~N,~N,~N,~N,~N");
Clazz_makeConstructor(c$, 
function(line, lastY){
this.line = line.trim();
this.lineLen = line.length;
this.lastY = lastY;
}, "~S,~N");
Clazz_defineMethod(c$, "getMinY", 
function(){
return this.minY;
});
Clazz_defineMethod(c$, "getMaxY", 
function(){
return this.maxY;
});
Clazz_defineMethod(c$, "decompressData", 
function(errorLog){
this.errorLog = errorLog;
var deltaXcalc = JSV.common.Coordinate.deltaX(this.lastX, this.firstX, this.nPoints);
if (this.debugging) this.logError("firstX=" + this.firstX + " lastX=" + this.lastX + " xFactor=" + this.xFactor + " yFactor=" + this.yFactor + " deltaX=" + deltaXcalc + " nPoints=" + this.nPoints);
this.xyCoords =  new Array(this.nPoints);
var difFracMax = 0.5;
var prevXcheck = 0;
var prevIpt = 0;
var lastXExpected = this.lastX;
var x = this.lastX = this.firstX;
var lastLine = null;
var ipt = 0;
var yval = 0;
var haveWarned = false;
var lineNumber = this.t.labelLineNo;
try {
while ((this.line = this.t.readLineTrimmed()) != null && this.line.indexOf("##") < 0) {
lineNumber++;
if ((this.lineLen = this.line.length) == 0) continue;
this.ich = 0;
var isCheckPoint = this.isDIF;
var xcheck = this.readSignedFloat() * this.xFactor;
yval = this.nextValue(yval);
if (!isCheckPoint && ipt > 0) x += deltaXcalc;
if (this.debugging) this.logError("Line: " + lineNumber + " isCP=" + isCheckPoint + "\t>>" + this.line + "<<\n x, xcheck " + x + " " + x / this.xFactor + " " + xcheck / this.xFactor + " " + deltaXcalc / this.xFactor);
var y = yval * this.yFactor;
var point =  new JSV.common.Coordinate().set(x, y);
if (ipt == 0 || !isCheckPoint) {
this.addPoint(point, ipt++);
} else if (ipt < this.nPoints) {
var lastY = this.xyCoords[ipt - 1].getYVal();
if (y != lastY) {
this.xyCoords[ipt - 1] = point;
this.logError(lastLine + "\n" + this.line + "\nY-value Checkpoint Error! Line " + lineNumber + " for y=" + y + " yLast=" + lastY);
}if (xcheck == prevXcheck || (xcheck < prevXcheck) != (deltaXcalc < 0)) {
this.logError(lastLine + "\n" + this.line + "\nX-sequence Checkpoint Error! Line " + lineNumber + " order for xCheck=" + xcheck + " after prevXCheck=" + prevXcheck);
}var xcheckDif = Math.abs(xcheck - prevXcheck);
var xiptDif = Math.abs((ipt - prevIpt) * deltaXcalc);
var fracDif = Math.abs((xcheckDif - xiptDif)) / xcheckDif;
if (this.debugging) System.err.println("JDXD fracDif = " + xcheck + "\t" + prevXcheck + "\txcheckDif=" + xcheckDif + "\txiptDif=" + xiptDif + "\tf=" + fracDif);
if (fracDif > difFracMax) {
this.logError(lastLine + "\n" + this.line + "\nX-value Checkpoint Error! Line " + lineNumber + " expected " + xiptDif + " but X-Sequence Check difference reads " + xcheckDif);
}}prevIpt = (ipt == 1 ? 0 : ipt);
prevXcheck = xcheck;
var nX = 0;
while (this.hasNext()) {
var ich0 = this.ich;
if (this.debugging) this.logError("line " + lineNumber + " char " + ich0 + ":" + this.line.substring(0, ich0) + ">>>>" + this.line.substring(this.ich));
if (Double.isNaN(yval = this.nextValue(yval))) {
this.logError("There was an error reading line " + lineNumber + " char " + ich0 + ":" + this.line.substring(0, ich0) + ">>>>" + this.line.substring(ich0));
} else {
x += deltaXcalc;
if (yval == 1.7976931348623157E308) {
yval = 0;
this.logError("Point marked invalid '?' for line " + lineNumber + " char " + ich0 + ":" + this.line.substring(0, ich0) + ">>>>" + this.line.substring(ich0));
}this.addPoint( new JSV.common.Coordinate().set(x, yval * this.yFactor), ipt++);
if (this.debugging) this.logError("nx=" + ++nX + " " + x + " " + x / this.xFactor + " yval=" + yval);
}}
this.lastX = x;
if (!haveWarned && ipt > this.nPoints) {
this.logError("! points overflow nPoints!");
haveWarned = true;
}lastLine = this.line;
}
} catch (ioe) {
if (Clazz_exceptionOf(ioe,"java.io.IOException")){
ioe.printStackTrace();
} else {
throw ioe;
}
}
this.checkZeroFill(ipt, lastXExpected);
return this.xyCoords;
}, "JU.SB");
Clazz_defineMethod(c$, "checkZeroFill", 
function(ipt, lastXExpected){
this.nptsFound = ipt;
if (this.nPoints == this.nptsFound) {
if (Math.abs(lastXExpected - this.lastX) > 0.00001) this.logError("Something went wrong! The last X value was " + this.lastX + " but expected " + lastXExpected);
} else {
this.logError("Decompressor did not find " + this.nPoints + " points -- instead " + this.nptsFound + " xyCoords.length set to " + this.nPoints);
for (var i = this.nptsFound; i < this.nPoints; i++) this.addPoint( new JSV.common.Coordinate().set(0, NaN), i);

}}, "~N,~N");
Clazz_defineMethod(c$, "addPoint", 
function(pt, ipt){
if (ipt >= this.nPoints) return;
this.xyCoords[ipt] = pt;
var y = pt.getYVal();
if (y > this.maxY) this.maxY = y;
 else if (y < this.minY) this.minY = y;
if (this.debugging) this.logError("Coord: " + ipt + pt);
}, "JSV.common.Coordinate,~N");
Clazz_defineMethod(c$, "logError", 
function(s){
if (this.debugging) JU.Logger.debug(s);
System.err.println(s);
this.errorLog.append(s).appendC('\n');
}, "~S");
Clazz_defineMethod(c$, "nextValue", 
function(yval){
if (this.dupCount > 0) return this.getDuplicate(yval);
var ch = this.skipUnknown();
switch (JSV.source.JDXDecompressor.actions[ch.charCodeAt(0)]) {
case 1:
this.isDIF = true;
return yval + (this.lastDif = this.readNextInteger(ch == '%' ? 0 : ch <= 'R' ? ch.charCodeAt(0) - 73 : 105 - ch.charCodeAt(0)));
case 2:
this.dupCount = this.readNextInteger((ch == 's' ? 9 : ch.charCodeAt(0) - 82)) - 1;
return this.getDuplicate(yval);
case 3:
yval = this.readNextSqueezedNumber(ch);
break;
case 4:
this.ich--;
yval = this.readSignedFloat();
break;
case -1:
yval = 1.7976931348623157E308;
break;
default:
yval = NaN;
break;
}
this.isDIF = false;
return yval;
}, "~N");
Clazz_defineMethod(c$, "skipUnknown", 
function(){
var ch = '\u0000';
while (this.ich < this.lineLen && JSV.source.JDXDecompressor.actions[(ch = this.line.charAt(this.ich++)).charCodeAt(0)] == 0) {
}
return ch;
});
Clazz_defineMethod(c$, "readSignedFloat", 
function(){
var ich0 = this.ich;
var ch = '\u0000';
while (this.ich < this.lineLen && " ,\t\n".indexOf(ch = this.line.charAt(this.ich)) >= 0) this.ich++;

var factor = 1;
switch ((ch).charCodeAt(0)) {
case 45:
factor = -1;
case 43:
ich0 = ++this.ich;
break;
}
if (this.scanToNonnumeric() == 'E' && this.ich + 3 < this.lineLen) {
switch ((this.line.charAt(this.ich + 1)).charCodeAt(0)) {
case 45:
case 43:
this.ich += 4;
if (this.ich < this.lineLen && (ch = this.line.charAt(this.ich)) >= '0' && ch <= '9') this.ich++;
break;
}
}return factor * Double.parseDouble(this.line.substring(ich0, this.ich));
});
Clazz_defineMethod(c$, "getDuplicate", 
function(yval){
this.dupCount--;
return (this.isDIF ? yval + this.lastDif : yval);
}, "~N");
Clazz_defineMethod(c$, "readNextInteger", 
function(n){
var c = String.fromCharCode(0);
while (this.ich < this.lineLen && (c = this.line.charAt(this.ich)) >= '0' && c <= '9') {
n = n * 10 + (n < 0 ? 48 - c.charCodeAt(0) : c.charCodeAt(0) - 48);
this.ich++;
}
return n;
}, "~N");
Clazz_defineMethod(c$, "readNextSqueezedNumber", 
function(ch){
var ich0 = this.ich;
this.scanToNonnumeric();
return Double.parseDouble((ch.charCodeAt(0) > 0x60 ? 0x60 - ch.charCodeAt(0) : ch.charCodeAt(0) - 0x40) + this.line.substring(ich0, this.ich));
}, "~S");
Clazz_defineMethod(c$, "scanToNonnumeric", 
function(){
var ch = String.fromCharCode(0);
while (this.ich < this.lineLen && ((ch = this.line.charAt(this.ich)) == '.' || ch >= '0' && ch <= '9')) this.ich++;

return (this.ich < this.lineLen ? ch : '\0');
});
Clazz_defineMethod(c$, "getNPointsFound", 
function(){
return this.nptsFound;
});
Clazz_overrideMethod(c$, "hasNext", 
function(){
return (this.ich < this.lineLen || this.dupCount > 0);
});
Clazz_overrideMethod(c$, "next", 
function(){
return (this.hasNext() ? Double.$valueOf(this.lastY = this.nextValue(this.lastY)) : null);
});
Clazz_overrideMethod(c$, "remove", 
function(){
});
c$.actions =  Clazz_newIntArray (255, 0);
{
for (var i = 0x25; i <= 0x73; i++) {
var c = String.fromCharCode(i);
switch ((c).charCodeAt(0)) {
case 37:
case 74:
case 75:
case 76:
case 77:
case 78:
case 79:
case 80:
case 81:
case 82:
case 106:
case 107:
case 108:
case 109:
case 110:
case 111:
case 112:
case 113:
case 114:
JSV.source.JDXDecompressor.actions[i] = 1;
break;
case 43:
case 45:
case 46:
case 48:
case 49:
case 50:
case 51:
case 52:
case 53:
case 54:
case 55:
case 56:
case 57:
JSV.source.JDXDecompressor.actions[i] = 4;
break;
case 63:
JSV.source.JDXDecompressor.actions[i] = -1;
break;
case 64:
case 65:
case 66:
case 67:
case 68:
case 69:
case 70:
case 71:
case 72:
case 73:
case 97:
case 98:
case 99:
case 100:
case 101:
case 102:
case 103:
case 104:
case 105:
JSV.source.JDXDecompressor.actions[i] = 3;
break;
case 83:
case 84:
case 85:
case 86:
case 87:
case 88:
case 89:
case 90:
case 115:
JSV.source.JDXDecompressor.actions[i] = 2;
break;
}
}
}});
;//5.0.1-v7 Mon Aug 17 10:07:10 MDT 2026
Clazz_declarePackage("JSV.source");
Clazz_load(["JU.Lst"], "JSV.source.JDXHeader", ["java.util.Hashtable", "JSV.source.JDXSourceStreamTokenizer"], function(){
var c$ = Clazz_decorateAsClass(function(){
this.title = "";
this.jcampdx = "5.01";
this.dataType = "";
this.dataClass = "";
this.origin = "";
this.owner = "PUBLIC DOMAIN";
this.longDate = "";
this.date = "";
this.time = "";
this.qualifiedType = null;
this.headerTable = null;
Clazz_instantialize(this, arguments);}, JSV.source, "JDXHeader", null);
Clazz_prepareFields (c$, function(){
this.headerTable =  new JU.Lst();
});
Clazz_defineMethod(c$, "setTitle", 
function(title){
this.title = title;
}, "~S");
Clazz_defineMethod(c$, "setJcampdx", 
function(versionNum){
this.jcampdx = versionNum;
}, "~S");
Clazz_defineMethod(c$, "setDataType", 
function(dataType){
this.dataType = dataType;
}, "~S");
Clazz_defineMethod(c$, "setDataClass", 
function(dataClass){
this.dataClass = dataClass;
}, "~S");
Clazz_defineMethod(c$, "setOrigin", 
function(origin){
this.origin = origin;
}, "~S");
Clazz_defineMethod(c$, "setOwner", 
function(owner){
this.owner = owner;
}, "~S");
Clazz_defineMethod(c$, "setLongDate", 
function(longDate){
this.longDate = longDate;
}, "~S");
Clazz_defineMethod(c$, "setDate", 
function(date){
this.date = date;
}, "~S");
Clazz_defineMethod(c$, "setTime", 
function(time){
this.time = time;
}, "~S");
Clazz_defineMethod(c$, "getTitle", 
function(){
return this.title;
});
c$.getTypeName = Clazz_defineMethod(c$, "getTypeName", 
function(type){
type = type.toUpperCase();
for (var i = 0; i < JSV.source.JDXHeader.typeNames.length; i++) if (JSV.source.JDXHeader.typeNames[i].startsWith(type)) {
return JSV.source.JDXHeader.typeNames[i].substring(18);
}
return type;
}, "~S");
Clazz_defineMethod(c$, "getQualifiedDataType", 
function(){
return (this.qualifiedType == null ? (this.qualifiedType = JSV.source.JDXHeader.getTypeName(this.dataType)) : this.qualifiedType);
});
Clazz_defineMethod(c$, "getJcampdx", 
function(){
return this.jcampdx;
});
Clazz_defineMethod(c$, "getDataType", 
function(){
return this.dataType;
});
Clazz_defineMethod(c$, "getOrigin", 
function(){
return this.origin;
});
Clazz_defineMethod(c$, "getOwner", 
function(){
return this.owner;
});
Clazz_defineMethod(c$, "getLongDate", 
function(){
return this.longDate;
});
Clazz_defineMethod(c$, "getDate", 
function(){
return this.date;
});
Clazz_defineMethod(c$, "getTime", 
function(){
return this.time;
});
Clazz_defineMethod(c$, "getDataClass", 
function(){
return this.dataClass;
});
Clazz_defineMethod(c$, "setHeaderTable", 
function(table){
this.headerTable = table;
}, "JU.Lst");
Clazz_defineMethod(c$, "getHeaderTable", 
function(){
return this.headerTable;
});
Clazz_defineMethod(c$, "getHeaderRowDataAsArray", 
function(addDataClass, nMore){
var rowData =  new Array((addDataClass ? 6 : 5) + this.headerTable.size() + nMore);
var i = 0;
rowData[i++] =  Clazz_newArray(-1, ["##TITLE", this.title]);
rowData[i++] =  Clazz_newArray(-1, ["##JCAMP-DX", this.jcampdx]);
rowData[i++] =  Clazz_newArray(-1, ["##DATA TYPE", this.dataType]);
if (addDataClass) rowData[i++] =  Clazz_newArray(-1, ["##DATA CLASS", this.dataClass]);
rowData[i++] =  Clazz_newArray(-1, ["##ORIGIN", this.origin]);
rowData[i++] =  Clazz_newArray(-1, ["##OWNER", this.owner]);
for (var j = 0; j < this.headerTable.size(); j++) rowData[i++] = this.getRow(j);

return rowData;
}, "~B,~N");
Clazz_defineMethod(c$, "getRow", 
function(j){
var s = this.headerTable.get(j);
{
return [s[0], JU.PT.rep(s[1], "<", "&lt;")];
}}, "~N");
/*if3*/;(function(){
var c$ = Clazz_decorateAsClass(function(){
this.table = null;
this.map = null;
Clazz_instantialize(this, arguments);}, JSV.source.JDXHeader, "DataLDRTable", null);
Clazz_makeConstructor(c$, 
function(){
this.table =  new JU.Lst();
this.map =  new java.util.Hashtable();
});
Clazz_defineMethod(c$, "addHeader", 
function(label, value){
var pt = this.map.get(label);
if (pt == null) {
pt = Integer.$valueOf(this.table.size());
this.table.addLast( Clazz_newArray(-1, [label, value, JSV.source.JDXSourceStreamTokenizer.cleanLabel(label)]));
this.map.put(label, pt);
} else {
var entry = this.table.get(pt.intValue());
entry[1] = value;
}}, "~S,~S");
/*eoif3*/})();
c$.typeNames =  Clazz_newArray(-1, ["ND NMR SPECTRUM   NMR", "NMR SPECTRUM      NMR", "INFRARED SPECTRUM IR", "MASS SPECTRUM     MS", "RAMAN SPECTRUM    RAMAN", "GAS CHROMATOGRAM  GC", "UV/VIS SPECTRUM   UV/VIS"]);
});
;//5.0.1-v7 Mon Aug 17 10:07:10 MDT 2026
Clazz_declarePackage("JSV.source");
Clazz_load(["J.api.JmolJDXMOLReader"], "JSV.source.JDXReader", ["java.io.BufferedReader", "$.FileInputStream", "$.StringReader", "java.util.Hashtable", "$.LinkedHashMap", "$.StringTokenizer", "javajs.api.Interface", "JU.AU", "$.Lst", "$.PT", "$.Rdr", "$.SB", "JSV.common.Coordinate", "$.JSVFileManager", "$.JSViewer", "$.PeakInfo", "$.Spectrum", "JSV.exception.JSVException", "JSV.source.JDXDecompressor", "$.JDXHeader", "$.JDXSource", "$.JDXSourceStreamTokenizer", "JU.Logger"], function(){
var c$ = Clazz_decorateAsClass(function(){
this.mnovaParamValue = null;
this.nmrMaxY = NaN;
this.source = null;
this.t = null;
this.errorLog = null;
this.obscure = false;
this.done = false;
this.isZipFile = false;
this.filePath = null;
this.loadImaginary = true;
this.isSimulation = false;
this.ignoreShiftReference = false;
this.ignorePeakTables = false;
this.lastErrPath = null;
this.isTabularData = false;
this.firstSpec = 0;
this.lastSpec = 0;
this.nSpec = 0;
this.blockID = 0;
this.mpr = null;
this.reader = null;
this.modelSpectrum = null;
this.acdAssignments = null;
this.acdMolFile = null;
this.peakData = null;
Clazz_instantialize(this, arguments);}, JSV.source, "JDXReader", null, J.api.JmolJDXMOLReader);
Clazz_makeConstructor(c$, 
function(filePath, obscure, loadImaginary, iSpecFirst, iSpecLast, nmrNormalization){
filePath = JU.PT.trimQuotes(filePath);
this.isSimulation = (filePath != null && filePath.startsWith("http://SIMULATION/"));
if (this.isSimulation) {
this.nmrMaxY = (Double.isNaN(nmrNormalization) ? 10000 : nmrNormalization);
}this.filePath = filePath;
this.obscure = obscure;
this.firstSpec = iSpecFirst;
this.lastSpec = iSpecLast;
this.loadImaginary = loadImaginary;
}, "~S,~B,~B,~N,~N,~N");
c$.getVarList = Clazz_defineMethod(c$, "getVarList", 
function(dataClass){
var index = JSV.source.JDXReader.VAR_LIST_TABLE[0].indexOf(dataClass);
return JSV.source.JDXReader.VAR_LIST_TABLE[1].substring(index + 1, index + 12).trim();
}, "~S");
c$.createJDXSourceFromStream = Clazz_defineMethod(c$, "createJDXSourceFromStream", 
function($in, obscure, loadImaginary, nmrMaxY){
return JSV.source.JDXReader.createJDXSource(null, $in, "stream", obscure, loadImaginary, -1, -1, nmrMaxY);
}, "java.io.InputStream,~B,~B,~N");
c$.getHeaderMap = Clazz_defineMethod(c$, "getHeaderMap", 
function($in, map){
return JSV.source.JDXReader.getHeaderMapS($in, map, -1, null);
}, "java.io.InputStream,java.util.Map");
c$.getHeaderMapS = Clazz_defineMethod(c$, "getHeaderMapS", 
function($in, map, index, suffix){
var source = JSV.source.JDXReader.createJDXSource(null, $in, null, false, false, 0, -1, 0).getJDXSpectrum(index);
var hlist = source.headerTable;
if (map == null) map =  new java.util.LinkedHashMap();
for (var i = 0, n = hlist.size(); i < n; i++) {
var h = hlist.get(i);
map.put((suffix == null ? h[2] : h[2] + suffix), h[1]);
}
return map;
}, "java.io.InputStream,java.util.Map,~N,~S");
c$.createJDXSource = Clazz_defineMethod(c$, "createJDXSource", 
function(file, $in, filePath, obscure, loadImaginary, iSpecFirst, iSpecLast, nmrMaxY){
var isHeaderOnly = (iSpecLast < iSpecFirst);
var data = null;
var br;
var bytes = null;
if (JU.AU.isAB($in)) {
bytes = $in;
if (JU.Rdr.isZipB(bytes)) {
return JSV.source.JDXReader.readBrukerFileZip(bytes, file == null ? filePath : file.getFullPath());
}}if ((typeof($in)=='string') || bytes != null) {
if ((typeof($in)=='string')) data = $in;
br = JSV.common.JSVFileManager.getBufferedReaderForStringOrBytes($in);
} else if (Clazz_instanceOf($in,"java.io.InputStream")) {
br = JSV.common.JSVFileManager.getBufferedReaderForInputStream($in);
} else {
br = $in;
}var header = null;
var source = null;
try {
if (br == null) {
if (file != null && file.isDirectory()) return JSV.source.JDXReader.readBrukerFileDir(file.getFullPath());
br = JSV.common.JSVFileManager.getBufferedReaderFromName(filePath);
}if (!isHeaderOnly) {
br.mark(400);
var chs =  Clazz_newCharArray (400, '\0');
br.read(chs, 0, 400);
br.reset();
header =  String.instantialize(chs);
if (header.startsWith("PK")) {
br.close();
return JSV.source.JDXReader.readBrukerFileZip(null, file.getFullPath());
}if (header.indexOf('\0') >= 0 || header.indexOf("##TITLE= Parameter file") == 0 || header.indexOf("##TITLE= Audit trail") == 0) {
br.close();
return JSV.source.JDXReader.readBrukerFileDir(file.getParentAsFile().getFullPath());
}var pt1 = header.indexOf('#');
var pt2 = header.indexOf('<');
if (pt1 < 0 || pt2 >= 0 && pt2 < pt1) {
var xmlType = header.toLowerCase();
xmlType = (xmlType.contains("<animl") || xmlType.contains("<!doctype technique") ? "AnIML" : xmlType.contains("xml-cml") ? "CML" : xmlType.contains("<nmrml") ? "NMRML" : null);
if (xmlType == null) return JSV.source.JDXReader.readBrukerFileDir(file.getFullPath());
source = (JSV.common.JSViewer.getInterface("JSV.source." + xmlType + "Reader")).getSource(filePath, br);
br.close();
if (source == null) {
JU.Logger.error(header + "...");
throw  new JSV.exception.JSVException("File type not recognized");
}}}if (source == null) {
source = ( new JSV.source.JDXReader(filePath, obscure, loadImaginary, iSpecFirst, iSpecLast, nmrMaxY)).getJDXSource(br, isHeaderOnly);
}if (data != null) source.setInlineData(data);
return source;
} catch (e) {
if (Clazz_exceptionOf(e, Exception)){
if (!JSV.common.JSViewer.isJS) e.printStackTrace();
if (br != null) br.close();
if (header != null) JU.Logger.error(header + "...");
var s = e.getMessage();
{
}throw  new JSV.exception.JSVException("Error reading data: " + s);
} else {
throw e;
}
}
}, "J.api.GenericFileInterface,~O,~S,~B,~B,~N,~N,~N");
c$.readBrukerFileDir = Clazz_defineMethod(c$, "readBrukerFileDir", 
function(filePath){
return (javajs.api.Interface.getInterface("JSV.source.BrukerReader")).readBrukerDir(filePath);
}, "~S");
c$.readBrukerFileZip = Clazz_defineMethod(c$, "readBrukerFileZip", 
function(bytes, filePath){
return (javajs.api.Interface.getInterface("JSV.source.BrukerReader")).readBrukerZip(bytes, filePath);
}, "~A,~S");
Clazz_defineMethod(c$, "getJDXSource", 
function(reader, isHeaderOnly){
this.source =  new JSV.source.JDXSource(0, this.filePath);
this.isZipFile = (Clazz_instanceOf(reader,"JSV.api.JSVZipReader"));
this.t =  new JSV.source.JDXSourceStreamTokenizer(reader);
this.errorLog =  new JU.SB();
var label = null;
var value = null;
var isOK = false;
while (!this.done && "##TITLE".equals(this.t.peakLabel())) {
isOK = true;
if (label != null && !this.isZipFile) this.logError("Warning - file is a concatenation without LINK record -- does not conform to JCAMP-DX standard 6.1.3!");
var spectrum =  new JSV.common.Spectrum();
var dataLDRTable =  new JSV.source.JDXHeader.DataLDRTable();
if (isHeaderOnly) spectrum.setHeaderTable(dataLDRTable.table);
while (!this.done && (label = this.t.getLabel()) != null && (value = this.getValue(label)) != null) {
if (this.isTabularData) {
if (isHeaderOnly) {
dataLDRTable.addHeader(this.t.rawLabel, "<data>");
break;
}this.processTabularData(spectrum, dataLDRTable, label, isHeaderOnly);
this.addSpectrum(spectrum, false);
if (this.isSimulation && spectrum.getXUnits().equals("PPM")) spectrum.setHZtoPPM(true);
spectrum = null;
continue;
}if (!isHeaderOnly) {
if (label.equals("##DATATYPE") && value.toUpperCase().equals("LINK")) {
this.getBlockSpectra(dataLDRTable);
spectrum = null;
continue;
}if (label.equals("##NTUPLES") || label.equals("##VARNAME")) {
this.getNTupleSpectra(dataLDRTable, spectrum, label);
spectrum = null;
continue;
}}if (label.equals("##JCAMPDX")) {
this.setVenderSpecificValues(this.t.rawLine);
}if (spectrum == null) spectrum =  new JSV.common.Spectrum();
this.processLabel(spectrum, dataLDRTable, label, value, isHeaderOnly);
}
if (isHeaderOnly && spectrum != null) this.addSpectrum(spectrum, false);
}
if (!isOK) throw  new JSV.exception.JSVException("##TITLE record not found");
this.source.setErrorLog(this.errorLog.toString());
return this.source;
}, "~O,~B");
Clazz_defineMethod(c$, "processLabel", 
function(spectrum, dataLDRTable, label, value, isHeaderOnly){
if (!this.readDataLabel(spectrum, label, value, this.errorLog, this.obscure, isHeaderOnly) && !isHeaderOnly) return;
if (this.mnovaParamValue != null) {
var pt;
if (value.startsWith("(") && (pt = value.indexOf(',')) >= 0) {
var key = value.substring(1, pt).trim();
pt = value.indexOf(')', pt + 1);
if (pt > 0) {
value = value.substring(pt + 1).trim();
}dataLDRTable.addHeader(key, value);
}this.mnovaParamValue = null;
} else {
dataLDRTable.addHeader(this.t.rawLabel, value);
}if (!isHeaderOnly) this.checkCustomTags(spectrum, label, value);
}, "JSV.common.Spectrum,JSV.source.JDXHeader.DataLDRTable,~S,~S,~B");
Clazz_defineMethod(c$, "logError", 
function(err){
this.errorLog.append(this.filePath == null || this.filePath.equals(this.lastErrPath) ? "" : this.filePath).append("\n").append(err).append("\n");
this.lastErrPath = this.filePath;
}, "~S");
Clazz_defineMethod(c$, "setVenderSpecificValues", 
function(rawLine){
if (rawLine.indexOf("JEOL") >= 0) {
System.out.println("Skipping ##.SHIFTREFERENCE for JEOL " + rawLine);
this.ignoreShiftReference = true;
}if (rawLine.indexOf("MestReNova") >= 0) {
this.ignorePeakTables = true;
}}, "~S");
Clazz_defineMethod(c$, "getValue", 
function(label){
var value = (this.isTabularDataLabel(label) ? "" : this.t.getValue());
return ("##END".equals(label) ? null : value);
}, "~S");
Clazz_defineMethod(c$, "isTabularDataLabel", 
function(label){
return (this.isTabularData = ("##DATATABLE##PEAKTABLE##XYDATA##XYPOINTS#".indexOf(label + "#") >= 0));
}, "~S");
Clazz_defineMethod(c$, "addSpectrum", 
function(spectrum, forceSub){
if (!this.loadImaginary && spectrum.isImaginary()) {
JU.Logger.info("FileReader skipping imaginary spectrum -- use LOADIMAGINARY TRUE to load this spectrum.");
return true;
}if (this.acdAssignments != null) {
if (!spectrum.dataType.equals("MASS SPECTRUM") && !spectrum.isContinuous()) {
JU.Logger.info("Skipping ACD Labs line spectrum for " + spectrum);
return true;
}if (this.acdAssignments.size() > 0) {
try {
this.mpr.setACDAssignments(spectrum.title, spectrum.getTypeLabel(), this.source.peakCount, this.acdAssignments, this.acdMolFile);
} catch (e) {
if (Clazz_exceptionOf(e, Exception)){
JU.Logger.info("Failed to create peak data: " + e);
} else {
throw e;
}
}
}if (this.acdMolFile != null) JSV.common.JSVFileManager.cachePut("mol", this.acdMolFile);
}if (!Float.isNaN(this.nmrMaxY)) spectrum.normalizeSimulation(this.nmrMaxY);
 else if (spectrum.getMaxY() >= 10000) spectrum.normalizeSimulation(1000);
if (this.isSimulation) spectrum.setSimulated(this.filePath);
this.nSpec++;
if (this.firstSpec > 0 && this.nSpec < this.firstSpec) return true;
if (this.lastSpec > 0 && this.nSpec > this.lastSpec) return !(this.done = true);
spectrum.setBlockID(this.blockID);
this.source.addJDXSpectrum(null, spectrum, forceSub);
return true;
}, "JSV.common.Spectrum,~B");
Clazz_defineMethod(c$, "getBlockSpectra", 
function(sourceLDRTable){
JU.Logger.debug("--JDX block start--");
var label = "";
var value = null;
var isNew = (this.source.type == 0);
var forceSub = false;
while ((label = this.t.getLabel()) != null && !label.equals("##TITLE")) {
value = this.getValue(label);
if (isNew && !this.readHeaderLabel(this.source, label, value, this.errorLog, this.obscure)) sourceLDRTable.addHeader(this.t.rawLabel, value);
if (label.equals("##BLOCKS")) {
var nBlocks = JU.PT.parseInt(value);
if (nBlocks > 100 && this.firstSpec <= 0) forceSub = true;
}}
value = this.getValue(label);
if (!"##TITLE".equals(label)) throw  new JSV.exception.JSVException("Unable to read block source");
if (isNew) this.source.setHeaderTable(sourceLDRTable.table);
this.source.type = 1;
this.source.isCompoundSource = true;
var spectrum =  new JSV.common.Spectrum();
var dataLDRTable =  new JSV.source.JDXHeader.DataLDRTable();
this.readDataLabel(spectrum, label, value, this.errorLog, this.obscure, false);
try {
var tmp;
while ((tmp = this.t.getLabel()) != null) {
if ((value = this.getValue(tmp)) == null && "##END".equals(label)) {
JU.Logger.debug("##END= " + this.t.getValue());
break;
}label = tmp;
if (this.isTabularData) {
this.processTabularData(spectrum, dataLDRTable, label, false);
continue;
}if (label.equals("##DATATYPE")) {
if (value.toUpperCase().equals("LINK")) {
this.getBlockSpectra(dataLDRTable);
spectrum = null;
label = null;
} else if (value.toUpperCase().startsWith("NMR PEAK")) {
if (this.ignorePeakTables) {
this.done = true;
return this.source;
}}} else if (label.equals("##NTUPLES") || label.equals("##VARNAME")) {
this.getNTupleSpectra(dataLDRTable, spectrum, label);
spectrum = null;
label = "";
}if (this.done) break;
if (spectrum == null) {
spectrum =  new JSV.common.Spectrum();
dataLDRTable =  new JSV.source.JDXHeader.DataLDRTable();
if (label === "") continue;
if (label == null) {
label = "##END";
continue;
}}if (value == null) {
if (spectrum.getXYCoords().length > 0 && !this.addSpectrum(spectrum, forceSub)) return this.source;
spectrum =  new JSV.common.Spectrum();
dataLDRTable =  new JSV.source.JDXHeader.DataLDRTable();
continue;
}this.processLabel(spectrum, dataLDRTable, label, value, false);
}
} catch (e) {
if (Clazz_exceptionOf(e, Exception)){
if (!JSV.common.JSViewer.isJS) e.printStackTrace();
throw  new JSV.exception.JSVException(e.getMessage());
} else {
throw e;
}
}
this.addErrorLogSeparator();
this.source.setErrorLog(this.errorLog.toString());
JU.Logger.debug("--JDX block end--");
return this.source;
}, "JSV.source.JDXHeader.DataLDRTable");
Clazz_defineMethod(c$, "addErrorLogSeparator", 
function(){
if (this.errorLog.length() > 0 && this.errorLog.lastIndexOf("=====================\n") != this.errorLog.length() - "=====================\n".length) this.logError("=====================\n");
});
Clazz_defineMethod(c$, "getNTupleSpectra", 
function(sourceLDRTable, spectrum0, label){
var minMaxY =  Clazz_newDoubleArray(-1, [1.7976931348623157E308, 4.9E-324]);
this.blockID = Math.random();
var isOK = true;
if (this.firstSpec > 0) spectrum0.setNumDim(1);
var isVARNAME = label.equals("##VARNAME");
if (!isVARNAME) {
label = "";
}var nTupleTable =  new java.util.Hashtable();
var plotSymbols =  new Array(2);
var isNew = (this.source.type == 0);
if (isNew) {
this.source.type = 2;
this.source.isCompoundSource = true;
this.source.setHeaderTable(sourceLDRTable.table);
}while (!(label = (isVARNAME ? label : this.t.getLabel())).equals("##PAGE")) {
isVARNAME = false;
var st =  new java.util.StringTokenizer(this.t.getValue(), ",");
var attrList =  new JU.Lst();
while (st.hasMoreTokens()) attrList.addLast(st.nextToken().trim());

nTupleTable.put(label, attrList);
}
var symbols = nTupleTable.get("##SYMBOL");
if (!label.equals("##PAGE")) throw  new JSV.exception.JSVException("Error Reading NTuple Source");
var page = this.t.getValue();
var spectrum = null;
var isFirst = true;
while (!this.done) {
if ((label = this.t.getLabel()).equals("##ENDNTUPLES")) {
this.t.getValue();
break;
}if (label.equals("##PAGE")) {
page = this.t.getValue();
continue;
}if (spectrum == null) {
spectrum =  new JSV.common.Spectrum();
spectrum0.copyTo(spectrum);
spectrum.setTitle(spectrum0.getTitle());
if (!spectrum.is1D()) {
var pt = page.indexOf('=');
if (pt >= 0) try {
spectrum.setY2D(this.parseAFFN(page.substring(0, pt), page.substring(pt + 1).trim()));
var y2dUnits = page.substring(0, pt).trim();
var i = symbols.indexOf(y2dUnits);
if (i >= 0) spectrum.setY2DUnits(nTupleTable.get("##UNITS").get(i));
} catch (e) {
if (Clazz_exceptionOf(e, Exception)){
} else {
throw e;
}
}
}}var dataLDRTable =  new JSV.source.JDXHeader.DataLDRTable();
spectrum.setHeaderTable(dataLDRTable.table);
while (!label.equals("##DATATABLE")) {
dataLDRTable.addHeader(this.t.rawLabel, this.t.getValue());
label = this.t.getLabel();
}
var continuous = true;
var line = this.t.flushLine();
if (line.trim().indexOf("PEAKS") > 0) continuous = false;
var index1 = line.indexOf('(');
var index2 = line.lastIndexOf(')');
if (index1 == -1 || index2 == -1) throw  new JSV.exception.JSVException("Variable List not Found");
var varList = line.substring(index1, index2 + 1);
var countSyms = 0;
for (var i = 0; i < symbols.size(); i++) {
var sym = symbols.get(i).trim();
if (varList.indexOf(sym) != -1) {
plotSymbols[countSyms++] = sym;
}if (countSyms == 2) break;
}
this.setTabularDataType(spectrum, "##" + (continuous ? "XYDATA" : "PEAKTABLE"));
if (!this.readNTUPLECoords(spectrum, nTupleTable, plotSymbols, minMaxY)) throw  new JSV.exception.JSVException("Unable to read Ntuple Source");
if (!spectrum.nucleusX.equals("?")) spectrum0.nucleusX = spectrum.nucleusX;
spectrum0.nucleusY = spectrum.nucleusY;
spectrum0.freq2dX = spectrum.freq2dX;
spectrum0.freq2dY = spectrum.freq2dY;
spectrum0.y2DUnits = spectrum.y2DUnits;
for (var i = 0, n = sourceLDRTable.table.size(); i < n; i++) {
var entry = sourceLDRTable.table.get(i);
var key = JSV.source.JDXSourceStreamTokenizer.cleanLabel(entry[0]);
if (!key.equals("##TITLE") && !key.equals("##DATACLASS") && !key.equals("##NTUPLES")) dataLDRTable.table.addLast(entry);
}
if (isOK) this.addSpectrum(spectrum, !isFirst);
isFirst = false;
spectrum = null;
}
this.addErrorLogSeparator();
this.source.setErrorLog(this.errorLog.toString());
JU.Logger.info("NTUPLE MIN/MAX Y = " + minMaxY[0] + " " + minMaxY[1]);
return this.source;
}, "JSV.source.JDXHeader.DataLDRTable,JSV.source.JDXDataObject,~S");
Clazz_defineMethod(c$, "readDataLabel", 
function(spectrum, label, value, errorLog, obscure, isHeaderOnly){
if (!this.readHeaderLabel(spectrum, label, value, errorLog, obscure)) return false;
label += " ";
if (("##MINX ##MINY ##MAXX ##MAXY ##FIRSTY ##DELTAX ##DATACLASS ").indexOf(label) >= 0) return false;
switch (("##FIRSTX  ##LASTX   ##NPOINTS ##XFACTOR ##YFACTOR ##XUNITS  ##YUNITS  ##XLABEL  ##YLABEL  ##NUMDIM  ##OFFSET  ").indexOf(label)) {
case 0:
spectrum.fileFirstX = this.parseAFFN(label, value);
return false;
case 10:
spectrum.fileLastX = this.parseAFFN(label, value);
return false;
case 20:
spectrum.fileNPoints = Integer.parseInt(value);
return false;
case 30:
spectrum.setXFactor(this.parseAFFN(label, value));
return false;
case 40:
spectrum.yFactor = this.parseAFFN(label, value);
return false;
case 50:
spectrum.setXUnits(value);
return false;
case 60:
spectrum.setYUnits(value);
return false;
case 70:
spectrum.setXLabel(value);
return true;
case 80:
spectrum.setYLabel(value);
return true;
case 90:
spectrum.setNumDim(Integer.parseInt(value));
return false;
case 100:
if (!spectrum.isShiftTypeSpecified()) {
spectrum.setShiftReference(this.parseAFFN(label, value), 1, 1);
}return false;
default:
if (label.length < 17 || isHeaderOnly && value.indexOf(",") >= 0) return !isHeaderOnly;
if (label.equals("##.OBSERVEFREQUENCY ")) {
spectrum.setObservedFreq(this.parseAFFN(label, value));
return false;
}if (label.equals("##.OBSERVENUCLEUS ")) {
spectrum.setObservedNucleus(value);
return false;
}if (label.equals("##$REFERENCEPOINT ") && !spectrum.isShiftTypeSpecified()) {
var pt = value.indexOf(" ");
if (pt > 0) value = value.substring(0, pt);
spectrum.setShiftReference(this.parseAFFN(label, value), 1, 2);
return false;
}if (label.equals("##.SHIFTREFERENCE ")) {
if (this.ignoreShiftReference || !(spectrum.dataType.toUpperCase().contains("SPECTRUM"))) return false;
value = JU.PT.replaceAllCharacters(value, ")(", "");
var srt =  new java.util.StringTokenizer(value, ",");
if (srt.countTokens() != 4) return false;
try {
srt.nextToken();
srt.nextToken();
var pt = Clazz_floatToInt(Float.parseFloat(srt.nextToken().trim()));
var shift = this.parseAFFN(label, srt.nextToken().trim());
spectrum.setShiftReference(shift, pt, 0);
} catch (e) {
if (Clazz_exceptionOf(e, Exception)){
} else {
throw e;
}
}
return false;
}return true;
}
}, "JSV.source.JDXDataObject,~S,~S,JU.SB,~B,~B");
Clazz_defineMethod(c$, "readHeaderLabel", 
function(jdxHeader, label, value, errorLog, obscure){
switch (label) {
case "##TITLE":
jdxHeader.setTitle(obscure || value == null || value.equals("") ? "Unknown" : value);
return false;
case "##JCAMPDX":
jdxHeader.jcampdx = value;
var version = JU.PT.parseFloat(value);
if (version >= 6 || Float.isNaN(version)) {
if (errorLog != null) errorLog.append("Warning: JCAMP-DX version may not be fully supported: " + value + "\n");
}return false;
case "##ORIGIN":
jdxHeader.origin = (value != null && !value.equals("") ? value : "Unknown");
return false;
case "##OWNER":
jdxHeader.owner = (value != null && !value.equals("") ? value : "Unknown");
return false;
case "##DATATYPE":
jdxHeader.dataType = value;
return false;
case "##LONGDATE":
jdxHeader.longDate = value;
return false;
case "##DATE":
jdxHeader.date = value;
return false;
case "##TIME":
jdxHeader.time = value;
return false;
case "##$PARAMETERFILE":
this.mnovaParamValue = value;
return false;
}
return true;
}, "JSV.source.JDXHeader,~S,~S,JU.SB,~B");
Clazz_defineMethod(c$, "setTabularDataType", 
function(spectrum, label){
if (label.equals("##PEAKASSIGNMENTS")) spectrum.setDataClass("PEAKASSIGNMENTS");
 else if (label.equals("##PEAKTABLE")) spectrum.setDataClass("PEAKTABLE");
 else if (label.equals("##XYDATA")) spectrum.setDataClass("XYDATA");
 else if (label.equals("##XYPOINTS")) spectrum.setDataClass("XYPOINTS");
}, "JSV.source.JDXDataObject,~S");
Clazz_defineMethod(c$, "processTabularData", 
function(spec, table, label, isHeaderOnly){
this.setTabularDataType(spec, label);
spec.setHeaderTable(table.table);
if (spec.dataClass.equals("XYDATA")) {
spec.checkJDXRequiredTokens();
if (!isHeaderOnly) this.decompressData(spec, null);
return;
}if (spec.dataClass.equals("PEAKTABLE") || spec.dataClass.equals("XYPOINTS")) {
spec.setContinuous(spec.dataClass.equals("XYPOINTS"));
try {
this.t.readLineTrimmed();
} catch (e) {
if (Clazz_exceptionOf(e,"java.io.IOException")){
} else {
throw e;
}
}
var xyCoords;
if (spec.xFactor != 1.7976931348623157E308 && spec.yFactor != 1.7976931348623157E308) {
var data = this.t.getValue();
xyCoords = JSV.common.Coordinate.parseDSV(data, spec.xFactor, spec.yFactor);
} else {
xyCoords = JSV.common.Coordinate.parseDSV(this.t.getValue(), 1, 1);
}spec.setXYCoords(xyCoords);
var fileDeltaX = JSV.common.Coordinate.deltaX(xyCoords[xyCoords.length - 1].getXVal(), xyCoords[0].getXVal(), xyCoords.length);
spec.setIncreasing(fileDeltaX > 0);
return;
}throw  new JSV.exception.JSVException("Unable to read JDX file tabular data for line " + this.t.labelLineNo);
}, "JSV.source.JDXDataObject,JSV.source.JDXHeader.DataLDRTable,~S,~B");
Clazz_defineMethod(c$, "readNTUPLECoords", 
function(spec, nTupleTable, plotSymbols, minMaxY){
var list;
var label;
if (spec.dataClass.equals("XYDATA")) {
list = nTupleTable.get("##SYMBOL");
var index1 = list.indexOf(plotSymbols[0]);
var index2 = list.indexOf(plotSymbols[1]);
list = nTupleTable.get("##VARNAME");
spec.setVarName(list.get(index2).toUpperCase());
list = nTupleTable.get(label = "##FACTOR");
spec.setXFactor(this.parseAFFN(label, list.get(index1)));
spec.setYFactor(this.parseAFFN(label, list.get(index2)));
list = nTupleTable.get(label = "##LAST");
spec.fileLastX = this.parseAFFN(label, list.get(index1));
list = nTupleTable.get(label = "##FIRST");
spec.fileFirstX = this.parseAFFN(label, list.get(index1));
list = nTupleTable.get("##VARDIM");
spec.fileNPoints = Integer.parseInt(list.get(index1));
list = nTupleTable.get("##UNITS");
spec.setXUnits(list.get(index1));
spec.setYUnits(list.get(index2));
if (spec.nucleusX == null && (list = nTupleTable.get("##.NUCLEUS")) != null) {
spec.setNucleusAndFreq(list.get(0), false);
spec.setNucleusAndFreq(list.get(index1), true);
} else {
if (spec.nucleusX == null) spec.nucleusX = "?";
}this.decompressData(spec, minMaxY);
return true;
}if (spec.dataClass.equals("PEAKTABLE") || spec.dataClass.equals("XYPOINTS")) {
spec.setContinuous(spec.dataClass.equals("XYPOINTS"));
list = nTupleTable.get("##SYMBOL");
var index1 = list.indexOf(plotSymbols[0]);
var index2 = list.indexOf(plotSymbols[1]);
list = nTupleTable.get("##UNITS");
spec.setXUnits(list.get(index1));
spec.setYUnits(list.get(index2));
spec.setXYCoords(JSV.common.Coordinate.parseDSV(this.t.getValue(), spec.xFactor, spec.yFactor));
return true;
}return false;
}, "JSV.source.JDXDataObject,java.util.Map,~A,~A");
Clazz_defineMethod(c$, "parseAFFN", 
function(label, val){
var pt = val.indexOf("E");
if (pt > 0) {
var len = val.length;
var ch;
switch (len - pt) {
case 2:
case 3:
this.logError("Warning - " + label + " value " + val + " is not of the format xxxE[+/-]nn or xxxE[+/-]nnn (spec. 4.5.3) -- warning only; accepted");
break;
case 4:
case 5:
if ((ch = val.charAt(pt + 1)) == '+' || ch == '-') break;
default:
this.logError("Error - " + label + " value " + val + " is not of the format xxxE[+/-]nn or xxxE[+/-]nnn (spec. 4.5.3) -- " + val.substring(pt) + " ignored!");
val = val.substring(0, pt);
}
}return Double.parseDouble(val);
}, "~S,~S");
Clazz_defineMethod(c$, "decompressData", 
function(spec, minMaxY){
var errPt = this.errorLog.length();
spec.setIncreasing(spec.fileLastX > spec.fileFirstX);
spec.setContinuous(true);
var decompressor =  new JSV.source.JDXDecompressor(this.t, spec.fileFirstX, spec.fileLastX, spec.xFactor, spec.yFactor, spec.fileNPoints);
var t = System.currentTimeMillis();
var xyCoords = decompressor.decompressData(this.errorLog);
if (JU.Logger.debugging) JU.Logger.debug("decompression time = " + (System.currentTimeMillis() - t) + " ms");
spec.setXYCoords(xyCoords);
var d = decompressor.getMinY();
if (minMaxY != null) {
if (d < minMaxY[0]) minMaxY[0] = d;
d = decompressor.getMaxY();
if (d > minMaxY[1]) minMaxY[1] = d;
}spec.finalizeCoordinates();
if (this.errorLog.length() != errPt) {
var fileDeltaX = JSV.common.Coordinate.deltaX(spec.fileLastX, spec.fileFirstX, spec.fileNPoints);
this.logError(spec.getTitle());
this.logError("firstX from Header " + spec.fileFirstX);
this.logError("lastX from Header " + spec.fileLastX + " Found " + decompressor.lastX);
this.logError("deltaX from Header " + fileDeltaX);
this.logError("Number of points in Header " + spec.fileNPoints + " Found " + decompressor.getNPointsFound());
} else {
}if (JU.Logger.debugging) {
System.err.println(this.errorLog.toString());
}}, "JSV.source.JDXDataObject,~A");
Clazz_defineMethod(c$, "checkCustomTags", 
function(spectrum, label, value){
if (label.length > 10) label = label.substring(0, 10);
if (spectrum == null) System.out.println(label);
 else this.modelSpectrum = spectrum;
var pt = "##$MODELS ##$PEAKS  ##$SIGNALS##$MOLFILE##PEAKASSI##$UVIRASS##$MSFRAGM".indexOf(label);
if (pt < 0) return false;
this.getMpr().set(this, this.filePath, null);
try {
this.reader =  new java.io.BufferedReader( new java.io.StringReader(value));
switch (pt) {
case 0:
this.mpr.readModels();
break;
case 10:
case 20:
this.peakData =  new JU.Lst();
this.source.peakCount += this.mpr.readPeaks(pt == 20, this.source.peakCount);
break;
case 30:
this.acdAssignments =  new JU.Lst();
this.acdMolFile = JU.PT.rep(value, "$$ Empty String", "");
break;
case 40:
case 50:
case 60:
this.acdAssignments =  new JU.Lst();
return this.mpr.readACDAssignments((spectrum).fileNPoints, pt == 40, this.acdAssignments);
}
} catch (e) {
if (Clazz_exceptionOf(e, Exception)){
throw  new JSV.exception.JSVException(e.getMessage());
} else {
throw e;
}
} finally {
this.reader = null;
}
return true;
}, "JSV.common.Spectrum,~S,~S");
Clazz_defineMethod(c$, "getMpr", 
function(){
return (this.mpr == null ? this.mpr = JSV.common.JSViewer.getInterface("J.jsv.JDXMOLParser") : this.mpr);
});
Clazz_overrideMethod(c$, "rd", 
function(){
return this.reader.readLine();
});
Clazz_overrideMethod(c$, "setSpectrumPeaks", 
function(nH, peakXLabel, peakYlabel){
this.modelSpectrum.setPeakList(this.peakData, peakXLabel, peakYlabel);
if (this.modelSpectrum.isNMR()) this.modelSpectrum.setHydrogenCount(nH);
}, "~N,~S,~S");
Clazz_overrideMethod(c$, "addPeakData", 
function(info){
if (this.peakData == null) this.peakData =  new JU.Lst();
this.peakData.addLast( new JSV.common.PeakInfo(info));
}, "~S");
Clazz_overrideMethod(c$, "processModelData", 
function(id, data, type, base, last, modelScale, vibScale, isFirst){
}, "~S,~S,~S,~S,~S,~N,~N,~B");
Clazz_overrideMethod(c$, "discardLinesUntilContains", 
function(containsMatch){
var line;
while ((line = this.rd()) != null && line.indexOf(containsMatch) < 0) {
}
return line;
}, "~S");
Clazz_overrideMethod(c$, "discardLinesUntilContains2", 
function(s1, s2){
var line;
while ((line = this.rd()) != null && line.indexOf(s1) < 0 && line.indexOf(s2) < 0) {
}
return line;
}, "~S,~S");
Clazz_overrideMethod(c$, "discardLinesUntilNonBlank", 
function(){
var line;
while ((line = this.rd()) != null && line.trim().length == 0) {
}
return line;
});
c$.main = Clazz_defineMethod(c$, "main", 
function(args){
try {
var map = JSV.source.JDXReader.getHeaderMap( new java.io.FileInputStream("c:/temp/t6.jdx"), null);
for (var k, $k = map.keySet().iterator (); $k.hasNext()&& ((k = $k.next ()) || true);) {
if (k.startsWith("##")) continue;
var s = map.get(k);
if (s.length > 30) {
s = s.substring(0, 30) + "...";
}System.out.println(k + "=" + s);
}
} catch (e) {
if (Clazz_exceptionOf(e, Exception)){
e.printStackTrace();
} else {
throw e;
}
}
System.out.println("done");
}, "~A");
c$.VAR_LIST_TABLE =  Clazz_newArray(-1, ["PEAKTABLE   XYDATA      XYPOINTS", " (XY..XY)    (X++(Y..Y)) (XY..XY)    "]);
});
;//5.0.1-v7 Mon Aug 17 10:07:10 MDT 2026
Clazz_declarePackage("JSV.source");
Clazz_load(["JSV.source.JDXHeader"], "JSV.source.JDXSource", ["JU.Lst"], function(){
var c$ = Clazz_decorateAsClass(function(){
this.type = 0;
this.isCompoundSource = false;
this.jdxSpectra = null;
this.errors = "";
this.filePath = null;
this.peakCount = 0;
this.isView = false;
this.inlineData = null;
Clazz_instantialize(this, arguments);}, JSV.source, "JDXSource", JSV.source.JDXHeader);
Clazz_makeConstructor(c$, 
function(type, filePath){
Clazz_superConstructor (this, JSV.source.JDXSource, []);
this.type = type;
this.setFilePath(filePath);
this.headerTable =  new JU.Lst();
this.jdxSpectra =  new JU.Lst();
this.isCompoundSource = (type != 0);
}, "~N,~S");
Clazz_defineMethod(c$, "dispose", 
function(){
this.headerTable = null;
this.jdxSpectra = null;
});
Clazz_defineMethod(c$, "getJDXSpectrum", 
function(index){
if (index < 0) index += this.jdxSpectra.size();
return (this.jdxSpectra.size() <= index ? null : this.jdxSpectra.get(index));
}, "~N");
Clazz_defineMethod(c$, "addJDXSpectrum", 
function(filePath, spectrum, forceSub){
if (filePath == null) filePath = this.filePath;
spectrum.setFilePath(filePath);
if (this.inlineData != null) spectrum.setInlineData(this.inlineData);
var n = this.jdxSpectra.size();
if (n == 0 || !this.jdxSpectra.get(n - 1).addSubSpectrum(spectrum, forceSub)) this.jdxSpectra.addLast(spectrum);
}, "~S,JSV.common.Spectrum,~B");
Clazz_defineMethod(c$, "getNumberOfSpectra", 
function(){
return this.jdxSpectra.size();
});
Clazz_defineMethod(c$, "getSpectra", 
function(){
return this.jdxSpectra;
});
Clazz_defineMethod(c$, "getSpectraAsArray", 
function(){
return (this.jdxSpectra == null ? null : this.jdxSpectra.toArray());
});
Clazz_defineMethod(c$, "getErrorLog", 
function(){
return this.errors;
});
Clazz_defineMethod(c$, "setErrorLog", 
function(errors){
this.errors = errors;
}, "~S");
Clazz_defineMethod(c$, "setFilePath", 
function(filePath){
this.filePath = filePath;
}, "~S");
Clazz_defineMethod(c$, "getFilePath", 
function(){
return this.filePath;
});
c$.createView = Clazz_defineMethod(c$, "createView", 
function(specs){
var source =  new JSV.source.JDXSource(-2, "view");
source.isView = true;
for (var i = 0; i < specs.size(); i++) source.addJDXSpectrum(specs.get(i).getFilePath(), specs.get(i), false);

return source;
}, "JU.Lst");
Clazz_defineMethod(c$, "getHeaderRowDataAsArray", 
function(addDataClass, rowData){
if (rowData == null) rowData =  Clazz_newArray(0, 0, null);
var data = this.getHeaderRowDataAsArray(addDataClass, rowData.length);
for (var i = rowData.length; --i >= 0; ) data[data.length - rowData.length + i] = rowData[i];

return data;
}, "~B,~A");
Clazz_defineMethod(c$, "setID", 
function(id){
this.jdxSpectra.get(0).sourceID = id;
}, "~S");
Clazz_defineMethod(c$, "matchesFilePath", 
function(filePath){
return this.filePath.equals(filePath) || this.filePath.$replace('\\', '/').equals(filePath);
}, "~S");
Clazz_defineMethod(c$, "setInlineData", 
function(data){
this.inlineData = data;
if (this.jdxSpectra != null) for (var i = this.jdxSpectra.size(); --i >= 0; ) this.jdxSpectra.get(i).setInlineData(data);

}, "~S");
});
;//5.0.1-v7 Mon Aug 17 10:07:10 MDT 2026
Clazz_declarePackage("JSV.source");
Clazz_load(null, "JSV.source.JDXSourceStreamTokenizer", ["JU.SB", "JU.Logger"], function(){
var c$ = Clazz_decorateAsClass(function(){
this.br = null;
this.rawLabel = null;
this.value = null;
this.labelLineNo = 0;
this.line = null;
this.lineNo = 0;
this.rawLine = null;
Clazz_instantialize(this, arguments);}, JSV.source, "JDXSourceStreamTokenizer", null);
Clazz_makeConstructor(c$, 
function(br){
this.br = br;
}, "java.io.BufferedReader");
Clazz_defineMethod(c$, "peakLabel", 
function(){
return this.nextLabel(false);
});
Clazz_defineMethod(c$, "getLabel", 
function(){
return this.nextLabel(true);
});
Clazz_defineMethod(c$, "nextLabel", 
function(isGet){
this.rawLabel = null;
this.value = null;
while (this.line == null || this.line.length == 0) {
try {
this.readLine();
if (this.line == null) {
this.line = "";
return null;
}this.line = this.line.trim();
} catch (e) {
if (Clazz_exceptionOf(e,"java.io.IOException")){
this.line = "";
return null;
} else {
throw e;
}
}
if (this.line.startsWith("##")) break;
this.line = null;
}
this.rawLine = this.line;
var pt = this.line.indexOf("=");
if (pt < 0) {
if (isGet) JU.Logger.info("BAD JDX LINE -- no '=' (line " + this.lineNo + "): " + this.line);
this.rawLabel = this.line;
if (!isGet) this.line = "";
} else {
this.rawLabel = this.line.substring(0, pt).trim();
if (isGet) this.line = this.line.substring(pt + 1);
}this.labelLineNo = this.lineNo;
if (JU.Logger.debugging) JU.Logger.info(this.rawLabel);
return JSV.source.JDXSourceStreamTokenizer.cleanLabel(this.rawLabel);
}, "~B");
c$.cleanLabel = Clazz_defineMethod(c$, "cleanLabel", 
function(label){
if (label == null) return null;
if (!label.startsWith("#")) return label;
var i;
var str =  new JU.SB();
for (i = 0; i < label.length; i++) {
switch ((label.charAt(i)).charCodeAt(0)) {
case 47:
case 92:
case 32:
case 45:
case 95:
break;
default:
str.appendC(label.charAt(i));
break;
}
}
return str.toString().toUpperCase();
}, "~S");
Clazz_defineMethod(c$, "getValue", 
function(){
if (this.value != null) return this.value;
var sb =  new JU.SB().append(this.line);
if (sb.length() > 0) sb.appendC('\n');
try {
while (this.readLine() != null) {
if (this.line.indexOf("##") >= 0 && this.line.trim().startsWith("##")) break;
sb.append(this.line).appendC('\n');
}
} catch (e) {
if (Clazz_exceptionOf(e,"java.io.IOException")){
JU.Logger.info(e.toString());
} else {
throw e;
}
}
this.value = (this.rawLabel.startsWith("##$") ? sb.toString().trim() : JSV.source.JDXSourceStreamTokenizer.trimLines(sb));
if (JU.Logger.debugging) JU.Logger.info(this.value);
return this.value;
});
Clazz_defineMethod(c$, "readLineTrimmed", 
function(){
this.readLine();
if (this.line == null) return null;
if (this.line.indexOf("$$") < 0) return this.line.trim();
var sb =  new JU.SB().append(this.line);
return JSV.source.JDXSourceStreamTokenizer.trimLines(sb);
});
Clazz_defineMethod(c$, "flushLine", 
function(){
var sb =  new JU.SB().append(this.line);
this.line = null;
return JSV.source.JDXSourceStreamTokenizer.trimLines(sb);
});
Clazz_defineMethod(c$, "readLine", 
function(){
this.line = this.br.readLine();
this.lineNo++;
return this.line;
});
c$.trimLines = Clazz_defineMethod(c$, "trimLines", 
function(v){
var n = v.length();
var ilast = n - 1;
var vpt = JSV.source.JDXSourceStreamTokenizer.ptNonWhite(v, 0, n);
if (vpt >= n) return "";
var buffer =  Clazz_newCharArray (n - vpt, '\0');
var pt = 0;
for (; vpt < n; vpt++) {
var ch;
switch ((ch = v.charAt(vpt)).charCodeAt(0)) {
case 13:
if (vpt < ilast && v.charAt(vpt + 1) == '\n') continue;
ch = '\n';
break;
case 10:
if (pt > 0 && buffer[pt - 1] != '\n') pt -= vpt - JSV.source.JDXSourceStreamTokenizer.ptNonSpaceRev(v, vpt) - 1;
vpt = JSV.source.JDXSourceStreamTokenizer.ptNonSpace(v, ++vpt, n) - 1;
break;
case 36:
if (vpt < ilast && v.charAt(vpt + 1) == '$') {
vpt++;
while (++vpt < n && "\n\r".indexOf(v.charAt(vpt)) < 0) {
}
continue;
}break;
}
if (ch == '\n' && pt > 0 && buffer[pt - 1] == '\n') continue;
buffer[pt++] = ch;
}
if (pt > 0 && buffer[pt - 1] == '\n') --pt;
return ( String.instantialize(buffer)).substring(0, pt).trim();
}, "JU.SB");
c$.ptNonWhite = Clazz_defineMethod(c$, "ptNonWhite", 
function(v, pt, n){
while (pt < n && Character.isWhitespace(v.charAt(pt))) pt++;

return pt;
}, "JU.SB,~N,~N");
c$.ptNonSpace = Clazz_defineMethod(c$, "ptNonSpace", 
function(v, pt, n){
while (pt < n && (v.charAt(pt) == ' ' || v.charAt(pt) == '\t')) pt++;

return pt;
}, "JU.SB,~N,~N");
c$.ptNonSpaceRev = Clazz_defineMethod(c$, "ptNonSpaceRev", 
function(v, pt){
while (--pt >= 0 && (v.charAt(pt) == ' ' || v.charAt(pt) == '\t')) {
}
return pt;
}, "JU.SB,~N");
});
;//5.0.1-v7 Mon Aug 17 10:07:10 MDT 2026
Clazz_declarePackage("JSV.tree");
Clazz_load(["JSV.api.JSVTree"], "JSV.tree.SimpleTree", ["JSV.common.JSVFileManager", "$.PanelNode", "JSV.tree.SimpleTreeModel", "$.SimpleTreeNode", "$.SimpleTreePath"], function(){
var c$ = Clazz_decorateAsClass(function(){
this.si = null;
this.rootNode = null;
this.spectraTreeModel = null;
this.vwr = null;
this.selectedPath = null;
Clazz_instantialize(this, arguments);}, JSV.tree, "SimpleTree", null, JSV.api.JSVTree);
Clazz_makeConstructor(c$, 
function(viewer){
this.vwr = viewer;
this.rootNode =  new JSV.tree.SimpleTreeNode("Spectra", null);
this.spectraTreeModel =  new JSV.tree.SimpleTreeModel(this.rootNode);
}, "JSV.common.JSViewer");
Clazz_overrideMethod(c$, "getRootNode", 
function(){
return this.rootNode;
});
Clazz_defineMethod(c$, "valueChanged", 
function(){
this.vwr.selectedTreeNode(this.getLastSelectedPathComponent());
});
Clazz_defineMethod(c$, "getLastSelectedPathComponent", 
function(){
return (this.selectedPath == null ? null : this.selectedPath.getLastPathComponent());
});
Clazz_overrideMethod(c$, "setSelectedPanel", 
function(si, jsvp){
if (jsvp != null) {
var treeNode = JSV.common.PanelNode.findNode(jsvp, this.vwr.panelNodes).treeNode;
this.setSelectionPath(this.vwr.spectraTree.newTreePath(treeNode.getPath()));
}}, "JSV.api.ScriptInterface,JSV.api.JSVPanel");
Clazz_defineMethod(c$, "setSelectionPath", 
function(newTreePath){
this.selectedPath = newTreePath;
this.valueChanged();
}, "JSV.api.JSVTreePath");
Clazz_overrideMethod(c$, "createTree", 
function(fileCount, source, panels){
var tree = this.vwr.spectraTree;
var rootNode = tree.getRootNode();
var panelNodes = this.vwr.panelNodes;
var fileName = JSV.common.JSVFileManager.getTagName(source.getFilePath());
var panelNode =  new JSV.common.PanelNode(null, fileName, source, null);
var fileNode =  new JSV.tree.SimpleTreeNode(fileName, panelNode);
panelNode.setTreeNode(fileNode);
tree.spectraTreeModel.insertNodeInto(fileNode, rootNode, rootNode.getChildCount());
for (var i = 0; i < panels.length; i++) {
var jsvp = panels[i];
var id = fileCount + "." + (i + 1);
panelNode =  new JSV.common.PanelNode(id, fileName, source, jsvp);
var treeNode =  new JSV.tree.SimpleTreeNode(panelNode.toString(), panelNode);
panelNode.setTreeNode(treeNode);
panelNodes.addLast(panelNode);
tree.spectraTreeModel.insertNodeInto(treeNode, fileNode, fileNode.getChildCount());
}
this.vwr.selectFrameNode(panels[0]);
return fileNode;
}, "~N,JSV.source.JDXSource,~A");
Clazz_overrideMethod(c$, "setPath", 
function(path){
this.setSelectionPath(path);
}, "JSV.api.JSVTreePath");
Clazz_defineMethod(c$, "newTreePath", 
function(path){
return  new JSV.tree.SimpleTreePath(path);
}, "~A");
Clazz_overrideMethod(c$, "deleteNodes", 
function(toDelete){
for (var i = 0; i < toDelete.size(); i++) {
this.spectraTreeModel.removeNodeFromParent(toDelete.get(i));
}
}, "JU.Lst");
});
;//5.0.1-v7 Mon Aug 17 10:07:10 MDT 2026
Clazz_declarePackage("JSV.tree");
Clazz_load(["java.util.Enumeration"], "JSV.tree.SimpleTreeEnumeration", null, function(){
var c$ = Clazz_decorateAsClass(function(){
this.node = null;
this.pt = 0;
Clazz_instantialize(this, arguments);}, JSV.tree, "SimpleTreeEnumeration", null, java.util.Enumeration);
Clazz_makeConstructor(c$, 
function(jsTreeNode){
this.node = jsTreeNode;
}, "JSV.tree.SimpleTreeNode");
Clazz_overrideMethod(c$, "hasMoreElements", 
function(){
return (this.pt < this.node.$children.size());
});
Clazz_overrideMethod(c$, "nextElement", 
function(){
return this.node.$children.get(this.pt++);
});
});
;//5.0.1-v7 Mon Aug 17 10:07:10 MDT 2026
Clazz_declarePackage("JSV.tree");
(function(){
var c$ = Clazz_decorateAsClass(function(){
this.rootNode = null;
Clazz_instantialize(this, arguments);}, JSV.tree, "SimpleTreeModel", null);
Clazz_makeConstructor(c$, 
function(rootNode){
this.rootNode = rootNode;
}, "JSV.api.JSVTreeNode");
Clazz_defineMethod(c$, "insertNodeInto", 
function(fileNode, rootNode, i){
var node = rootNode;
node.$children.add(i, fileNode);
(fileNode).prevNode = node;
}, "JSV.api.JSVTreeNode,JSV.api.JSVTreeNode,~N");
Clazz_defineMethod(c$, "removeNodeFromParent", 
function(node){
(node).prevNode.$children.removeObj(node);
}, "JSV.api.JSVTreeNode");
})();
;//5.0.1-v7 Mon Aug 17 10:07:10 MDT 2026
Clazz_declarePackage("JSV.tree");
Clazz_load(["JSV.api.JSVTreeNode"], "JSV.tree.SimpleTreeNode", ["JU.Lst", "JSV.tree.SimpleTreeEnumeration"], function(){
var c$ = Clazz_decorateAsClass(function(){
this.panelNode = null;
this.index = 0;
this.prevNode = null;
this.$children = null;
this.text = null;
Clazz_instantialize(this, arguments);}, JSV.tree, "SimpleTreeNode", null, JSV.api.JSVTreeNode);
Clazz_makeConstructor(c$, 
function(text, panelNode){
this.text = text;
this.panelNode = panelNode;
this.$children =  new JU.Lst();
}, "~S,JSV.common.PanelNode");
Clazz_overrideMethod(c$, "getPanelNode", 
function(){
return this.panelNode;
});
Clazz_overrideMethod(c$, "getIndex", 
function(){
return this.index;
});
Clazz_overrideMethod(c$, "setIndex", 
function(index){
this.index = index;
}, "~N");
Clazz_overrideMethod(c$, "children", 
function(){
return  new JSV.tree.SimpleTreeEnumeration(this);
});
Clazz_overrideMethod(c$, "getChildCount", 
function(){
return this.$children.size();
});
Clazz_overrideMethod(c$, "getPath", 
function(){
var o =  new JU.Lst();
var node = this;
o.addLast(node);
while ((node = node.prevNode) != null) o.add(0, node);

return o.toArray();
});
Clazz_overrideMethod(c$, "isLeaf", 
function(){
return (this.prevNode != null && this.prevNode.prevNode != null);
});
Clazz_overrideMethod(c$, "toString", 
function(){
return this.text;
});
});
;//5.0.1-v7 Mon Aug 17 10:07:10 MDT 2026
Clazz_declarePackage("JSV.tree");
Clazz_load(["JSV.api.JSVTreePath"], "JSV.tree.SimpleTreePath", null, function(){
var c$ = Clazz_decorateAsClass(function(){
this.path = null;
Clazz_instantialize(this, arguments);}, JSV.tree, "SimpleTreePath", null, JSV.api.JSVTreePath);
Clazz_makeConstructor(c$, 
function(path){
this.path = path;
}, "~A");
Clazz_overrideMethod(c$, "getLastPathComponent", 
function(){
return (this.path == null || this.path.length == 0 ? null : this.path[this.path.length - 1]);
});
});
;//5.0.1-v7 Mon Aug 17 10:07:10 MDT 2026

})();

Clazz._coreLoaded = true;



})(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.checkPrivateMethod
,Clazz.cloneFinals
);
