',a.$after("#"+f._id+"_appletdiv",h.replace(/ID/g,f._id+"_localReader")),f._localReader=a.$(f,"localReader"));a.$appEvent(f,"localReader_loadfile","click");a.$appEvent(f,"localReader_loadfile","click",function(){var h=a.$(f,"localReader_files")[0].files[0],d=new FileReader;d.onloadend=
function(d){d.target.readyState==FileReader.DONE&&(a.$css(a.$(f,"localReader"),{display:"none"}),d=a._toBytes(d.target.result),0<=h.name.indexOf(".jdx")&&a.Cache.put("cache://"+h.name,d),b.setData(h.name,d,c))};d.readAsArrayBuffer(h)});a.$appEvent(f,"localReader_cancel","click");a.$appEvent(f,"localReader_cancel","click",function(){a.$css(a.$(f,"localReader"),{display:"none"});b.setData(null,c)});a.$css(a.$(f,"localReader"),{display:"block"})};a._toBytes=function(b){b=new Uint8Array(b);for(var a=
Clazz.newByteArray(b.length,0),h=b.length;0<=--h;)a[h]=b[h];return a};a._doAjax=function(b,f,h){b=b.toString();if(null!=h)return a._saveFile(b,h);f&&(b+="?POST?"+f);f=a._getFileData(b);return a._processData(f,a._isBinaryUrl(b))};a._saveFile=function(b,f){var h=a._serverUrl;if(a._localFileSaveFunction&&a._localFileSaveFunction(b,f))return"OK";if(!h)return"Jmol._serverUrl is not defined";var c="string"==typeof f,d=c?"":"base64";c||(f=(JU?JU:J.util).Base64.getBase64(f).toString());b=b.substring(b.lastIndexOf("/")+
1);c=0<=b.indexOf(".png")?"image/png":0<=b.indexOf(".jpg")?"image/jpg":"";a._formdiv||(a.$after("body",'
\t\t\t\t\t\t\t\t\t\t
'),
a._formdiv="__jsmolform__");a.$attr(a._formdiv,"action",h+"?"+(new Date).getMilliseconds());a.$val("__jsmoldata__",f);a.$val("__jsmolfilename__",b);a.$val("__jsmolmimetype__",c);a.$val("__jsmolencoding__",d);a.$submit("__jsmolform__");a.$val("__jsmoldata__","");a.$val("__jsmolfilename__","");return"OK"};a._processData=function(b,f){"undefined"==typeof b&&(b="",f=!1);f&&(f=a._canSyncBinary());if(!f)return self.JU&&JU.SB?JU.SB.newS(b):J.util.SB.newS(b);var h;if(Clazz.instanceOf(b,self.ArrayBuffer))return a._toBytes(b);
h=Clazz.newByteArray(b.length,0);for(var c=b.length;0<=--c;)h[c]=b.charCodeAt(c)&255;return h};a._setConsoleDiv=function(b){self.Clazz&&Clazz.setConsoleDiv(b)};a._setJmolParams=function(b,f,c){for(var d in f)if(0<=";progressbar;progresscolor;boxbgcolor;boxfgcolor;allowjavascript;boxmessage;\t\t\t\t\t\t\t\t\t;messagecallback;pickcallback;animframecallback;appletreadycallback;atommovedcallback;\t\t\t\t\t\t\t\t\t;echocallback;evalcallback;hovercallback;language;loadstructcallback;measurecallback;\t\t\t\t\t\t\t\t\t;minimizationcallback;resizecallback;scriptcallback;statusform;statustext;statustextarea;\t\t\t\t\t\t\t\t\t;synccallback;usecommandthread;syncid;appletid;startupscript;menufile;".indexOf(";"+
d.toLowerCase()+";")&&("language"!=d||a.featureDetection.supportsLocalization()))c?b.put(d,!0===f[d]?Boolean.TRUE:!1===f[d]?Boolean.FALSE:f[d]):b[d]=f[d]};a._registerApplet=function(b,f){return window[b]=a._applets[b]=a._applets[f]=a._applets[b+"__"+a._syncId+"__"]=f};a._readyCallback=function(b,f,c,d){b=b.split("_object")[0];c=c.booleanValue?c.booleanValue():c;a._track(a._applets[b])._readyCallback(b,f,c,d)};a._getWrapper=function(b,f){var c;if(f){var d="";b._coverImage&&(c=' onclick="Jmol.coverApplet(ID, false)" title="'+
b._coverTitle+'"',d='
",d='
"+d+"
");c='...
IMG......
';var e=b._height,g=b._width;if("string"!==typeof e||0>e.indexOf("%"))e+="px";if("string"!==typeof g||0>g.indexOf("%"))g+="px";c=c.replace(/IMG/,d).replace(/Hpx/g,e).replace(/Wpx/g,g)}else c='......
......
......
...
';
return c.replace(/\.\.\./g,"").replace(/[\n\r]/g,"").replace(/ID/g,b._id)};a._documentWrite=function(b){if(a._document){if(a._isXHTML&&!a._XhtmlElement){var f=document.getElementsByTagName("script");a._XhtmlElement=f.item(f.length-1);a._XhtmlAppendChild=!1}a._XhtmlElement?a._domWrite(b):a._document.write(b)}return b};a._domWrite=function(b){for(var f=[0];f[0]
b.jarFile.indexOf("Signed")&&(b.jarFile=b.jarFile.replace(/Applet/,"AppletSigned")),b.use="JAVA",b.isSigned=!0)};a._syncedApplets=[];a._syncedCommands=[];a._syncedReady=[];a._syncReady=!1;a._isJmolJSVSync=!1;a._setReady=function(b){a._syncedReady[b]=1;for(var f=0,c=0;cc[0]?-1:0}if(!b||"object"!=typeof b)return[];for(var c=[],d=b.length-1;0<=d;d--)for(var e=0,g=b[d].length;ec.type.indexOf("touch"))return!1;c.preventDefault();var d=a.$offset(b.id),e,g=c.originalEvent;a._mousePageX=c.pageX;a._mousePageY=c.pageY;g.targetTouches&&g.targetTouches[0]?
(e=g.targetTouches[0].pageX-d.left,d=g.targetTouches[0].pageY-d.top):g.changedTouches?(e=g.changedTouches[0].pageX-d.left,d=g.changedTouches[0].pageY-d.top):(e=c.pageX-d.left,d=c.pageY-d.top);return void 0==e?null:[Math.round(e),Math.round(d),a._jsGetMouseModifiers(c)]};a._gestureUpdate=function(b,c){c.stopPropagation();c.preventDefault();var d=c.originalEvent;switch(c.type){case "touchstart":a._touching=!0;break;case "touchend":a._touching=!1}if(!d.touches||2!=d.touches.length)return!1;switch(c.type){case "touchstart":b._touches=
[[],[]];break;case "touchmove":var e=a.$offset(b.id),g=b._touches[0],k=b._touches[1];g.push([d.touches[0].pageX-e.left,d.touches[0].pageY-e.top]);k.push([d.touches[1].pageX-e.left,d.touches[1].pageY-e.top]);d=g.length;3d?-1:1,0,c]);return!1});a.$bind(b,"contextmenu",function(){return!1});a.$bind(b,"mouseout",function(c){b.applet._applet&&
b.applet._applet.viewer.startHoverWatcher(!1);b.isDragging=!1;c=a._jsGetXY(b,c);if(!c)return!1;b.applet._processEvent(502,c);b.applet._processEvent(505,c);return!1});a.$bind(b,"mouseenter",function(c){b.applet._applet&&b.applet._applet.viewer.startHoverWatcher(!0);if(0===c.buttons||0===c.which){b.isDragging=!1;c=a._jsGetXY(b,c);if(!c)return!1;b.applet._processEvent(504,c);b.applet._processEvent(502,c);return!1}});b.applet._is2D&&a.$resize(function(){b.applet&&b.applet._resize()});a.$bind("body","mouseup touchend",
function(){b.applet&&(b.isDragging=!1);a._setMouseOwner(null)})};a._jsUnsetMouse=function(b){b.applet=null;a.$bind(b,"mousedown touchstart mousemove touchmove mouseup touchend DOMMouseScroll mousewheel contextmenu mouseout mouseenter",null);a._setMouseOwner(null)};a.Swing={count:0,menuInitialized:0,menuCounter:0,htDialogs:{}};var l=a.Swing;SwingController=l;l.setDraggable=function(b){b=b.prototype;b.setContainer||(b.setContainer=function(b){this.container=b;b.obj=this;this.ignoreMouse=this.isDragging=
!1;var c=this;b.bind("mousedown touchstart",function(b){if(c.ignoreMouse)return c.ignoreMouse=!1,!0;a._setMouseOwner(c,!0);c.isDragging=!0;c.pageX=b.pageX;c.pageY=b.pageY;return!1});b.bind("mousemove touchmove",function(b){if(c.isDragging&&a._mouseOwner==c)return c.mouseMove(b),!1});b.bind("mouseup touchend",function(b){c.mouseUp(b);a._setMouseOwner(null)})},b.mouseUp=function(b){if(this.isDragging&&a._mouseOwner==this)return this.pageX0+=b.pageX-this.pageX,this.pageY0+=b.pageY-this.pageY,this.isDragging=
!1;a._setMouseOwner(null)},b.setPosition=function(){if(null===a._mousePageX){var b=a.$offset(this.applet._id+"_"+(this.applet._is2D?"canvas2d":"canvas"));a._mousePageX=b.left;a._mousePageY=b.top}this.pageX0=a._mousePageX;this.pageY0=a._mousePageY;this.container.css({top:a._mousePageY+"px",left:a._mousePageX+"px"})},b.mouseMove=function(b){this.isDragging&&a._mouseOwner==this&&this.container.css({top:this.pageY0+(b.pageY-this.pageY)+"px",left:this.pageX0+(b.pageX-this.pageX)+"px"})},b.dragBind=function(b){this.container.unbind("mousemoveoutjsmol");
this.container.unbind("touchmoveoutjsmol");this.container.unbind("mouseupoutjsmol");this.container.unbind("touchendoutjsmol");a._setMouseOwner(null);if(b){var c=this;this.container.bind("mousemoveoutjsmol touchmoveoutjsmol",function(b,a,f){c.mouseMove(f)});this.container.bind("mouseupoutjsmol touchendoutjsmol",function(b,a,f){c.mouseUp(f)})}})};l.JSDialog=function(){};l.setDraggable(l.JSDialog);l.getScreenDimensions=function(b){b.width=j(window).width();b.height=j(window).height()};l.dispose=function(b){a.$remove(b.id+
"_mover");delete l.htDialogs[b.id];b.container.obj.dragBind(!1)};l.register=function(b,a){b.id=a+ ++l.count;l.htDialogs[b.id]=b};l.setDialog=function(b){a._setMouseOwner(null);a.$remove(b.id);var c=b.id+"_mover",d=a._$(c),e;d[0]?(d.html(b.html),e=d[0].jd):(a.$after("body",""+b.html+"
"),e=new l.JSDialog,d=a._$(c),b.container=d,e.applet=b.manager.viewer.applet,e.setContainer(d),e.dialog=b,e.setPosition(),e.dragBind(!0),d[0].jd=e);a.$bind("#"+
b.id+" .JButton","mousedown touchstart",function(){e.ignoreMouse=!0});a.$bind("#"+b.id+" .JComboBox","mousedown touchstart",function(){e.ignoreMouse=!0});a.$bind("#"+b.id+" .JCheckBox","mousedown touchstart",function(){e.ignoreMouse=!0});a.$bind("#"+b.id+" .JTextField","mousedown touchstart",function(){e.ignoreMouse=!0});a.$bind("#"+b.id+" .JTable","mousedown touchstart",function(){e.ignoreMouse=!0});a.$bind("#"+b.id+" .JScrollPane","mousedown touchstart",function(){e.ignoreMouse=!0});a.$bind("#"+
b.id+" .JEditorPane","mousedown touchstart",function(){e.ignoreMouse=!0})};l.setSelected=function(b){a.$prop(b.id,"checked",!!b.selected)};l.setSelectedIndex=function(b){a.$prop(b.id,"selectedIndex",b.selectedIndex)};l.setText=function(b){a.$prop(b.id,"value",b.text)};l.setVisible=function(b){a.$setVisible(b.id,b.visible)};l.setEnabled=function(b){a.$setEnabled(b.id,b.enabled)};l.click=function(b,c){var d=l.htDialogs[b.id];if(d){var e=d.toString();if(0<=e.indexOf("JCheck"))d.selected=b.checked;else if(0<=
e.indexOf("JCombo"))d.selectedIndex=b.selectedIndex;else if(null!=d.text&&(d.text=b.value,c&&13!=(c.charCode||c.keyCode)))return}e=l.htDialogs[a.$getAncestorDiv(b.id,"JDialog").id];e.manager.actionPerformed(d?d.name:e.registryKey+"/"+b.id)};l.setFront=function(b){var c=b.manager.viewer.applet;b.zIndex!=a._getZ(c,"dialog")&&(b.zIndex=a._incrZ(c,"dialog"));b.container&&((b.container[0]||b.container).style.zIndex=b.zIndex)};l.hideMenus=function(b){if(b=b._menus)for(var a in b)b[a].visible&&l.hideMenu(b[a])};
l.windowClosing=function(b){b=l.htDialogs[a.$getAncestorDiv(b.id,"JDialog").id];b.registryKey?b.manager.processWindowClosing(b.registryKey):b.dispose()};a._track=function(b){if(a._tracker){try{var c='';a.$after("body",c)}catch(d){}delete a._tracker}return b};a.getProfile=
function(){window["j2s.doProfile"]=!0;if(self.Clazz)return Clazz._profile=self.JSON&&{},Clazz.getProfile()};a._getInChIKey=function(b,a){0<=a.indexOf("MOL=")&&a.split("MOL=")[1].split('"')};a._getAttr=function(b,a){var c=b.indexOf(a+"=");return 0<=c&&0<=(c=b.indexOf('"',c))?b.substring(c+1,b.indexOf('"',c+1)):null};a.User={viewUpdatedCallback:null};a.View={count:0,applets:{},sets:{}};(function(b){b.updateView=function(c,d){if(null!=c._viewSet){d.chemID||(c._searchQuery=null);d.data||(d.data="N/A");
d.type=c._viewType;if(null==(c._currentView=b.__findView(c._viewSet,d)))c._currentView=b.__createViewSet(c._viewSet,d.chemID,d.viewID||d.chemID);c._currentView[d.type].data=d.data;c._currentView[d.type].smiles=c._getSmiles();a.User.viewUpdatedCallback&&a.User.viewUpdatedCallback(c,"updateView");b.__setView(c._currentView,c,!1)}};b.updateFromSync=function(c,d){c._updateMsg=d;var e=a._getAttr(d,"sourceID")||a._getAttr(d,"file");if(e){var g=b.__findView(c._viewSet,{viewID:e});if(null==g)return a.updateView(c,
d);g!=c._currentView&&b.__setView(g,c,!0);var k=(e=a._getAttr(d,"atoms"))&&0<=d.indexOf("selectionhalos ON")?eval("["+e+"]"):[];setTimeout(function(){b.updateAtomPick(c,k)},10);a.User.viewUpdatedCallback&&a.User.viewUpdatedCallback(c,"updateFromSync")}};b.updateAtomPick=function(b,c){var d=b._currentView;if(null!=d){for(var e in d)"info"!=e&&d[e].applet!=b&&d[e].applet._updateAtomPick(c);a.User.viewUpdatedCallback&&a.User.viewUpdatedCallback(b,"updateAtomPick")}};b.dumpViews=function(a){var c=b.sets[a];
if(c){var d="View set "+a+":\n";a=b.applets[a];for(var e in a)d+="\napplet "+a[e]._id+" currentView="+(a[e]._currentView?a[e]._currentView.info.viewID:null);for(e=c.length;0<=--e;){a=c[e];var d=d+("\n\nview="+e+" viewID="+a.info.viewID+" chemID="+a.info.chemID+"\n"),g,k;for(k in a)"info"!=k&&(d+="\nview="+e+" type="+k+" applet="+((g=a[k]).applet?g.applet._id:null)+" SMILES="+g.smiles+"\n atomMap="+JSON.stringify(g.atomMap)+"\n data=\n"+g.data+"\n")}return d}};b.__init=function(a){var c=a._viewSet,
d=b.applets;d[c]||(d[c]={});d[c][a._viewType]=a};b.__findView=function(a,c){var d=b.sets[a];null==d&&(d=b.sets[a]=[]);for(var e=d.length;0<=--e;){var g=d[e];if(c.viewID){if(g.info.viewID==c.viewID)return g}else{if(null!=c.chemID&&c.chemID==g.info.chemID)return g;for(var k in g)if("info"!=k&&(null!=c.data&&null!=g[k].data?c.data==g[k].data:c.type==k))return g}}return null};b.__createViewSet=function(c,d,e){b.count++;d={info:{chemID:d,viewID:e||"model_"+b.count}};for(var g in a._applets)e=a._applets[g],
e._viewSet==c&&(d[e._viewType]={applet:e,data:null});b.sets[c].push(d);return d};b.__setView=function(b,a,c){for(var d in b)if("info"!=d){var e=b[d],g=e.applet,k=c||null!=g&&""==g._molData;if(!(null==g||g==a&&!k)){var j=null==e.data,l=null!=g._currentView;g._currentView=b;if(!l||!(b[d].data==e.data&&!j&!k))if(g._loadModelFromView(b),j)break}}}})(a.View);a.Cache={fileCache:{}};a.Cache.get=function(b){return a.Cache.fileCache[b]};a.Cache.put=function(b,c){a.Cache.fileCache[b]=c};a.Cache.setDragDrop=
function(b){a.$appEvent(b,"appletdiv","dragover",function(b){b=b.originalEvent;b.stopPropagation();b.preventDefault();b.dataTransfer.dropEffect="copy"});a.$appEvent(b,"appletdiv","drop",function(c){c=c.originalEvent;c.stopPropagation();c.preventDefault();var d=c.dataTransfer.files[0];c=new FileReader;c.onloadend=function(c){if(c.target.readyState==FileReader.DONE){var e="cache://DROP_"+d.name;c=a._toBytes(c.target.result);b._applet.viewer.cacheFileByName("cache://DROP_*",!1);"JSV"==b._viewType||e.endsWith(".jdx")?
a.Cache.put(e,c):b._applet.viewer.cachePut(e,c);b._applet.viewer.openFileAsyncSpecial(e,1)}};c.readAsArrayBuffer(d)})}})(Jmol,jQuery);Jmol._debugCode=!1;Jmol._grabberOptions=[["$","NCI(small molecules)"],[":","PubChem(small molecules)"]];Jmol.say=function(a){alert(a)};
Jmol._TMApplet=function(a,j,c){this._uniqueId=(""+Math.random()).substring(3);this._id=a;this._is2D=!0;this._isJava=!1;this._ready=!0;this._mouseDown=!1;this._jmolType="Jmol._Canvas2D (TwirlyMol)";if(c)return this;this._createCanvas(a,j);return this};
Jmol._TMApplet._getApplet=function(a,j,c){if(!Jmol.featureDetection.allowHTML5)return null;c||(c=!1);j||(j={});Jmol._addDefaultInfo(j,{color:"#FFFFFF",width:300,height:300,addSelectionOptions:!1,serverURL:"http://your.server.here/jsmol.php",defaultModel:"",readyFunction:null,use:"HTML5",bondWidth:5,shadeAtoms:!1,zoomScaling:1.5,pinchScaling:2,mouseDragFactor:0.5,touchDragFactor:0.15,multipleBondSpacing:4,spinRateX:0,spinRateY:0.5,spinFPS:20,spin:!1,noscript:!0,debug:!1});j=new Jmol._TMApplet(a,j,
c);return c?j:Jmol._registerApplet(a,j)};Jmol.getTMApplet=Jmol._TMApplet._getApplet;
(function(a){a._CPK="#FF1493 #FFFFFF #D9FFFF #CC80FF #C2FF00 #FFB5B5 #909090 #3050F8 #FF0D0D #90E050 #B3E3F5 #AB5CF2 #8AFF00 #BFA6A6 #F0C8A0 #FF8000 #FFFF30 #1FF01F #80D1E3 #8F40D4 #3DFF00 #E6E6E6 #BFC2C7 #A6A6AB #8A99C7 #9C7AC7 #E06633 #F090A0 #50D050 #C88033 #7D80B0 #C28F8F #668F8F #BD80E3 #FFA100 #A62929 #5CB8D1 #702EB0 #00FF00 #94FFFF #94E0E0 #73C2C9 #54B5B5 #3B9E9E #248F8F #0A7D8C #006985 #C0C0C0 #FFD98F #A67573 #668080 #9E63B5 #D47A00 #940094 #429EB0 #57178F #00C900".split(" ");a._elem="X 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".split(" ");
a._elemNo={};var j=a.prototype;j.spin=function(a){this.__Info.spin=a;this._spin(a)};j._spin=function(a){this._spinThread&&clearTimeout(this._spinThread);if(0==this.spinFPS||0==this.spinRateX&&0==this.spinRateY)a=!1;if(a){var d=this;a=1E3/this.spinFPS;this._mouseDown||(this._rotate(this.spinRateY,this.spinRateX),this._draw());this._spinThread=setTimeout(function(){d._spin(!0)},a)}};j._initParams=function(){this.zoom=this.__Info.defaultZoom||100;this.doSpin=this.__Info.spin||!1;this.center2D=[this._canvas.width/
2,this._canvas.height/2,0];this._getCenterAndRadius();this.rotation=new a.M3;this.shadeAtoms=!1;this._setParams()};j._setParams=function(){this.bondWidth=this.__Info.bondWidth||5;this.zoomScaling=this.__Info.zoomScaling||1.5;this.pinchScaling=this.__Info.pinchScaling||1;this.mouseDragFactor=this.__Info.mouseDragFactor||0.5;this.touchDragFactor=this.__Info.touchDragFactor||0.15;this.multipleBondSpacing=this.__Info.multipleBondSpacing||4;this.spinRateX=this.__Info.spinRateX||0;this.spinRateY=this.__Info.spinRateY||
0;this.spinFPS=this.__Info.spinFPS||0;var a=this.shadeAtoms;(this.shadeAtoms=this.__Info.shadeAtoms||!1)&&!a&&this._setAtomShades()};j._setAtomShades=function(){if(this.atoms)for(var a=this.atoms.length;0<=--a;)this.atoms[a].color50=this._getColor(this.atoms[a].color,0.5)};j._createCanvas=function(a,d){Jmol._setObject(this,a,d);this._color=this._color.replace(/0x/,"#");var e=Jmol._getWrapper(this,!0);Jmol._document?(Jmol._documentWrite(e),this._createCanvas2d(!1),e=""):e+='