");d=f.length-1+" matches";break;case "$":case ":":break;default:return}a._infoHeader=d;a._info=b.join("");a._showInfo(!0)};a._loadSuccess=function(e,f){f&&(a._ajaxDone(),f(e))};a._loadError=
function(e){a._ajaxDone();a.say("Error connecting to server: "+a._ajaxCall);null!=e&&e()};a._isDatabaseCall=function(e){return 0<=a.db._databasePrefixes.indexOf(e.substring(0,1))};a._getDirectDatabaseCall=function(e,f){if(f&&!a.featureDetection.supportsXhr2())return e;var h=2,b=e.substring(0,h),d=a.db._DirectDatabaseCalls[b]||a.db._DirectDatabaseCalls[b=e.substring(0,--h)];d&&(":"==b?(b=e.toLowerCase(),isNaN(parseInt(e.substring(1)))?0==b.indexOf(":smiles:")?(d+="?POST?smiles="+e.substring(8),e="smiles"):
0==b.indexOf(":cid:")?e="cid/"+e.substring(5):(0==b.indexOf(":name:")?e=e.substring(5):0==b.indexOf(":cas:")&&(e=e.substring(4)),e="name/"+encodeURIComponent(e.substring(h))):e="cid/"+e.substring(1)):e=encodeURIComponent(e.substring(h)),0<=d.indexOf("FILENCI")?(e=e.replace(/\%2F/g,"/"),e=d.replace(/\%FILENCI/,e)):e=d.replace(/\%FILE/,e));return e};a._getRawDataFromServer=function(e,f,h,b,d,c){e="?call=getRawDataFromDatabase&database="+e+(0<=f.indexOf("?POST?")?"?POST?":"")+"&query="+encodeURIComponent(f)+
(d?"&encoding=base64":"")+(c?"":"&script="+encodeURIComponent(a._getScriptForDatabase(e)));return a._contactServer(e,h,b)};a._checkFileName=function(e,f,h){a._isDatabaseCall(f)&&(h&&a._setQueryTerm(e,f),f=a._getDirectDatabaseCall(f,!0),a._isDatabaseCall(f)&&(f=a._getDirectDatabaseCall(f,!1),h&&(h[0]=!0)));return f};a._checkCache=function(e,f,h){if(e._cacheFiles&&a._fileCache&&!f.endsWith(".js")){if(e=a._fileCache[f])return System.out.println("using "+e.length+" bytes of cached data for "+f),h(e),
null;h=function(e,f){h(a._fileCache[e]=f)}}return h};a._loadFileData=function(e,f,h,b){var d=[];f=a._checkFileName(e,f,d);h=a._checkCache(e,f,h);d[0]?a._getRawDataFromServer("_",f,h,b):(e={type:"GET",dataType:"text",url:f,async:a._asynchronous,success:function(e){a._loadSuccess(e,h)},error:function(){a._loadError(b)}},a._checkAjaxPost(e),a._ajax(e))};a._getInfoFromDatabase=function(e,f,h){if("===="==f){var b=a.db._restQueryXml.replace(/QUERY/,h),b={dataType:"text",type:"POST",contentType:"application/x-www-form-urlencoded",
url:a.db._restQueryUrl,data:encodeURIComponent(b)+"&req=browser",success:function(b){a._ajaxDone();a._extractInfoFromRCSB(e,f,h,b)},error:function(){a._loadError(null)},async:a._asynchronous};return a._ajax(b)}h="?call=getInfoFromDatabase&database="+f+"&query="+encodeURIComponent(h);return a._contactServer(h,function(h){a._setInfo(e,f,h)})};a._extractInfoFromRCSB=function(e,f,h,b){var d=b.length/5;if(0!=d&&4==h.length&&1!=d){h=h.toUpperCase();var c=b.indexOf(h);0c.indexOf("?")&&c==e._thisJmolModel)){e._thisJmolModel=c;var g;b&&null!=e._viewSet&&null!=(g=a.View.__findView(e._viewSet,{chemID:c}))?a.View.__setView(g,
e,!1):("$"==d||":"==d?e._jmolFileType="MOL":"="==d&&(e._jmolFileType="PDB"),e._searchDatabase(f,d,h))}};a._searchDatabase=function(e,f,h,b){e._showInfo(!1);return 0<=f.indexOf("?")?(a._getInfoFromDatabase(e,h,f.split("?")[0]),!0):a.db._DirectDatabaseCalls[h]?(e._loadFile(h+f,b),!0):!1};a._syncBinaryOK="?";a._canSyncBinary=function(e){if(a._isAsync)return!0;if(self.VBArray)return a._syncBinaryOK=!1;if("?"!=a._syncBinaryOK)return a._syncBinaryOK;a._syncBinaryOK=!0;try{var f=new window.XMLHttpRequest;
f.open("text",a._ajaxTestSite,!1);f.hasOwnProperty("responseType")?f.responseType="arraybuffer":f.overrideMimeType&&f.overrideMimeType("text/plain; charset=x-user-defined")}catch(h){return System.out.println("JSmolCore.js: synchronous binary file transfer is requested but not available"),a._alertNoBinary&&!e&&alert("JSmolCore.js: synchronous binary file transfer is requested but not available"),a._syncBinaryOK=!1}return!0};a._binaryTypes=".gz .jpg .gif .png .zip .jmol .bin .smol .spartan .mrc .map .ccp4 .dn6 .delphi .omap .pse .dcd".split(" ");
a._isBinaryUrl=function(e){for(var f=a._binaryTypes.length;0<=--f;)if(0<=e.indexOf(a._binaryTypes[f]))return!0;return!1};a._getFileData=function(e,f,h){var b=a._isBinaryUrl(e),d=0<=e.indexOf("pdb.gz")&&0==e.indexOf("http://www.rcsb.org/pdb/files/"),c=b&&!a._canSyncBinary(d);c&&d&&(e=e.replace(/pdb\.gz/,"pdb"),c=b=!1);d=0<=e.indexOf("?POST?");0==e.indexOf("file:/")&&0!=e.indexOf("file:///")&&(e="file://"+e.substring(5));var g=0>e.indexOf("://")||0==e.indexOf(document.location.protocol)&&0<=e.indexOf(document.location.host),
k="https://"==a._httpProto&&0==e.indexOf("http://"),j=a._isDirectCall(e);!j&&0<=e.indexOf("?ALLOWSORIGIN?")&&(j=!0,e=e.replace(/\?ALLOWSORIGIN\?/,""));var m=!g&&a.$supportsIECrossDomainScripting(),l=null;if(k||c||!g&&!j||!f&&m)l=a._getRawDataFromServer("_",e,f,f,c,!0);else{e=e.replace(/file:\/\/\/\//,"file://");var q={dataType:b?"binary":"text",async:!!f};d?(q.type="POST",q.url=e.split("?POST?")[0],q.data=e.split("?POST?")[1]):(q.type="GET",q.url=e);f&&(q.success=function(){f(a._xhrReturn(q.xhr))},
q.error=function(){f(q.xhr.statusText)});q.xhr=a.$ajax(q);f||(l=a._xhrReturn(q.xhr))}if(!h)return l;null==l&&(l="",b=!1);b&&(b=a._canSyncBinary(!0));return b?a._strToBytes(l):JU.SB.newS(l)};a._xhrReturn=function(a){return!a.responseText||self.Clazz&&Clazz.instanceOf(a.response,self.ArrayBuffer)?a.response||a.statusText:a.responseText};a._isDirectCall=function(e){if(0<=e.indexOf("?ALLOWSORIGIN?"))return!0;for(var f in a.db._DirectDatabaseCalls)if(0<=f.indexOf(".")&&0<=e.indexOf(f))return!0;return!1};
a._cleanFileData=function(a){return 0<=a.indexOf("\r")&&0<=a.indexOf("\n")?a.replace(/\r\n/g,"\n"):0<=a.indexOf("\r")?a.replace(/\r/g,"\n"):a};a._getFileType=function(a){var f=a.substring(0,1);if("$"==f||":"==f)return"MOL";if("="==f)return"="==a.substring(1,2)?"LCIF":"PDB";a=a.split(".").pop().toUpperCase();return a.substring(0,Math.min(a.length,3))};a._getZ=function(e,f){return e&&e._z&&e._z[f]||a._z[f]};a._incrZ=function(e,f){return e&&e._z&&++e._z[f]||++a._z[f]};a._hideLocalFileReader=function(e,
f){e._localReader&&a.$setVisible(e._localReader,!1);e._readingLocal=!1;a._setCursor(e,f||0)};a._loadFileAsynchronously=function(e,f,h,b){if(0!=h.indexOf("?")){var d=h;h=a._checkFileName(f,h);var c=function(f){a._setData(e,h,d,f,b)},c=a._checkCache(f,h,c);0<=h.indexOf("|")&&(h=h.split("|")[0]);return null==c?null:a._getFileData(h,c)}if(!a.featureDetection.hasFileReader)return e.setData("Local file reading is not enabled in your browser",null,null,b);f._localReader||(c='
',a.$after("#"+f._id+"_appletdiv",c.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._hideLocalFileReader(f,3),a._setData(e,h.name,h.name,d.target.result,b))};try{d.readAsArrayBuffer(h)}catch(c){alert("You must select a file first.")}});a.$appEvent(f,"localReader_cancel","click");a.$appEvent(f,"localReader_cancel","click",function(){a._hideLocalFileReader(f);e.setData("#CANCELED#",null,null,b)});a.$setVisible(f._localReader,!0);f._readingLocal=!0};a._setData=function(e,f,h,b,d){b=a._strToBytes(b);0<=f.indexOf(".jdx")&&
a.Cache.put("cache://"+f,b);e.setData(f,h,b,d)};a._doAjax=function(e,f,h){e=e.toString();if(null!=h)return a._saveFile(e,h);f&&(e+="?POST?"+f);return a._getFileData(e,null,!0)};a._saveFile=function(e,f,h,b){if(a._localFileSaveFunction&&a._localFileSaveFunction(e,f))return"OK";e=e.substring(e.lastIndexOf("/")+1);h||(h=0<=e.indexOf(".pdf")?"application/pdf":0<=e.indexOf(".png")?"image/png":0<=e.indexOf(".gif")?"image/gif":0<=e.indexOf(".jpg")?"image/jpg":"");var d="string"==typeof f;d||(f=(JU?JU:J.util).Base64.getBase64(f).toString());
b||(b=d?"":"base64");(d=a._serverUrl)&&0<=d.indexOf("your.server")&&(d="");a._useDataURI||!d?(b||(f=btoa(f)),b=document.createElement("a"),b.href="data:"+h+";base64,"+f,b.type=h||"text/plain",b.download=e,b.target="_blank",j("body").append(b),b.click(),b.remove()):(a._formdiv||(a.$after("body",'